(FINALLY) add positional arguments

This commit is contained in:
lw-everestlinux 2022-10-10 21:59:36 -04:00
parent 27ec12f373
commit b97f0337de

View File

@ -19,7 +19,6 @@
/usr/bin/gscripts preload
source $(pwd)/messages # this is here for the sole purpose of testing
source /etc/glacier/messages
export input
# Main Script
while [[ $# -gt 0 ]]; do
@ -58,8 +57,6 @@
exit 1
fi
echo $GLACIER_WHICH_PKG && read input
export input
echo $GLACIER_STATUS_INSTALLING
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
@ -67,26 +64,26 @@
exit 1
fi
echo $GLACIER_STATUS_INTEGRITY_CHECK
mkdir $input && mv $input.tar.gz $input && cd $input
mkdir $2 && mv $2.tar.gz $2 && cd $2
/usr/bin/gscripts integrity-check
if [ "$?" != "0" ]; then
exit 1
fi
echo $GLACIER_STATUS_UNPACKING
tar -xvf $input.tar.gz
tar -xvf $2.tar.gz
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_CANNOT_UNPACK
exit 1
fi
chmod +x INSTALL.sh
chmod +x $input.ts.sh
chmod +x $2.ts.sh
echo $GLACIER_STATUS_EXECUTING
./INSTALL.sh
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
./$2.ts.sh
/usr/bin/gscripts post-install
echo $GLACIER_SUCCESS
exit 0
@ -98,8 +95,6 @@
exit 1
fi
echo $GLACIER_WHICH_PKG && read input
export input
echo $GLACIER_STATUS_UPDATING
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
@ -107,26 +102,26 @@
exit 1
fi
echo $GLACIER_STATUS_INTEGRITY_CHECK
mkdir $input && mv $input.tar.gz $input && cd $input
mkdir $2 && mv $2.tar.gz $2 && cd $2
/usr/bin/gscripts integrity-check
if [ "$?" != "0" ]; then
exit 1
fi
echo $GLACIER_STATUS_UNPACKING
tar -xvf $input.tar.gz
tar -xvf $2.tar.gz
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_CANNOT_UNPACK
exit 1
fi
chmod +x UPDATE.sh
chmod +x $input.ts.sh
chmod +x $2.ts.sh
echo $GLACIER_STATUS_EXECUTING
./UPDATE.sh
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
./$2.ts.sh
/usr/bin/gscripts post-install
echo $GLACIER_SUCCESS
exit 0
@ -138,43 +133,40 @@
exit 1
fi
echo $GLACIER_WHICH_PKG && read input
echo $GLACIER_STATUS_REMOVING
export input
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_DOES_NOT_EXIST
exit 1
fi
echo $GLACIER_STATUS_INTEGRITY_CHECK
mkdir $input && mv $input.tar.gz $input && cd $input
mkdir $2 && mv $2.tar.gz $2 && cd $2
/usr/bin/gscripts integrity-check
if [ "$?" != "0" ]; then
exit 1
fi
echo $GLACIER_STATUS_UNPACKING
tar -xvf $input.tar.gz
tar -xvf $2.tar.gz
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_CANNOT_UNPACK
exit 1
fi
chmod +x REMOVE.sh
chmod +x $input.ts.sh
chmod +x $2.ts.sh
echo $GLACIER_STATUS_EXECUTING
./REMOVE.sh
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
./$2.ts.sh
/usr/bin/gscripts post-install
echo $GLACIER_SUCCESS
exit 0
;;
query|-q)
echo $GLACIER_WHICH_PKG && read input
cat /etc/glacier/pkginfo/$input-pkginfo.json
cat /var/log/glacier/$input.timestamp
cat /etc/glacier/pkginfo/$2-pkginfo.json
cat /var/log/glacier/$2.timestamp
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_NOT_INSTALLED
exit 1
@ -187,16 +179,14 @@
exit 1
fi
echo $GLACIER_WHICH_PKG && read input
echo $GLACIER_STATUS_CACHING
export input
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_DOES_NOT_EXIST
exit 1
fi
echo $GLACIER_STATUS_INTEGRITY_CHECK
mv $input.tar.gz /var/cache/glacier && cd /var/cache/glacier
mv $2.tar.gz /var/cache/glacier && cd /var/cache/glacier
/usr/bin/gscripts integrity-check
if [ "$?" != "0" ]; then
exit 1
@ -210,30 +200,28 @@
exit 1
fi
echo $GLACIER_WHICH_PKG && read input
echo $GLACIER_STATUS_INSTALLING
export input
cd /var/cache/glacier && cp $input.tar.gz /tmp && cd /tmp
cd /var/cache/glacier && cp $2.tar.gz /tmp && cd /tmp
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_NOT_IN_CACHE
exit 1
fi
echo $GLACIER_STATUS_UNPACKING
mkdir $input && mv $input.tar.gz $input && cd $input
tar -xvf $input.tar.gz
mkdir $2 && mv $2.tar.gz $2 && cd $2
tar -xvf $2.tar.gz
if [ "$?" != "0" ]; then
echo $GLACIER_ERROR_CANNOT_UNPACK
exit 1
fi
echo $GLACIER_STATUS_EXECUTING
chmod +x INSTALL.sh
chmod +x $input.ts.sh
chmod +x $2.ts.sh
./INSTALL.sh
if [ "$!" != "0" ]; then
echo $GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
./$2.ts.sh
/usr/bin/gscripts post-install
echo $GLACIER_SUCCESS
exit 0