Add no-push feature in the update script
This commit is contained in:
parent
d517b08343
commit
b10bbd72c7
|
@ -145,7 +145,7 @@ startRice() {
|
||||||
msg="${msg}. Would you like to continue?"
|
msg="${msg}. Would you like to continue?"
|
||||||
displayDialogBox --title "sadedot" --yesno "$msg" || return
|
displayDialogBox --title "sadedot" --yesno "$msg" || return
|
||||||
displayDialogBox --infobox "\nUpdating sadedot submodule. Please wait." VALUES
|
displayDialogBox --infobox "\nUpdating sadedot submodule. Please wait." VALUES
|
||||||
( cd ..; sh sadedot/scripts/update.sh 2>&1 | debug )
|
( cd ..; sh sadedot/scripts/update.sh -n 2>&1 | debug )
|
||||||
getGitconfigData
|
getGitconfigData
|
||||||
source scripts/linkFiles.sh
|
source scripts/linkFiles.sh
|
||||||
runUserScripts
|
runUserScripts
|
||||||
|
|
|
@ -1,11 +1,40 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat << EOF
|
||||||
|
usage: ${0##*/} [command]
|
||||||
|
-h | --help Print this help message.
|
||||||
|
-n | --no-push Do not push submodule changes to upstream.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
checkParameters() {
|
||||||
|
while [ -n "$1" ]; do
|
||||||
|
case $1 in
|
||||||
|
-h | --help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-n | --no-push)
|
||||||
|
noPush=true
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf '%s: invalid option %s\n' "${0##*/}" "$1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
updateSubmodules() {
|
updateSubmodules() {
|
||||||
git submodule update --remote --merge
|
git submodule update --remote --merge
|
||||||
gitStatus=$(git status --porcelain)
|
gitStatus=$(git status --porcelain)
|
||||||
grep -q "sadedot" <(echo "$gitStatus") || return
|
grep -q "sadedot" <(echo "$gitStatus") || return
|
||||||
git commit -m "Update sadedot submodule" sadedot
|
if [[ -n $noPush && $noPush = true ]]; then
|
||||||
git push
|
git commit -m "Update sadedot submodule" sadedot
|
||||||
|
git push
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
runScript() {
|
runScript() {
|
||||||
|
@ -13,9 +42,11 @@ runScript() {
|
||||||
sadedotParentFolder=$(pwd -P | awk '{ sub(/\/sadedot.*/, ""); print }')
|
sadedotParentFolder=$(pwd -P | awk '{ sub(/\/sadedot.*/, ""); print }')
|
||||||
cd "$sadedotParentFolder" || { echo "Couldn't cd into '$sadedotParentFolder'." 1>&2 && exit 1; }
|
cd "$sadedotParentFolder" || { echo "Couldn't cd into '$sadedotParentFolder'." 1>&2 && exit 1; }
|
||||||
|
|
||||||
|
checkParameters "$@"
|
||||||
|
|
||||||
updateSubmodules
|
updateSubmodules
|
||||||
|
|
||||||
cd "$lastFolder" || { echo "Couldn't cd into '$lastFolder'." 1>&2 && exit 1; }
|
cd "$lastFolder" || { echo "Couldn't cd into '$lastFolder'." 1>&2 && exit 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
runScript
|
runScript
|
||||||
|
|
Loading…
Reference in New Issue