summaryrefslogtreecommitdiff
path: root/update-all.in
blob: c672d8a8e184a67325359030f6df8c74da7a6269 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

declare -A updateCmd

updateCmd["arch"]="pacman -Syu && pacdiff"
updateCmd["crux"]="ports -u && prt-get sysup && rejmerge"
updateCmd["debian"]="aptitude update && aptitude safe-upgrade && aptitude dist-upgrade"

. #ETCDIR#/update-all.conf

for systemTyp in "${!updateCmd[@]}"
do
  eval "system=(\${${systemTyp}Systems[@]})"
  for s in "${system[@]}"
  do
    if [ "$s" == "localhost" ]
    then
      conCmd="bash -c"
    else
      conCmd="ssh -t -t $s"
    fi
    echo "updating ${s} ..."
    ${conCmd} "su -c \"${updateCmd["${systemTyp}"]}\""
    echo "... ${s} updated"
  done
done