2022-04-12 12:38:01 -04:00
|
|
|
#!/bin/sh
|
|
|
|
# glacier-update
|
|
|
|
# Script used to update packages
|
|
|
|
|
2022-05-02 12:41:19 -04:00
|
|
|
# Glacier preloading
|
|
|
|
|
|
|
|
source /etc/glacier.conf
|
|
|
|
|
2022-04-20 15:30:40 -04:00
|
|
|
# Require Glacier to be run as root
|
2022-04-12 12:38:01 -04:00
|
|
|
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
2022-04-20 15:30:40 -04:00
|
|
|
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root."
|
2022-04-12 12:38:01 -04:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2022-04-20 15:30:40 -04:00
|
|
|
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
|
|
|
|
printf "\033[1;34m [ i ] \033[m Installing $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:30:40 -04:00
|
|
|
printf "\033[1;31m [ $error ] \033[m Package not found. " 1>&2
|
2022-04-12 16:46:13 -04:00
|
|
|
exit 1
|
2022-04-12 12:38:01 -04:00
|
|
|
fi
|
2022-04-20 15:30:40 -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:30:40 -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
|
|
|
|
rm /var/log/glacier/$input.timestamp
|
|
|
|
chmod +x UPDATE.sh
|
|
|
|
chmod +x $input.ts.sh
|
|
|
|
./UPDATE.sh
|
|
|
|
./$input.ts.sh
|
2022-04-20 15:30:40 -04:00
|
|
|
printf "\033[1;34m [ i ] \033[m Cleaning up... "
|
2022-04-20 15:31:16 -04:00
|
|
|
mv $input-pkginfo.json /etc/glacier/pkginfo
|
2022-04-12 12:38:01 -04:00
|
|
|
mv $input.timestamp /var/log/glacier
|
|
|
|
cd ..
|
2022-04-20 15:31:16 -04:00
|
|
|
rm -rf $input
|
2022-04-20 15:30:40 -04:00
|
|
|
printf "\033[1;32m [ $check ] \033[m Operation completed."
|