#!/bin/bash #Fichier d'origine CrunchBang Linux modifié par libre fan # Print help #=============================================================================== if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "Usage:" echo " -i, --interactive run system update" echo " -n, --non-interactive run system update and only prompt" echo " for root password" echo " -f, --full run full system update including" echo " any Kernel upgrades" echo " -h, --help show this message and exit" echo "" exit fi # Run interactive update #=============================================================================== if [ "$1" = "-i" ] || [ "$1" = "--interactive" ]; then exec terminator --command="system-update --upgrade" fi if [ "$1" = "--upgrade" ]; then echo "You are about to perform a system upgrade." echo -n "Do you wish to continue? (Y|n) > " read a if [ "$a" = "y" ] || [ "$a" = "Y" ] || \ [ "$a" = "" ]; then sudo aptitude update sudo aptitude safe-upgrade echo "" echo "-- System update complete! Exiting..." sleep 4s exit fi fi # Run non-interactive update #=============================================================================== if [ "$1" = "-n" ] || [ "$1" = "--non-interactive" ]; then exec terminator --command="system-update --upgrade-now" exit fi if [ "$1" = "--upgrade-now" ]; then echo "Performing a system upgrade..." sudo aptitude update sudo aptitude -y safe-upgrade echo "" echo "-- System update complete! Exiting..." sleep 4s exit fi # Run full update including any Kernel updates #=============================================================================== if [ "$1" = "-f" ] || [ "$1" = "--full" ]; then exec terminator --command="system-update --full-upgrade" exit fi if [ "$1" = "--full-upgrade" ]; then echo "Attention, mise a jour du systeme." echo "Patience." echo -n "On y va ? (O|n) > " read a if [ "$a" = "o" ] || [ "$a" = "O" ] || \ [ "$a" = "" ]; then sudo aptitude update sudo aptitude full-upgrade echo "" echo "-- C'est fini!..." sleep 4s exit fi fi # Run interactive system update if no arguments supplied #=============================================================================== if [ "$1" = "" ];then exec terminator --command="system-update --full-upgrade" exit fi # Show help if arguement not recognised #=============================================================================== echo "Oops! Invalid command. Have a clue..." exec system-update -h exit