-
Notifications
You must be signed in to change notification settings - Fork 0
/
magic-upgrade-root
33 lines (24 loc) · 907 Bytes
/
magic-upgrade-root
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
set -e
# Make sure we have root
[[ $UID = 0 ]] || { echo "Please have root powers when executing this script"; exit; }
# Printf to expand newlines
printf "\n Update apt package list \n"
# Grab all internet-dependent things first
nice -n 19 apt update
printf "\n Download packages needed for upgrade \n"
# Don't bother with DebDelta: the package cache will always be empty
# TODO: Use apt-cacher-ng 's precaching feature
nice -n 19 apt dist-upgrade -dy
printf "\n Download installLater packages \n"
nice -n 19 apt install -dy "$@"
printf "\n Install upgrades \n"
# Install downloaded updates
nice -n 19 apt upgrade
printf "\n Install installLater Packages \n"
nice -n 19 apt install "$@"
# Cleanup
apt clean # I use apt-cacher-ng, so no need for duplicates
# Okay, so printf is uneeded work, and I'm a lazy bum, Didn't
# realize that it wouldn't append a newline!
echo -e "\nAll done!"