glacier3 - testing release

This commit is contained in:
lw-everestlinux
2022-09-13 14:01:05 -04:00
parent 4e754c2f22
commit a69cb12f2a
6 changed files with 298 additions and 16 deletions

View File

@@ -1,9 +1,23 @@
#!/bin/sh
# Glacier Package Manager - v3.0
# Glacier - A simple package management system written in POSIX sh
# Copyright (C) 2022 Everest Linux Development Group
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Preloading
/usr/bin/gscripts preload
source $input
export input
# Main Script
while [[ $# -gt 0 ]]; do
@@ -30,7 +44,7 @@
exit 0
;;
--version)
printf "$blue Glacier v3.0$reset\n"
printf "$blue Glacier v$GLACIER_RELEASE $reset\n"
exit 0
;;
install|-f)
@@ -41,6 +55,7 @@
fi
$GLACIER_WHICH_PKG && read input
export input
$GLACIER_STATUS_INSTALLING
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
@@ -53,6 +68,7 @@
if [ "$?" != "0" ]; then
exit 1
fi
$GLACIER_STATUS_UNPACKING
tar -xvf $input.tar.gz
if [ "$?" != "0" ]; then
$GLACIER_ERROR_CANNOT_UNPACK
@@ -61,7 +77,220 @@
chmod +x INSTALL.sh
chmod +x $input.ts.sh
$GLACIER_STATUS_EXECUTING
./install.sh
./INSTALL.sh
if [ "$?" != "0" ]; then
$GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
/usr/bin/gscripts post-install
$GLACIER_SUCCESS
exit 0
;;
update|-u)
# Require script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
$GLACIER_ERROR_NO_ROOT
exit 1
fi
$GLACIER_WHICH_PKG && read input
export input
$GLACIER_STATUS_UPDATING
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
$GLACIER_ERROR_DOES_NOT_EXIST
exit 1
fi
$GLACIER_STATUS_INTEGRITY_CHECK
mkdir $input && mv $input.tar.gz $input && cd $input
/usr/bin/gscripts integrity-check
if [ "$?" != "0" ]; then
exit 1
fi
$GLACIER_STATUS_UNPACKING
tar -xvf $input.tar.gz
if [ "$?" != "0" ]; then
$GLACIER_ERROR_CANNOT_UNPACK
exit 1
fi
chmod +x UPDATE.sh
chmod +x $input.ts.sh
$GLACIER_STATUS_EXECUTING
./UPDATE.sh
if [ "$?" != "0" ]; then
$GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
/usr/bin/gscripts post-install
$GLACIER_SUCCESS
exit 0
;;
remove|-x)
# Require script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
$GLACIER_ERROR_NO_ROOT
exit 1
fi
$GLACIER_WHICH_PKG && read input
$GLACIER_STATUS_REMOVING
export input
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
$GLACIER_ERROR_DOES_NOT_EXIST
exit 1
fi
$GLACIER_STATUS_INTEGRITY_CHECK
mkdir $input && mv $input.tar.gz $input && cd $input
/usr/bin/gscripts integrity-check
if [ "$?" != "0" ]; then
exit 1
fi
$GLACIER_STATUS_UNPACKING
tar -xvf $input.tar.gz
if [ "$?" != "0" ]; then
$GLACIER_ERROR_CANNOT_UNPACK
exit 1
fi
chmod +x REMOVE.sh
chmod +x $input.ts.sh
$GLACIER_STATUS_EXECUTING
./REMOVE.sh
if [ "$?" != "0" ]; then
$GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
/usr/bin/gscripts post-install
$GLACIER_SUCCESS
exit 0
;;
query|-q)
$GLACIER_WHICH_PKG && read input
cat /etc/glacier/pkginfo/$input-pkginfo.json
cat /var/log/glacier/$input.timestamp
if [ "$?" != "0" ]; then
$GLACIER_ERROR_NOT_INSTALLED
exit 1
fi
exit 0
;;
cache|-c)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
$GLACIER_ERROR_NO_ROOT
exit 1
fi
$GLACIER_WHICH_PKG && read input
$GLACIER_STATUS_CACHING
export input
/usr/bin/gscripts download
if [ "$?" != "0" ]; then
$GLACIER_ERROR_DOES_NOT_EXIST
exit 1
fi
$GLACIER_STATUS_INTEGRITY_CHECK
mv $input.tar.gz /var/cache/glacier && cd /var/cache/glacier
/usr/bin/gscripts integrity-check
if [ "$?" != "0" ]; then
exit 1
fi
$GLACIER_SUCCESS
exit 0
;;
cache-install|-ci)
if [[ $(usr/bin/id -u) -ne 0 ]]; then
$GLACIER_ERROR_NO_ROOT
exit 1
fi
$GLACIER_WHICH_PKG && read input
$GLACIER_STATUS_INSTALLING
export input
cd /var/cache/glacier && cp $input.tar.gz /tmp && cd /tmp
if [ "$?" != "0" ]; then
$GLACIER_ERROR_NOT_IN_CACHE
exit 1
fi
$GLACIER_STATUS_UNPACKING
mkdir $input && mv $input.tar.gz $input && cd $input
tar -xvf $input.tar.gz
if [ "$?" != "0" ]; then
$GLACIER_ERROR_CANNOT_UNPACK
exit 1
fi
$GLACIER_STATUS_EXECUTING
chmod +x INSTALL.sh
chmod +x $input.ts.sh
./INSTALL.sh
if [ "$!" != "0" ]; then
$GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE
exit 1
fi
./$input.ts.sh
/usr/bin/gscripts post-install
$GLACIER_SUCCESS
exit 0
;;
cache-clear|-cc)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
$GLACIER_ERROR_NO_ROOT
exit 1
fi
$GLACIER_STATUS_CLEARING
cd /var/cache/glacier && rm -rf *
$GLACIER_SUCCESS
exit 0
;;
--showDebugInfo)
printf "Glacier v$GLACIER_RELEASE"
printf ">> Checking for a viable download backend...\n"
whereis wget
whereis curl
whereis aria2c
printf ">> Checking which download backend is in use...\n"
echo $GLACIER_DOWNLOAD_BACKEND
printf ">> Checking if all Glacier directories and files are present...\n"
ls /etc | grep glacier
ls /etc/glacier
whereis make.conf
printf ">> If any files are missing, especially make.conf, Glacier will behave abnormally.\n"
printf ">> Checking if unicode symbols and colors display properly...\n"
printf "(NOTE): If you use a custom colorscheme, colors may vary.\n"
printf "$check\n"
printf "$error\n"
printf "$warning\n"
printf "$question\n"
printf "$red This is a test.$reset\n"
printf "$green This is a test.$reset\n"
printf "$yellow This is a test.$reset\n"
printf "$blue This is a test.$reset\n"
printf ">> Checking repositories...\n"
echo $GREPO1
echo $GREPO2
echo $GREPO3
echo $GREPO4
echo $GREPO5
echo $GREPO6
echo $GREPO7
echo $GREPO8
printf ">> Debug information has been gathered.\n"
printf ">> Run 'glacier --showDebugInfo > glacier.debug' to save this information to a file.\n"
exit 0
;;
-*|--*)
$GLACIER_ERROR_NO_SUCH_OPTION
exit 1
;;
*)
$GLACIER_ERROR_NO_SUCH_OPTION
exit 1
;;
esac
done
done
$GLACIER_ERROR_NO_SUCH_OPTION
exit 1