minor changes
This commit is contained in:
parent
6109d274f9
commit
9af038cade
@ -12,10 +12,11 @@ if [[ $(id -u) -ne 0 ]]; then printf "\nMust be root or use sudo!\n\n"; exit; fi
|
||||
# Are we in the right directory
|
||||
#
|
||||
scriptdir="unattended-updates" && whereami=$(pwd |awk -F'/' '{print $NF}')
|
||||
if [ $whereami != $scriptdir ]; then printf "\nWrong directory! Script must be run from $scriptdir\n\n"; exit 1; fi
|
||||
if [ "$whereami" != "$scriptdir" ]; then printf "\nWrong directory! Script must be run from %s\n\n" "$scriptdir"; exit 1; fi
|
||||
#
|
||||
# Define variables and functions
|
||||
#
|
||||
line () { printf -- '-%.0s' {1..50}; printf '\n'; }
|
||||
config1="/etc/apt/apt.conf.d/20auto-upgrades"
|
||||
config1alt="/usr/share/unattended-upgrades/20auto-upgrades"
|
||||
config2="/etc/apt/apt.conf.d/50unattended-upgrades"
|
||||
@ -37,8 +38,8 @@ config="$config2" ; configalt="$config2alt" ; chkcfg $config $configalt
|
||||
#
|
||||
# Back up configuration files.
|
||||
#
|
||||
cp -Rp /etc/apt/apt.conf.d/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades.orig
|
||||
cp -Rp /etc/apt/apt.conf.d/50unattended-upgrades /etc/apt/apt.conf.d/50unattended-upgrades.orig
|
||||
cp -Rp /etc/apt/apt.conf.d/20auto-upgrades /root/20auto-upgrades.orig
|
||||
cp -Rp /etc/apt/apt.conf.d/50unattended-upgrades /root/50unattended-upgrades.orig
|
||||
#
|
||||
# Disable automatic updates. We want to be in control instead of letting the system do this randomly twice a day.
|
||||
#
|
||||
@ -77,5 +78,9 @@ echo "$cronjob01" > /etc/cron.d/updatesystem
|
||||
systemctl restart unattended-upgrades.service
|
||||
systemctl restart cron.service
|
||||
#
|
||||
# All done display output
|
||||
#
|
||||
clear ; printf "\n" ; line ; printf "All Done...\n" ; line ; printf "\n"
|
||||
#
|
||||
# End of script
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user