forked from cyclingzealot/bin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade.bash
executable file
·33 lines (23 loc) · 883 Bytes
/
upgrade.bash
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
#!/bin/bash
# Upgrade per-language package manager
sudo /usr/local/bin/composer self-update
sudo npm install -g npm
# Now upgrade system
sudo apt-get update
sudo apt-get upgrade --just-print | grep Inst | cut -f 2 -d ' ' | sort > /tmp/upgradePackageList.txt
numPacks=`wc -l /tmp/upgradePackageList.txt | cut -f 1 -d ' '`
continueFlag=/tmp/continueUpgrade
i="0"
touch $continueFlag
for pack in `cat /tmp/upgradePackageList.txt` ; do
i=`echo "$i + 1" | bc`
pct=`echo "$i * 100 / $numPacks" | bc`
echo "$pack ($i of $numPacks - $pct %)"
echo ===== To stop =======\> rm $continueFlag
if [ -a $continueFlag ] ; then sudo apt-get install $pack --only-upgrade --yes -d; fi
if [ -a $continueFlag ] ; then sudo apt-get install $pack --only-upgrade --yes ; fi
echo; echo; echo
done
if [ -a $continueFlag ] ; then sudo apt-get autoremove ; fi
echo
rm -v $continueFlag;