← Back to team overview

torios-dev team mailing list archive

ToriOS updater script

 

Hi everyone,

I have been looking into polkit authentication rules to see if I can
make a script that runs apt-get update and asks the user to upgrade
without need.  I think a very least we can simply update using a rule to
allow updating the cache and to show new updates.

To show updates (at least in 14.10)
you can simply run
sudo apt-get update

apt list --upgradable

So if our rule allows updating the cache, then we can have the user
install updates by entering their password.  OR we can make our rule to
have silent updates.

in other words we could create a group for updates, and ask the user if
they want to have silent updates (no interaction), or if they want to
confirm updates before installing them.

we can add the updater to our startup, and run it when they log into
ToriOS.  The thing could then sleep and check every so often.

Here is my basic skeleton idea:

#!/bin/bash
IFS=$'\n'
UPGRADES=($(apt list --upgradable))
increment=0
for i in "${UPGRADES[@]}"
do
  if [ "${i}" != "Listing..." ]
  then
    increment=$((increment+1))
    NEW[increment]="${i//\/*\]/}"
  fi
done
gxmessage "Do you want to Update:

${NEW[*]}"

Let me know your thoughts....  I also need to see if 12.04 supports this :)

-- 
Regards

-Israel
ToriOS Team