diff --git a/bin/update b/bin/update index e509058..1711abe 100755 --- a/bin/update +++ b/bin/update @@ -164,11 +164,11 @@ update-system() { if [ -z "$password" ]; then echo -e "\033[32;1m=== Starting system update, please enter your password ===\033[0m" - sudo true - else - echo $password | sudo -S true + read -s password fi + echo $password | sudo -Sp "" true + if [ $? -ne 0 ]; then echo "Could not get sudo..." return 1 @@ -180,29 +180,11 @@ update-system() { # Debian based systems command -v apt > /dev/null 2>&1 if [ $? -eq 0 ]; then - - if [ -z "$password" ]; then - sudo apt update -y - else - echo $password | sudo -S apt update -y - fi - + echo $password | sudo -Sp "" apt update -y if [ $? -eq 0 ]; then - - if [ -z "$password" ]; then - sudo apt upgrade -y - else - echo $password | sudo -S apt upgrade -y - fi - + echo $password | sudo -Sp "" apt upgrade -y if [ $? -eq 0 ]; then - - if [ -z "$password" ]; then - sudo apt autoremove -y - else - echo $password | sudo -S apt autoremove -y - fi - + echo $password sudo -Sp "" apt autoremove -y fi fi fi @@ -211,24 +193,14 @@ update-system() { command -v yay > /dev/null 2>&1 if [ $? -eq 0 ]; then - - if [ ! -z "$password" ]; then - echo $password | sudo -S true - fi - yay -Syu --noconfirm yay -Syua --noconfirm - else command -v pacman > /dev/null 2>&1 if [ $? -eq 0 ]; then - if [ -z "$password" ]; then - sudo pacman -Syu --noconfirm - else - echo $password | sudo -S pacman -Syu --noconfirm - fi + echo $password | sudo -Sp "" pacman -Syu --noconfirm fi fi @@ -236,11 +208,7 @@ update-system() { # Fedora based systems command -v dnf > /dev/null 2>&1 if [ $? -eq 0 ]; then - if [ -z "$password" ]; then - sudo dnf upgrade - else - echo $password | sudo -S dnf upgrade - fi + echo $password | sudo -Sp "" dnf upgrade fi local seconds=$((`date +%s` - $start))