Update glacier-update.sh

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

View File

@ -2,42 +2,34 @@
# glacier-update # glacier-update
# Script used to update packages # Script used to update packages
# Script messes shit up if you don't run as root so thats why this is here # Require Glacier to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "[ X ] Please run Glacier as root." printf "\033[1;31m [ $error ] \033[m Please run Glacier as root."
exit exit
fi fi
echo "[ ? ] Enter package name:" && read input printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
echo "[ i ] Installing $input.tar.gz" printf "\033[1;34m [ i ] \033[m Installing $input.tar.gz... "
echo "Checking world..." && wget https://github.com/everest-linux/glacier-pkgs/raw/main/world/$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 ] Unpacking $input.tar.gz..." 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
rm /var/log/glacier/$input.timestamp rm /var/log/glacier/$input.timestamp
echo "[ i ] Unpacking $input,tar.gz..."
mkdir -v $input && mv -v $input.tar.gz $input && cd $input
tar -xvf $input.tar.gz
if [ "$?" != "0" ]; then
echo "[ X ] Could not unpack $input.tar.gz" 1>&2
exit 1
fi
chmod +x UPDATE.sh chmod +x UPDATE.sh
chmod +x $input.ts.sh chmod +x $input.ts.sh
./UPDATE.sh ./UPDATE.sh
./$input.ts.sh ./$input.ts.sh
echo "[ i ] Cleaning up..." printf "\033[1;34m [ i ] \033[m Cleaning up... "
mv -v $input-pkginfo.json /etc/glacier/pkginfo mv -v $input-pkginfo.json /etc/glacier/pkginfo
mv $input.timestamp /var/log/glacier mv $input.timestamp /var/log/glacier
cd .. cd ..
rm -rvf $input rm -rvf $input
echo "[ i ] Operation completed." printf "\033[1;32m [ $check ] \033[m Operation completed."