Commit ba65f935 authored by Ilja's avatar Ilja
Browse files

small changes

parent 16719858
......@@ -4,12 +4,13 @@ This is a small script I wrote to upgrade Kubuntu.
You can doubleclick it, it will show a pop-up that it's checking for updates and will ask for your sudo password.
If no updates are found you'll get a notification that the system is up-to-date.
If there are updates, it will show a pop-up to ask for your password and then upgrade and autoremove.
If there are updates, it will upgrade and autoremove.
The pop-up is what is used by the system by default, if no default is set, the script will create a utility in `$HOME/.local/bin` called `my-password-dialog`.
You can also use it with cron in which case you'll need to let it run by root. At this time using cron will NOT show pop-ups (but I would like it to be able to, so if you can make it happen, plz let me know how you do it).
Note that if you use `/etc/cron.hourly`, the filename can't contain a dot. See <https://askubuntu.com/questions/8426/cron-hourly-wont-run/39732#39732>
## How to use (manually)
## How to use
first clone the project, make `my-password-dialog` executable. Optionally you can make a link to the desktop so you can run it from there from time to time.
......@@ -18,9 +19,16 @@ Concrete:
1. Open a terminal in the folder you want to keep this project (or open a terminal and navigate to the correct location) and run `git clone https://git.domainepublic.net/ilja/simple-kubuntu-upgrade-script/`
2. Open the folder `simple-kubuntu-upgrade-script`
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`
### Manualy
1. 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)
2. To run, simply double-click `update-system.sh`
### Cron
1. Make a link from any of the `/etc/cron.*` directories and check if it can run. E.g. if you add it to `/etc/cron.hourly`, you use `run-parts --test /etc/cron.hourly`. The output will show all script that will run hourly. See <https://askubuntu.com/questions/8426/cron-hourly-wont-run/39732#39732>
## 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.
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.
......@@ -2,8 +2,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, you can make a link to this script from `/etc/cron.hourly` or something
# Each message is also kept in a logfile.
################################################################
# General SETTINGS
......@@ -24,7 +23,6 @@ function log_info() {
notify-send "$message"
}
################################################################
# ACTUAL SCRIPT
################################################################
......@@ -60,21 +58,10 @@ fi
##
# Check how many updates there are
# ... I don't have to do anything because it already happens for us
# I case I ever need it; set cronjob to automatically update the system
# The following should work, but is untested
#if [ ! -e /etc/cron.daily/apt-update.sh ]
#then
# sudo -A touch /etc/cron.daily/apt-update.sh
# sudo -A echo "apt-get update" > /etc/cron.daily/apt-update.sh
# chmod 100 /etc/cron.daily/apt-update.sh
#fi
##
##
# If zero updates => don't upgrade
# Otherwise => do upgrade
# * If zero updates => don't upgrade
# * Otherwise => do upgrade
##
sudo -A apt-get update
number_of_upgrades=$(LC_ALL=C apt-get upgrade -s | grep -E "[0-9]+ upgraded, .*" | sed -E "s/ .*//g")
if [ $number_of_upgrades -eq 0 ];
then
......
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