glacier-old/glacier-cache-install.sh

34 lines
937 B
Bash
Raw Normal View History

2022-03-28 17:09:56 -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
echo "[ ? ] Enter package name:" && read input
echo "[ i ] Checking cache for $input.tar.gz"
2022-03-29 07:48:00 -04:00
cd /var/cache/glacier && cp $input.tar.gz /tmp && cd /tmp
2022-03-28 17:09:56 -04:00
if [ "$?" != "0" ]; then
echo "[ X ] Could not fetch $input.tar.gz from cache." 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
chmod +x INSTALL.sh
2022-04-05 11:06:40 -04:00
chmod +x $input.ts.sh
2022-03-28 17:09:56 -04:00
./INSTALL.sh # Actually executes installation script
2022-04-05 11:06:40 -04:00
./$input.ts.sh
2022-03-28 17:09:56 -04:00
echo "[ i ] Cleaning up..." # Status message
mv -v $input-pkginfo.json /etc/glacier/pkginfo
cd ..
rm -rvf $input
echo "[ i ] Operation completed."