CrunchBang Linux Pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

CrunchBang Linux Pastebin

Posted by VDP76 on Thu 12th Jul 20:25 (modification of post by view diff)
download | new post

  1. ##cb-self-update##
  2. #!/bin/bash
  3.  
  4. SDIR="/home/$USER/bin/cb-lib-dir"
  5. touch /home/$USER/.boot_counter
  6. counter=$(cat /home/$USER/.boot_counter)
  7. # Number of boots before the system update
  8. boots=10
  9.  
  10. if [ "$counter" = "$boots" ]
  11. then
  12.     terminator --title="#! Automatic Update Script" --command="$SDIR/cb-lib-self-update"
  13. else
  14.     counter=$((counter+1))
  15.     echo "$counter" > /home/$USER/.boot_counter
  16. fi
  17. exit 0
  18.  
  19.  
  20.  
  21.  ##cb-lib-self-update##
  22. #!/bin/bash
  23.  
  24. clear
  25. counter=$(cat /home/$USER/.boot_counter)
  26. echo "
  27.   UPDATE INSTALLED PACKAGES
  28.   -------------------------
  29.   The system has been booted "$counter" times without being updated,
  30.   would you like to update the installed packages now?
  31.   If you choose to do this, this script will execute the command:
  32.  
  33.       sudo apt-get update && sudo apt-get dist-upgrade
  34.  
  35.   Hit any key to update your system, or \"x\" to exit..."
  36.  
  37. read -n1 a
  38. a=`echo $a | tr '[A-Z]' '[a-z]'`
  39. if [ "$a" != "x" ]; then
  40.     echo ""
  41.     sudo apt-get update && sudo apt-get dist-upgrade && echo "0" > /home/$USER/.boot_counter
  42.     echo ""
  43.     read -p "Script terminated, hit [ENTER] key to exit."
  44. fi
  45. exit 0

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.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me