Initial commit - migration from music repo to own repo
This commit is contained in:
commit
48d5fb91af
13 changed files with 337 additions and 0 deletions
54
src/parser
Normal file
54
src/parser
Normal file
|
@ -0,0 +1,54 @@
|
|||
#!
|
||||
|
||||
###
|
||||
# Parses arguments and commands from shell
|
||||
###
|
||||
|
||||
case "${1}" in
|
||||
exclude)
|
||||
shift
|
||||
cmd_exclude ${@}
|
||||
;;
|
||||
|
||||
init)
|
||||
shift
|
||||
cmd_init ${@}
|
||||
;;
|
||||
|
||||
deploy)
|
||||
shift
|
||||
TARGET="${1}"; shift
|
||||
imageidList=($(printf '%s\n' ${@} | sed 's/\(.*\)\..*/\1/'))
|
||||
cmd_deploy ${TARGET} ${imageidList[@]}
|
||||
;;
|
||||
|
||||
update)
|
||||
shift
|
||||
TARGET="${1}"; shift
|
||||
LAST_COMMIT="${TARGET}/${LAST_COMMIT}"
|
||||
NEW_COMMIT=$(git rev-parse HEAD)
|
||||
OLD_COMMIT=$(grep COMMIT "${LAST_COMMIT}" | cut -d'=' -f2)
|
||||
imageidList=($(sed 's/\(.*\)\..*/\1/' <<< $(git diff --name-only ${NEW_COMMIT} ${OLD_COMMIT}) | awk '!seen[$0]++' | grep SHA256))
|
||||
echo $LAST_COMMIT
|
||||
echo $NEW_COMMIT
|
||||
echo $OLD_COMMIT
|
||||
echo ${imageidList[@]}
|
||||
|
||||
cmd_deploy ${TARGET} ${imageidList[@]}
|
||||
case $? in
|
||||
0)
|
||||
_msg ECHO "Update completed succesfully"
|
||||
sed -i "s/COMMIT=.*/COMMIT=${NEW_COMMIT}/" ${LAST_COMMIT}
|
||||
;;
|
||||
|
||||
1)
|
||||
_msg ECHO "Missing exclude, manifest or exclude file. Please make sure you init"
|
||||
;;
|
||||
|
||||
2)
|
||||
_msg ECHO "Update completed with errors. Please review and deploy problematic images manually."
|
||||
sed -i "s/COMMIT=.*/COMMIT=${NEW_COMMIT}/" ${LAST_COMMIT}
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue