Fix: read question (arch)

This commit is contained in:
Cyrille L 2022-08-10 12:12:04 +02:00
parent c4f97b0f6c
commit df4fe68228
6 changed files with 74 additions and 58 deletions

View File

@ -15,6 +15,7 @@ upd_file_check_aur="$upd_dir_home/check_aur"
# Script # Script
upd_script_check="/var/lib/upd/scripts/check" upd_script_check="/var/lib/upd/scripts/check"
upd_script_clean="/var/lib/upd/scripts/clean"
upd_script_help="/var/lib/upd/scripts/help" upd_script_help="/var/lib/upd/scripts/help"
upd_script_tools="/var/lib/upd/scripts/tools" upd_script_tools="/var/lib/upd/scripts/tools"
upd_script_updater="/var/lib/upd/scripts/updater" upd_script_updater="/var/lib/upd/scripts/updater"

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# version: 0.1.4 # version: 0.1.5
# file: upd # file: upd
# Folder: /usr/local/bin # Folder: /usr/local/bin
# By echolib # By echolib
@ -83,6 +83,7 @@ if__file "/etc/upd/upd.conf" source
if__file "$upd_script_tools" source if__file "$upd_script_tools" source
if__file "$upd_script_updater" source if__file "$upd_script_updater" source
if__file "$upd_script_check" source if__file "$upd_script_check" source
if__file "$upd_script_clean" source
if__file "$upd_script_upgrader" source if__file "$upd_script_upgrader" source
if__file "$upd_script_help" source if__file "$upd_script_help" source

View File

@ -17,20 +17,6 @@ esac
} }
#======================================================================
# Cleaning System
#======================================================================
clean__OPTIONS() {
upd__sudoroot
clear
echo "# Cleaning System..."
case "$arch" in
pacman) upd__clean_arch ;;
apt) upd__clean_deb ;;
esac
}
#====================================================================== #======================================================================
# Check for updates from ArchLinux # Check for updates from ArchLinux
#====================================================================== #======================================================================
@ -81,15 +67,17 @@ upd__prepare_show
upd__check_reboot() { upd__check_reboot() {
upd__reboot_set() { upd__reboot_set() {
upd_reboot="$Pp_Grey ${C_Red}Reboot$NC required" upd_reboot="$Pp_Grey ${C_Red}Reboot$NC required ; $upd_uname > $upd_vmlin"
upd_inf="$I_Red" upd_inf="$I_Red"
} }
# if erboot # if erboot
case "$arch" in case "$arch" in
pacman) pacman)
[[ `uname -r` == `file /boot/vmlinuz-linux | awk '{print $9}'` ]] \ upd_uname=`uname -r`
|| upd__reboot_set upd_vmlin=`file /boot/vmlinuz-linux | awk '{print $9}'`
[[ "$upd_uname" != "$upd_vmlin" ]] \
&& upd__reboot_set
;; ;;
apt) apt)
@ -99,10 +87,14 @@ case "$arch" in
esac esac
# Reboot message only: if called from option -cr # Reboot message only: if called from option -cr
if [[ $upd_cr ]] && [[ $upd_reboot ]];then [[ $upd_cr ]] || exit
echo -e "$upd_reboot" ! [[ $upd_reboot ]] \
exit 137 && echo "# No need to reboot" \
fi && exit
echo -e "$upd_reboot"
exit 137
} }

52
var/lib/upd/scripts/clean Normal file
View File

@ -0,0 +1,52 @@
#!/bin/bash
# file: clean
# Folder: /var/lib/upd/scripts
# By echolib
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# Cleaning System
#======================================================================
clean__OPTIONS() {
upd__sudoroot
clear
echo "# Cleaning System..."
case "$arch" in
pacman) upd__clean_arch ;;
apt) upd__clean_deb ;;
esac
}
#======================================================================
# Cleaing commons
#======================================================================
upd__clean_commons() {
sudo journalctl --vacuum-time=3d
echo
[[ -d "~/.cache/" ]] \
&& sudo du -sh ~/.cache/ \
&& rm -rf ~/.cache/* \
&& echo
}
#======================================================================
# Cleaing arch
#======================================================================
upd__clean_arch() {
upd__clean_commons
sudo pacman -Sc
sudo pacman -Rns $(pacman -Qtdq)
}
#======================================================================
# Cleaing deb
#======================================================================
upd__clean_deb() {
upd__clean_commons
sudo apt autoremovee
}

View File

@ -52,8 +52,10 @@ tar -xzf "${app_name}-main.tar.gz"
cd "${app_name}-main" cd "${app_name}-main"
cp -f "usr/local/bin/$app_name" "/usr/local/bin/$app_name" cp -f "usr/local/bin/$app_name" "/usr/local/bin/$app_name"
rsync -a --delete "var/lib/$app_name/" "/var/lib/$app_name/" rsync -a --delete --exclude ".*" \
rsync -a --delete "etc/$app_name/" "/etc/$app_name/" "var/lib/$app_name/" "/var/lib/$app_name/"
rsync -a --delete --exclude ".*" \
"etc/$app_name/" "/etc/$app_name/"
rm -rf "/tmp/${app_name}-main" rm -rf "/tmp/${app_name}-main"
rm -f "/tmp/${app_name}-main.tar.gz" rm -f "/tmp/${app_name}-main.tar.gz"

View File

@ -107,7 +107,7 @@ if (( $upg_rep != 0 ));then
"- Try to repair, first (R)" \ "- Try to repair, first (R)" \
"- Try to manually update (U)" "- Try to manually update (U)"
read ": What to do (R|U|*) ? " upg_try read -rp ": What to do (R|U|*) ? " upg_try
case "$upg_try" in case "$upg_try" in
R) upd --arch-repair;exit ;; R) upd --arch-repair;exit ;;
@ -188,35 +188,3 @@ sudo pacman -Scc
sysup="system" sysup="system"
upg__main upg__main
} }
#======================================================================
# Cleaing commons
#======================================================================
upd__clean_commons() {
sudo journalctl --vacuum-time=3d
echo
[[ -d "~/.cache/" ]] \
&& sudo du -sh ~/.cache/ \
&& rm -rf ~/.cache/* \
&& echo
}
#======================================================================
# Cleaing arch
#======================================================================
upd__clean_arch() {
upd__clean_commons
sudo pacman -Sc
sudo pacman -Rns $(pacman -Qtdq)
}
#======================================================================
# Cleaing deb
#======================================================================
upd__clean_deb() {
upd__clean_commons
sudo apt autoremovee
}