Create glacier-cache-install.sh
This commit is contained in:
parent
85c3169139
commit
0d6b9fcbc0
31
glacier-cache-install.sh
Normal file
31
glacier-cache-install.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/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"
|
||||
cd /var/cache/glacier && mv $input.tar.gz /tmp && cd /tmp
|
||||
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
|
||||
./INSTALL.sh # Actually executes installation script
|
||||
echo "[ i ] Cleaning up..." # Status message
|
||||
mv -v $input-pkginfo.json /etc/glacier/pkginfo
|
||||
cd ..
|
||||
rm -rvf $input
|
||||
echo "[ i ] Operation completed."
|
Loading…
Reference in New Issue
Block a user