- ##cb-self-update##
- #!/bin/bash
- SDIR="/home/$USER/bin/cb-lib-dir"
- touch /home/$USER/.boot_counter
- counter=$(cat /home/$USER/.boot_counter)
- # Number of boots before the system update
- boots=10
- if [ "$counter" = "$boots" ]
- then
- terminator --title="#! Automatic Update Script" --command="$SDIR/cb-lib-self-update"
- else
- counter=$((counter+1))
- echo "$counter" > /home/$USER/.boot_counter
- fi
- exit 0
- ##cb-lib-self-update##
- #!/bin/bash
- clear
- counter=$(cat /home/$USER/.boot_counter)
- echo "
- UPDATE INSTALLED PACKAGES
- -------------------------
- The system has been booted "$counter" times without being updated,
- would you like to update the installed packages now?
- If you choose to do this, this script will execute the command:
- sudo apt-get update && sudo apt-get dist-upgrade
- Hit any key to update your system, or \"x\" to exit..."
- read -n1 a
- a=`echo $a | tr '[A-Z]' '[a-z]'`
- if [ "$a" != "x" ]; then
- echo ""
- sudo apt-get update && sudo apt-get dist-upgrade && echo "0" > /home/$USER/.boot_counter
- echo ""
- read -p "Script terminated, hit [ENTER] key to exit."
- fi
- exit 0
Posted by VDP76 on Thu 12th Jul 20:25 (modification of post by view diff)
download | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.