-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathupdate.sh
48 lines (40 loc) · 1010 Bytes
/
update.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
update () {
echo "------------------------------"
echo " Send to $1..."
echo "------------------------------"
sudo lxc-attach -n $1 -- apt update -qq
sudo lxc-attach -n $1 -- apt upgrade -q -y
sudo lxc-attach -n $1 -- apt autoremove
if [ $2 -eq 1 ]; then
sudo lxc-attach -n $1 -- /root/maj
fi
}
# Need "all" or container ID
if [ -z "$1" ]; then
echo "usage: <all>|<contid>"
exit 1
fi
# Upgrade all active containers
if [ "all" = "$1" ]; then
read -p "Full update (y/n)?" choice
case "$choice" in
y|Y ) full=1;;
* ) full=0;;
esac
for cx in `sudo lxc-ls --active --line`; do
update $cx $full
done
echo "------------------------------"
echo " Proxmox ..."
echo "------------------------------"
sudo apt update
sudo apt upgrade
exit
fi
# Should be a container
read -p "Full update (y/n)?" choice
case "$choice" in
y|Y ) update $1 1;;
* ) update $1 0;;
esac