Update glacier-remove.sh

This commit is contained in:
everest 2022-04-20 19:22:39 +00:00 committed by GitHub
parent b70d0070d0
commit 4f92bbebcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,31 +2,44 @@
# glacier-remove # glacier-remove
# Script used to uninstall packages # Script used to uninstall packages
# Require the script to be run as root # Define colors
if [[ $(/usr/bin/id -u) -ne 0 ]]; then export red="\033[1;31m"
echo "[ X ] Please run Glacier as root." export green="\033[1;32m"
exit export yellow="\033[1;33m"
fi export blue="\033[1;34m"
export reset="\033[m"
echo "[ ? ] Enter package name:" && read input # Define unicode symbols
echo "[ i ] Installing $input.tar.gz" export check="\xE2\x9C\x93"
echo "Checking world..." && wget https://github.com/everest-linux/glacier-pkgs/raw/main/world/$input.tar.gz export error="\xE2\x9C\x95"
export warning="\x21"
export question="\x3F"
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root."
exit
fi
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Removing $input.tar.gz... "
printf "Checking world... " && wget https://github.com/everest-linux/glacier-pkgs/raw/main/world/$input.tar.gz
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
echo "[ i ] Not in world." 1>&2 printf "\033[1;31m [ $error ] \033[m Package not found. " 1>&2
exit 1 exit 1
fi fi
echo "[ i ] Fetching removal instructions..." printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz... "
mkdir -v $input && mv -v $input.tar.gz $input && cd $input mkdir $input && mv $input.tar.gz $input && cd $input
tar -xvf $input.tar.gz tar -xf $input.tar.gz
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
echo "[ X ] Could not unpack $input.tar.gz" 1>&2 printf "\033[1;31m [ $error ] \033[m Could not unpack $input.tar.gz. " 1>&2
exit 1 exit 1
fi fi
chmod +x REMOVE.sh chmod +x REMOVE.sh
./REMOVE.sh ./REMOVE.sh
rm /var/log/glacier/$input.timestamp rm /var/log/glacier/$input.timestamp
echo "[ i ] Cleaning up..." printf "\033[1;34m [ i ] \033[m Cleaning up... " # Status message
cd .. cd ..
rm -rvf $input rm -rf $input
rm /etc/glacier/pkginfo/$input-pkginfo.json rm /etc/glacier/pkginfo/$input-pkginfo.json
echo "[ i ] Operation completed." printf "\033[1;32m [ $check ] \033[m Operation completed."