summaryrefslogtreecommitdiff
path: root/update-all.in
diff options
context:
space:
mode:
Diffstat (limited to 'update-all.in')
-rw-r--r--update-all.in22
1 files changed, 16 insertions, 6 deletions
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