Update glacier-cache.sh

This commit is contained in:
everest 2022-04-20 19:36:05 +00:00 committed by GitHub
parent d64f208f1a
commit b1ba7830a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,32 +2,18 @@
# glacier-cache
# Script used to download a package and cache it
# Require the script to be run as root
echo "[ ? ] Enter package name:" && read input
echo "[ i ] Installing $input.tar.gz"
echo "Checking world..." && wget https://github.com/everest-linux/glacier-pkgs/raw/main/world/$input.tar.gz
if [ "$?" != "0" ]; then
echo "[ i ] Not in world." 1>&2
exit 1
fi
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
# Require the script to be run as root\
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
fi
echo "[ ? ] Enter package name:" && read input
echo "[ i ] Caching $input.tar.gz"
wget https://github.com/everest-linux/glacier-pkgs/raw/main/pkgs/$input.tar.gz
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Caching $input.tar.gz... "
printf "Checking world... " && wget https://github.com/everest-linux/glacier-pkgs/raw/main/world/$input.tar.gz
if [ "$?" != "0" ]; then
echo "[ X ] Could not get archive for $input." 1>&2
printf "\033[1;31m [ $error ] \033[m Package not found. " 1>&2
exit 1
fi
mv $input.tar.gz /var/cache/glacier
echo "[ i ] Operation completed."
printf "\033[1;32m [ $check ] \033[m Operation completed."