Commit 16719858 authored by Ilja's avatar Ilja
Browse files

Add EXCLUDE_IF_RUNNING setting

* If a package from this space separated list is running, it won't be updated
* firefox is added as default
parent 875a2d68
......@@ -20,3 +20,7 @@ Concrete:
3. Right-click `update-system.sh` > Properties > Permissions > Set "Is executable" > OK
4. Optionally you can drag the file `simple-kubuntu-upgrade-script` to the desktop and make it a link there. (You can also move or copy, but than you'll need to do this for every upgrade)
5. To run, simply double-click `update-system.sh`
## Settings
If you open the file, you'll see General SETTINGS at the top of the file. One important setting is EXCLUDE_IF_RUNNING. This is a space separated list of packages that shouldn't be upgraded if they are running. By default firefox is listed because firefox always requires a restart after upgrading and that's annoying. If Firefox isn't running when the script runs, it will be updated.
......@@ -3,7 +3,7 @@
# This script updates the system and sends a notification when updates start and stops.
# Note that notifications wont work when using cron, only if the script is started in the desktop itself.
# Each message is also kept in a logfile. You can check those also when using cron
# To use cron, make a link from this script to `/etc/cron.daily`
# To use cron, you can make a link to this script from `/etc/cron.hourly` or something
################################################################
# General SETTINGS
......@@ -13,7 +13,7 @@ MY_PASSWORD_DIALOG_FOLDER="$HOME/.local/bin"
MY_PASSWORD_DIALOG_FILE="my-password-dialog"
LOGFILE_DIR="$HOME/.update-system/log"
LOGFILE_NAME="update-system.log"
EXCLUDE_IF_RUNNING="firefox"
################################################################
# FUNCTIONS
......@@ -81,8 +81,21 @@ then
log_info "There are no updates. Awesome! Your system is up to date!"
else
log_info "There are $number_of_upgrades updates. Starting update..."
RUNNING=""
for prog in $EXCLUDE_IF_RUNNING
do
! [ -z $(pgrep $prog) ] && RUNNING="$prog $RUNNING"
done
HOLDING=$(apt-mark showhold | tr '\n' ' ')
! [ -z "$RUNNING" ] && sudo -A apt-mark hold $RUNNING && log_info "Won't be upgraded becasue they are active: $RUNNING"
sudo -A apt-get upgrade -y
sudo -A apt autoremove -y
! [ -z "$RUNNING" ] && sudo -A apt-mark unhold $RUNNING
! [ -z "$HOLDING" ] && sudo -A apt-mark hold $HOLDING
log_info "Updating finished!"
fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment