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