Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save scottstensland/14a0b212f8f151fb154c236f07ff71ee to your computer and use it in GitHub Desktop.

Select an option

Save scottstensland/14a0b212f8f151fb154c236f07ff71ee to your computer and use it in GitHub Desktop.

Revisions

  1. scottstensland created this gist Apr 23, 2024.
    59 changes: 59 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    # one liner to update installed packages on a Debian based linux box like my laptop
    #
    # on debian based linux put below one liner into your ~/.bashrc
    # to define an alias I use to update installed packages
    # then just type in doit to perfom updates

    alias doit='echo "sudo service packagekit restart"; sudo service packagekit restart; echo; kill $( ps -eafww|grep update-manager|grep -v grep | grep update-manager | tr -s " " |cut -d" " -f2 ) > /dev/null 2>&1; echo "sudo ucf --purge /boot/grub/menu.lst" ; sudo ucf --purge /boot/grub/menu.lst ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get update" ; DEBIAN_FRONTEND=noninteractive sudo apt-get update ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y " ; DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y " ; DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y ; echo; echo "sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq" ; sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq ; echo; echo " df -h" ; df -h ; echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq " ; DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq ; echo; echo "sudo apt-get autoclean -y" ; sudo apt-get autoclean -y ;echo; [ -f /var/run/reboot-required ] && echo && echo " [ -f /var/run/reboot-required ] ; sudo reboot now # if it reached this far machine wants a reboot " && echo # if it reached this far machine wants a reboot '

    # above alias is exploded below for ease of seeing each command
    # notice it echos back whether it determines if given machine wants a reboot after doing all updates

    # ............. top of commands same as above alias .............

    echo "sudo service packagekit restart";
    sudo service packagekit restart;
    echo;
    kill $( ps -eafww|grep update-manager|grep -v grep | grep update-manager | tr -s " " |cut -d" " -f2 ) > /dev/null 2>&1;

    echo "sudo ucf --purge /boot/grub/menu.lst";
    sudo ucf --purge /boot/grub/menu.lst;

    echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get update";

    DEBIAN_FRONTEND=noninteractive sudo apt-get update;

    echo;
    echo "DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y " ;
    DEBIAN_FRONTEND=noninteractive sudo apt-get --fix-broken install -y ;

    echo; echo "DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y " ;

    DEBIAN_FRONTEND=noninteractive sudo apt-get -f install -y ;

    echo;
    echo "sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq" ;

    sudo env DEBIAN_FRONTEND=noninteractive UCF_FORCE_CONFFNEW=YES apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq ;

    echo;
    echo " df -h" ;
    df -h ;
    echo;
    echo "DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq " ;
    DEBIAN_FRONTEND=noninteractive sudo apt-get autoremove -yq ;
    echo;
    echo "sudo apt-get autoclean -y" ;
    sudo apt-get autoclean -y ;
    echo;

    [ -f /var/run/reboot-required ] && \
    echo && \
    echo " [ -f /var/run/reboot-required ] ; sudo reboot now # if it reached this far machine wants a reboot " && \
    echo # if it reached this far machine wants a reboot

    # ............. bottom of commands .............