minor update

This commit is contained in:
JaKooLit 2025-02-04 23:21:16 +09:00
parent 04c632ca9e
commit 292180195c

View File

@ -68,22 +68,24 @@ install_package() {
fi fi
} }
# Function for re-installing packages # Function for re-installing packages with a progress bar
re_install_package() { re_install_package() {
# Try to reinstall the package (
if sudo apt-get install --reinstall -y "$1" 2>&1 | tee -a "$LOG"; then stdbuf -oL sudo apt-get install --reinstall -y "$1" 2>&1
) >> "$LOG" 2>&1 &
PID=$!
show_progress $PID "$1"
if dpkg -l | grep -q -w "$1"; then if dpkg -l | grep -q -w "$1"; then
echo -e "\e[1A\e[K${OK} Package ${YELLOW}$1${RESET} has been successfully re-installed!" echo -e "\e[1A\e[K${OK} Package ${YELLOW}$1${RESET} has been successfully re-installed!"
else else
# Package was not found, installation failed # Package not found, reinstallation failed
echo -e "${ERROR} $1 failed to install. Please check the install.log. You may need to install it manually. Sorry, I have tried :(" echo -e "${ERROR} ${YELLOW}$1${RESET} failed to re-install. Please check the install.log. You may need to install it manually. Sorry, I have tried :("
fi
else
# Installation command failed
echo -e "${ERROR} Failed to reinstall $1. Please check the install.log. You may need to install it manually. Sorry, I have tried :("
fi fi
} }
# Function for uninstalling packages # Function for uninstalling packages
uninstall_package() { uninstall_package() {
if sudo dpkg -l | grep -q -w "^ii $1" ; then if sudo dpkg -l | grep -q -w "^ii $1" ; then