aboutsummaryrefslogtreecommitdiff
path: root/chroot-upgrade
blob: 44a2c57a0c523b4b617b203c2fd9417f3d39f2d0 (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
#!/bin/bash
#
# Chroot mass upgrader
#

BASE="/var/chroot/"

if [ "`whoami`" != 'root' ]; then
  sudo="sudo"
fi

for chroot in `ls $BASE`; do
  folder="$BASE/$chroot"
  if [ -f "$folder/etc/debian_version" ]; then
    echo "Upgrading $folder..."
    $sudo mount none -t proc $folder/proc
    $sudo mount -o bind /dev $folder/dev
    $sudo cp /etc/resolv.conf $folder/etc
    $sudo chroot $folder apt-get update
    $sudo chroot $folder apt-get dist-upgrade -y
    $sudo umount $folder/proc
    $sudo umount $folder/dev
  fi
done