testing debian + new options for arch
This commit is contained in:
parent
eb0946cb87
commit
cf31246246
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# version: 0.0.16
|
||||
# version: 0.0.17
|
||||
# file: upd
|
||||
# Folder: /usr/local/bin
|
||||
# By echolib
|
||||
|
@ -93,10 +93,10 @@ case "$1" in
|
|||
echo -ne "# Checking for updates..."
|
||||
case "$arch" in
|
||||
pacman)
|
||||
upd__check_arch
|
||||
upd__check arch
|
||||
;;
|
||||
apt)
|
||||
upd__check_deb
|
||||
upd__check deb
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@ -115,18 +115,31 @@ case "$1" in
|
|||
script__versions
|
||||
;;
|
||||
|
||||
-vvv)
|
||||
verbose=true
|
||||
script__versions
|
||||
;;
|
||||
|
||||
-U)
|
||||
Updater
|
||||
;;
|
||||
|
||||
-u)
|
||||
if__file "$upd_script_upgrader" source
|
||||
case "$arch" in
|
||||
pacman)
|
||||
upd__check_arch
|
||||
upg__arch
|
||||
sysup="system"
|
||||
upg__main
|
||||
;;
|
||||
esac
|
||||
|
||||
-f)
|
||||
if__file "$upd_script_upgrader" source
|
||||
sysup="full"
|
||||
upg__main
|
||||
;;
|
||||
|
||||
-a)
|
||||
if__file "$upd_script_upgrader" source
|
||||
sysup="aur"
|
||||
upg__main
|
||||
;;
|
||||
|
||||
readme)
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
#======================================================================
|
||||
# Check for updates if archlinux
|
||||
#======================================================================
|
||||
upd__check() {
|
||||
case "$1" in
|
||||
arch) upd__check_arch ;;
|
||||
deb) upd__check_deb
|
||||
esac
|
||||
}
|
||||
|
||||
upd__check_arch() {
|
||||
checkupdates > "$upd_file_check"
|
||||
|
||||
|
@ -88,7 +95,7 @@ if [[ "$aur" == "yay" ]];then
|
|||
upd_nbr_aur=`cat "$upd_file_check_aur" | wc -l`
|
||||
(( $upd_nbr_aur > 0 )) \
|
||||
&& C_NBR_aur=${C_Yellow} \
|
||||
&& upd_show_aur="$Pp_Grey + AUR=$C_NBR_aur$upd_nbr_aur$NC " \
|
||||
&& upd_show_aur="$Pp_Grey + AUR: $C_NBR_aur$upd_nbr_aur$NC " \
|
||||
&& upd__show "$upd_file_check_aur"
|
||||
fi
|
||||
|
||||
|
@ -101,7 +108,7 @@ fi
|
|||
|
||||
# Resume
|
||||
printf '%b%b%b\n' \
|
||||
"$upd_inf Updates: - System=$C_NBR$upd_nbr$NC " \
|
||||
"$upd_inf Updates System: $C_NBR$upd_nbr$NC " \
|
||||
"$upd_show_aur" \
|
||||
"$upd_reboot"
|
||||
}
|
||||
|
|
|
@ -12,6 +12,17 @@ cat << EOHELP
|
|||
list | -l : List updates (Check if none)
|
||||
-v : Show Installed version
|
||||
-vv : Show if new version available
|
||||
-vvv : + online version
|
||||
-U : Check and Update upd
|
||||
|
||||
[arch]
|
||||
-u : update system only
|
||||
-f : update system + AUR
|
||||
-a : update AUR packages only
|
||||
|
||||
[deb]
|
||||
-u : upgrade
|
||||
-f : full-upgrade
|
||||
|
||||
EOHELP
|
||||
}
|
||||
|
|
|
@ -78,7 +78,11 @@ else
|
|||
isa_c="$I_Yellow"
|
||||
fi
|
||||
|
||||
is__admin_show
|
||||
case "$1" in
|
||||
show)
|
||||
is__admin_show
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
|
@ -88,7 +92,7 @@ upd__sudoroot() {
|
|||
if__command sudo
|
||||
|
||||
# Check if sudo rights
|
||||
isadmin
|
||||
isadmin "$1"
|
||||
case "$is_admin" in
|
||||
user)
|
||||
echo "! No admin rights"
|
||||
|
|
|
@ -21,7 +21,9 @@ fi
|
|||
|
||||
printf -v versions '%s\n%s' "$v_cur" "$v_onl"
|
||||
if [[ `sort -V <<< "$versions" | tail -1` == $v_cur ]];then
|
||||
echo "# $app_name is up to date (version: $v_cur)"
|
||||
[[ $verbose ]] \
|
||||
&& s_onl=" > online: $v_onl"
|
||||
echo "# $app_name is up to date (version: $v_cur$s_onl)"
|
||||
upd_err=true
|
||||
return 0
|
||||
else
|
||||
|
|
|
@ -5,38 +5,114 @@
|
|||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#======================================================================
|
||||
# script version checker
|
||||
# Upgrade system
|
||||
#======================================================================
|
||||
upg__arch() {
|
||||
|
||||
(( $upd_nbr == 0 )) && (( $upd_nbr_aur == 0 )) \
|
||||
&& echo "# No updates available" \
|
||||
upg__main() {
|
||||
case "$sysup" in
|
||||
system)
|
||||
case "$arch" in
|
||||
pacman)
|
||||
clear
|
||||
upd__check_arch
|
||||
(( $upd_nbr == 0 )) \
|
||||
&& exit 0
|
||||
|
||||
upg__arch_system
|
||||
;;
|
||||
apt)
|
||||
clear
|
||||
upd__check_deb
|
||||
(( $upd_nbr == 0 )) \
|
||||
&& exit 0
|
||||
|
||||
upg__deb_upgrade
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
full)
|
||||
case "$arch" in
|
||||
pacman)
|
||||
clear
|
||||
upd__check_arch
|
||||
(( $upd_nbr == 0 )) && (( $upd_nbr_aur == 0 )) \
|
||||
&& exit 0
|
||||
|
||||
upg__arch_system
|
||||
upg__arch_aur
|
||||
;;
|
||||
apt)
|
||||
clear
|
||||
upd__check_deb
|
||||
(( $upd_nbr == 0 )) \
|
||||
&& exit 0
|
||||
|
||||
upg__deb_full_upgrade
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
aur)
|
||||
[[ $arch == "apt" ]] \
|
||||
&& echo "# Invalid option for this system" \
|
||||
&& exit 0
|
||||
|
||||
upd__check_arch
|
||||
(( $upd_nbr_aur == 0 )) \
|
||||
&& exit 0
|
||||
|
||||
#clear
|
||||
upg__arch_aur
|
||||
;;
|
||||
|
||||
*)
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# Cleaning
|
||||
rm -f "$upd_file_check"
|
||||
rm -f "$upd_file_check_aur"
|
||||
}
|
||||
|
||||
upg__arch_system() {
|
||||
[[ -f /var/lib/pacman/db.lck ]] \
|
||||
&& printf '%b%b\n' \
|
||||
"$I_Red System is upgrading... " \
|
||||
"or pacman is locked (/var/lib/pacman/db.lck)" \
|
||||
&& echo -e "$I_Red System is locked: /var/lib/pacman/db.lck" \
|
||||
&& return
|
||||
|
||||
upd__sudoroot # Tools: Check if user is admin
|
||||
|
||||
echo "# Syncing..."
|
||||
sudo pacman -Sy &>/dev/null
|
||||
echo -ne "\r\033[2K"
|
||||
|
||||
upd_pkg_upg="--ignore=linux --ignore=linux-headers"
|
||||
if [[ `grep "^linux-" "$upd_file_check"` ]];then
|
||||
read -rp "! Upgrade Kernel (y|N)? " upd_arch_ask
|
||||
read -rp "$I_Red Upgrade Kernel (y|N)? " upd_arch_ask
|
||||
case "$upd_arch_ask" in
|
||||
Y|y) unset upd_pkg_upg ;;
|
||||
*) true ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo -e "${I_Yellow} Upgrading System...\n"
|
||||
sudo pacman -Su --needed $upd_pkg_upg
|
||||
echo -e "$I_Yellow Upgrading System...\n"
|
||||
sudo pacman -Su --noconfirm --needed "$upd_pkg_upg"
|
||||
}
|
||||
|
||||
if [[ "$aur" == "yay" ]] && (( $upd_nbr_aur > 0 ));then
|
||||
yay -Syu --save --sudoloop --nocleanmenu --nodiffmenu
|
||||
upg__arch_aur() {
|
||||
upd__sudoroot # Tools: Check if user is admin
|
||||
if [[ "$aur" == "yay" ]];then
|
||||
echo -e "$I_Yellow Upgrading AUR packages...\n"
|
||||
yay -Syu --save --sudoloop --nocleanmenu --nodiffmenu --noeditmenu
|
||||
else
|
||||
echo "$I_Red Not using yay ; abandon"
|
||||
fi
|
||||
}
|
||||
|
||||
upg__deb_upgrade() {
|
||||
sudo apt upgrade -y
|
||||
}
|
||||
|
||||
upg__deb_full_upgrade() {
|
||||
sudo apt full-upgrade -y
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue