diff options
author | Erich Eckner <git@eckner.net> | 2016-07-14 12:56:46 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-07-14 12:56:46 +0200 |
commit | 674904f5aa4178dd6c19d9e1964c9a22f7a9de76 (patch) | |
tree | 46c0f9208cf727a8fbe3f6592398fedc4bd2753d /update-me.in | |
parent | 79d809ad637f3cbecf221447f67ba03f57ddc9ff (diff) | |
download | update-all-674904f5aa4178dd6c19d9e1964c9a22f7a9de76.tar.xz |
update-me neu
Diffstat (limited to 'update-me.in')
-rw-r--r-- | update-me.in | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/update-me.in b/update-me.in new file mode 100644 index 0000000..37a21cc --- /dev/null +++ b/update-me.in @@ -0,0 +1,76 @@ +#!/bin/bash + +preCmds=('hostname') +cmds=() +postCmds=('sync') + +. #ETCDIR#/update-me.conf + +if [ ! "$(whoami)" == "root" ] +then + if ! "${hasSudo}" + then + su -c "$(readlink -f "$0")" + exit $? + fi + pre='sudo' +else + pre='' +fi + +if [ ${#cmds[@]} -eq 0 ] +then + if [ -d '#ETCDIR#/pacman.d' ] + then + cmds=('pacman -Syu' 'pacdiff') + elif [ -d '#ETCDIR#/ports' ] + then + cmds=('ports -u' 'prt-get sysup' 'rejmerge' 'revdep') + elif [ -d '#ETCDIR#/apt' ] + then + cmds=('aptitude update' 'aptitude safe-upgrade' 'aptitude dist-upgrade') + else + >&2 echo 'Unknown distribution!' + exit 1 + fi +fi + +for cmd in "${preCmds[@]}" +do + ${cmd} + err=$? + if [ ${err} -ne 0 ] + then + >&2 echo 'Fehler' + read s + exit ${err} + fi +done + +for cmd in "${cmds[@]}" +do + ${pre} ${cmd} + err=$? + if [ ${err} -ne 0 ] + then + >&2 echo 'Fehler' + read s + exit ${err} + fi +done + +for cmd in "${postCmds[@]}" +do + ${cmd} + err=$? + if [ ${err} -ne 0 ] + then + >&2 echo 'Fehler' + read s + exit ${err} + fi +done + +>&2 echo 'Erfolg' +read s +exit 0 |