Fix: read question (arch)
This commit is contained in:
parent
c4f97b0f6c
commit
df4fe68228
|
@ -15,6 +15,7 @@ upd_file_check_aur="$upd_dir_home/check_aur"
|
|||
|
||||
# Script
|
||||
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_tools="/var/lib/upd/scripts/tools"
|
||||
upd_script_updater="/var/lib/upd/scripts/updater"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# version: 0.1.4
|
||||
# version: 0.1.5
|
||||
# file: upd
|
||||
# Folder: /usr/local/bin
|
||||
# By echolib
|
||||
|
@ -83,6 +83,7 @@ if__file "/etc/upd/upd.conf" source
|
|||
if__file "$upd_script_tools" source
|
||||
if__file "$upd_script_updater" source
|
||||
if__file "$upd_script_check" source
|
||||
if__file "$upd_script_clean" source
|
||||
if__file "$upd_script_upgrader" source
|
||||
if__file "$upd_script_help" source
|
||||
|
||||
|
|
|
@ -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
|
||||
#======================================================================
|
||||
|
@ -81,15 +67,17 @@ upd__prepare_show
|
|||
upd__check_reboot() {
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
# if erboot
|
||||
case "$arch" in
|
||||
pacman)
|
||||
[[ `uname -r` == `file /boot/vmlinuz-linux | awk '{print $9}'` ]] \
|
||||
|| upd__reboot_set
|
||||
upd_uname=`uname -r`
|
||||
upd_vmlin=`file /boot/vmlinuz-linux | awk '{print $9}'`
|
||||
[[ "$upd_uname" != "$upd_vmlin" ]] \
|
||||
&& upd__reboot_set
|
||||
;;
|
||||
|
||||
apt)
|
||||
|
@ -99,10 +87,14 @@ case "$arch" in
|
|||
esac
|
||||
|
||||
# Reboot message only: if called from option -cr
|
||||
if [[ $upd_cr ]] && [[ $upd_reboot ]];then
|
||||
echo -e "$upd_reboot"
|
||||
exit 137
|
||||
fi
|
||||
[[ $upd_cr ]] || exit
|
||||
! [[ $upd_reboot ]] \
|
||||
&& echo "# No need to reboot" \
|
||||
&& exit
|
||||
|
||||
echo -e "$upd_reboot"
|
||||
exit 137
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
@ -52,8 +52,10 @@ tar -xzf "${app_name}-main.tar.gz"
|
|||
|
||||
cd "${app_name}-main"
|
||||
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 "etc/$app_name/" "/etc/$app_name/"
|
||||
rsync -a --delete --exclude ".*" \
|
||||
"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 -f "/tmp/${app_name}-main.tar.gz"
|
||||
|
|
|
@ -104,10 +104,10 @@ upg_rep=$?
|
|||
if (( $upg_rep != 0 ));then
|
||||
printf '\n%s\n%s\n%s\n\n' \
|
||||
"! An error has been detected" \
|
||||
"- Try to repair, first (R)" \
|
||||
"- Try to repair, first (R)" \
|
||||
"- 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
|
||||
R) upd --arch-repair;exit ;;
|
||||
|
@ -188,35 +188,3 @@ sudo pacman -Scc
|
|||
sysup="system"
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue