diff options
author | Erich Eckner <git@eckner.net> | 2016-04-06 21:49:06 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-04-11 11:29:19 +0200 |
commit | e322d49cf57e3f8d3fa0c7d25e24cafd9b79fdb9 (patch) | |
tree | 492d2e4407620ae88fb058e4aecd99a9b9ac3ab9 /archPackagesUpdate | |
parent | baad9999d45fa6d0bef8747b8fc6527e49fe56f2 (diff) | |
download | archlinuxewe-e322d49cf57e3f8d3fa0c7d25e24cafd9b79fdb9.tar.xz |
tmpDir haeufiger entfernen bei Abbruch
Diffstat (limited to 'archPackagesUpdate')
-rwxr-xr-x | archPackagesUpdate | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/archPackagesUpdate b/archPackagesUpdate index 57d70f020..38ceb5243 100755 --- a/archPackagesUpdate +++ b/archPackagesUpdate @@ -26,11 +26,13 @@ usage() >&2 echo ' --no-selfUpdate: do not update this script from git' >&2 echo ' --no-abortOnMakepkgError: do not abort when makepkg returns non-zero' >&2 echo '' + rm -rf "${tmpDir}" exit 1 } # parse arguments eval set -- "$(getopt -o f --long force,no-upload,no-selfUpdate,no-abortOnMakepkgError -n "$(basename "$0")" -- "$@" || echo "usage")" +args=("$@") while true do @@ -57,6 +59,7 @@ do ;; *) >&2 echo "FEHLER: Verstehe Option \"$1\" doch nicht! Ich beende." + rm -rf "${tmpDir}" exit 1 esac done @@ -64,7 +67,7 @@ done if [ ! $# -eq 0 ] then >&2 echo 'FEHLER: Zu viele Argumente! Ich beende.' - exit 1 + usage fi $aufRechenknecht && pkgSrcDir="${pkgSrcDir}/archPackages" @@ -80,7 +83,7 @@ cd "${tmpDir}" if ${updateMe} && ${aufRechenknecht} && [ -e "$(basename $0)" ] && ! diff -q "$(basename $0)" "$0" &> /dev/null then cp "$(basename $0)" "$0" - $0 $@ + $0 "${args}" err=$? rm -rf "${tmpDir}" exit ${err} @@ -269,14 +272,28 @@ else fi done - ${err} && exit 1 + if ${err} + then + rm -rf "${tmpDir}" + exit 1 + fi cd "${pkgSrcDir}" - git push || exit $? - - ${force} && opts="-f" || opts="" + git push + err=$? + if [ ${err} -ne 0 ] + then + rm -rf "${tmpDir}" + exit ${err} + fi - ssh -p 22222 141.35.51.219 "~/archPackagesUpdate" ${opts} || exit $? + ssh -p 22222 141.35.51.219 "~/archPackagesUpdate" "${args}" + err=$? + if [ ${err} -ne 0 ] + then + rm -rf "${tmpDir}" + exit ${err} + fi fi # clean up |