diff options
author | Erich Eckner <git@eckner.net> | 2016-07-12 09:33:51 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-07-12 09:33:51 +0200 |
commit | bbc3a00e90a33ca512b77c52c37c67131728bd26 (patch) | |
tree | af4df7b9d476cb7c7c849f7e4970a583445bacf4 | |
parent | e6f52673deab9685259eaf9d0465c0864b56d72b (diff) | |
download | update-all-bbc3a00e90a33ca512b77c52c37c67131728bd26.tar.xz |
sudo neu
-rw-r--r-- | update-all.conf | 3 | ||||
-rw-r--r-- | update-all.in | 22 |
2 files changed, 19 insertions, 6 deletions
diff --git a/update-all.conf b/update-all.conf index 4726023..32d2219 100644 --- a/update-all.conf +++ b/update-all.conf @@ -14,3 +14,6 @@ cruxSystems=( localhost fileserver ) + +hasSudo["localhost"]=true +hasSudo["nlopc43"]=true diff --git a/update-all.in b/update-all.in index ab8dcf9..fd1d72a 100644 --- a/update-all.in +++ b/update-all.in @@ -1,14 +1,17 @@ #!/bin/bash -declare -A updateCmd +# update-all version #VERSION# -updateCmd["arch"]="pacman -Syu && pacdiff" -updateCmd["crux"]="ports -u && prt-get sysup && rejmerge" -updateCmd["debian"]="aptitude update && aptitude safe-upgrade && aptitude dist-upgrade" +declare -A updateCmds +declare -A hasSudo + +updateCmds["arch"]="pacman -Syu;pacdiff" +updateCmds["crux"]="ports -u;prt-get sysup;rejmerge" +updateCmds["debian"]="aptitude update;aptitude safe-upgrade;aptitude dist-upgrade" . #ETCDIR#/update-all.conf -for systemTyp in "${!updateCmd[@]}" +for systemTyp in "${!updateCmds[@]}" do eval "system=(\${${systemTyp}Systems[@]})" for s in "${system[@]}" @@ -19,6 +22,13 @@ do else conCmd="ssh -t -t $s" fi - urxvt -e ${conCmd} "hostname; su -c \"${updateCmd["${systemTyp}"]}\"" & + uCmd="${updateCmds["${systemTyp}"]}" + if [ -n "${hasSudo["${s}"]}" ] + then + uCmd="sudo ${uCmd//;/ && sudo }" + else + uCmd="su -c \"${uCmd//;/ && }\"" + fi + urxvt -e ${conCmd} "hostname; ${uCmd}" & done done |