glacier-old/scripts/glacier-cache-install.sh

34 lines
1.1 KiB
Bash
Raw Normal View History

2022-04-12 12:38:01 -04:00
#!/bin/sh
# glacier-cache-install
# Script used to install cached packages
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "[ X ] Please run Glacier as root."
exit
fi
2022-04-20 15:39:04 -04:00
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Checking cache for $input.tar.gz... "
2022-04-12 12:38:01 -04:00
cd /var/cache/glacier && cp $input.tar.gz /tmp && cd /tmp
if [ "$?" != "0" ]; then
2022-04-20 15:39:04 -04:00
printf "\033[1;31m [ $error ] \033[m Could not fetch package from cache. " 1>&2
2022-04-12 12:38:01 -04:00
exit 1
fi
2022-04-20 15:39:04 -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:39:04 -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 INSTALL.sh
chmod +x $input.ts.sh
./INSTALL.sh # Actually executes installation script
./$input.ts.sh
2022-04-20 15:39:04 -04:00
printf "\033[1;34m [ i ] \033[m Cleaning up... " # Status message
2022-04-12 12:38:01 -04:00
mv -v $input-pkginfo.json /etc/glacier/pkginfo
cd ..
rm -rvf $input
2022-04-20 15:39:04 -04:00
printf "\033[1;32m [ $check ] \033[m Operation completed."