Compare commits
6 Commits
61317b5483
...
fe5ad9f4af
Author | SHA1 | Date |
---|---|---|
Thomas Forgione | fe5ad9f4af | |
Thomas Forgione | f2c4618f5b | |
Thomas Forgione | b74fdc59fd | |
Thomas Forgione | 43f32ee7ff | |
Thomas Forgione | f8352b9f02 | |
Thomas Forgione | 75bd35b942 |
27
bin/update
27
bin/update
|
@ -162,8 +162,13 @@ update-system() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\033[32;1m=== Starting system update, please enter your password ===\033[0m"
|
if [ -z "$password" ]; then
|
||||||
sudo true
|
echo -e "\033[32;1m=== Starting system update, please enter your password ===\033[0m"
|
||||||
|
read -sep "Password: " password
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $password | sudo -Sp "" true > /dev/null 2>&1
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Could not get sudo..."
|
echo "Could not get sudo..."
|
||||||
return 1
|
return 1
|
||||||
|
@ -175,11 +180,11 @@ update-system() {
|
||||||
# Debian based systems
|
# Debian based systems
|
||||||
command -v apt > /dev/null 2>&1
|
command -v apt > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sudo apt update -y
|
echo $password | sudo -Sp "" apt update -y
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sudo apt upgrade -y
|
echo $password | sudo -Sp "" apt upgrade -y
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sudo apt autoremove -y
|
echo $password | sudo -Sp "" apt autoremove -y
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -191,17 +196,19 @@ update-system() {
|
||||||
yay -Syu --noconfirm
|
yay -Syu --noconfirm
|
||||||
yay -Syua --noconfirm
|
yay -Syua --noconfirm
|
||||||
else
|
else
|
||||||
|
|
||||||
command -v pacman > /dev/null 2>&1
|
command -v pacman > /dev/null 2>&1
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sudo pacman -Syu --noconfirm
|
echo $password | sudo -Sp "" pacman -Syu --noconfirm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fedora based systems
|
# Fedora based systems
|
||||||
command -v dnf > /dev/null 2>&1
|
command -v dnf > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
sudo dnf upgrade
|
echo $password | sudo -Sp "" dnf upgrade
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local seconds=$((`date +%s` - $start))
|
local seconds=$((`date +%s` - $start))
|
||||||
|
@ -463,6 +470,12 @@ partial-update() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
|
if [ "$1" == "--pass" ]; then
|
||||||
|
shift
|
||||||
|
password=$1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
_lock_or_error_message
|
_lock_or_error_message
|
||||||
local error_code=$?
|
local error_code=$?
|
||||||
|
|
Loading…
Reference in New Issue