glacier-old/scripts/glacier-remove.sh

46 lines
1.3 KiB
Bash
Raw Normal View History

2022-04-12 12:38:01 -04:00
#!/bin/sh
# glacier-remove
# Script used to uninstall packages
2022-04-20 15:22:39 -04:00
# Define colors
export red="\033[1;31m"
export green="\033[1;32m"
export yellow="\033[1;33m"
export blue="\033[1;34m"
export reset="\033[m"
# Define unicode symbols
export check="\xE2\x9C\x93"
export error="\xE2\x9C\x95"
export warning="\x21"
export question="\x3F"
2022-04-12 12:38:01 -04:00
# Require the script to be run as root
2022-04-20 15:22:39 -04:00
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root."
exit
fi
2022-04-12 12:38:01 -04:00
2022-04-20 15:22:39 -04:00
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
2022-04-12 12:38:01 -04:00
if [ "$?" != "0" ]; then
2022-04-20 15:22:39 -04:00
printf "\033[1;31m [ $error ] \033[m Package not found. " 1>&2
2022-04-12 12:38:01 -04:00
exit 1
fi
2022-04-20 15:22:39 -04:00
printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz... "
mkdir $input && mv $input.tar.gz $input && cd $input
tar -xf $input.tar.gz
2022-04-12 12:38:01 -04:00
if [ "$?" != "0" ]; then
2022-04-20 15:22:39 -04:00
printf "\033[1;31m [ $error ] \033[m Could not unpack $input.tar.gz. " 1>&2
2022-04-12 12:38:01 -04:00
exit 1
fi
chmod +x REMOVE.sh
./REMOVE.sh
rm /var/log/glacier/$input.timestamp
2022-04-20 15:22:39 -04:00
printf "\033[1;34m [ i ] \033[m Cleaning up... " # Status message
2022-04-12 12:38:01 -04:00
cd ..
2022-04-20 15:22:39 -04:00
rm -rf $input
2022-04-12 12:38:01 -04:00
rm /etc/glacier/pkginfo/$input-pkginfo.json
2022-04-20 15:22:39 -04:00
printf "\033[1;32m [ $check ] \033[m Operation completed."