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

24
install/install.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf " [ * ] Installation Script must be run as root.\n"
exit 0
fi
# Create directories
mkdir /etc/glacier
mkdir /etc/glacier/pkginfo
mkdir /var/log/glacier
mkdir /var/cache/glacier
# Install Scripts
cd ../src
chmod +x *
cp glacier /usr/bin
cp glacier.conf /etc
cp glacier_release /etc/glacier
cp gscripts /usr/bin
cp messages /etc/glacier
cp hooks /etc/glacier
printf "done\n"

View File

@ -1,9 +1,23 @@
#!/bin/sh #!/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 # Preloading
/usr/bin/gscripts preload /usr/bin/gscripts preload
source $input export input
# Main Script # Main Script
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@ -30,7 +44,7 @@
exit 0 exit 0
;; ;;
--version) --version)
printf "$blue Glacier v3.0$reset\n" printf "$blue Glacier v$GLACIER_RELEASE $reset\n"
exit 0 exit 0
;; ;;
install|-f) install|-f)
@ -41,6 +55,7 @@
fi fi
$GLACIER_WHICH_PKG && read input $GLACIER_WHICH_PKG && read input
export input
$GLACIER_STATUS_INSTALLING $GLACIER_STATUS_INSTALLING
/usr/bin/gscripts download /usr/bin/gscripts download
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
@ -53,6 +68,7 @@
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
exit 1 exit 1
fi fi
$GLACIER_STATUS_UNPACKING
tar -xvf $input.tar.gz tar -xvf $input.tar.gz
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
$GLACIER_ERROR_CANNOT_UNPACK $GLACIER_ERROR_CANNOT_UNPACK
@ -61,7 +77,220 @@
chmod +x INSTALL.sh chmod +x INSTALL.sh
chmod +x $input.ts.sh chmod +x $input.ts.sh
$GLACIER_STATUS_EXECUTING $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 /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 esac
done done
$GLACIER_ERROR_NO_SUCH_OPTION
exit 1

View File

@ -16,14 +16,14 @@
# Checksum locations # Checksum locations
export WORLD_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/world" export WORLD_SUM=https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/world
export GALAXY_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/galaxy" export GALAXY_SUM=https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/galaxy
export UNIEVRSE_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/universe" export UNIEVRSE_SUM=https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/universe
export MULTIVERSE_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/multiverse" export MULTIVERSE_SUM=https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/multiverse
export WORLD_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/world-testing" export WORLD_TESTING_SUM=https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/world-testing
export GALAXY_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/galaxy-testing" export GALAXY_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/galaxy-testing
export UNIVERSE_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/universe-testing" export UNIVERSE_TESTING_SUM=https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/universe-testing
export MULTIVERSE_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/multiverse-testing" export MULTIVERSE_TESTING_SUM=https://git.everestlinux.org/EverestLinux/glacier-pkgs/src/branch/main/multiverse-testing
# Define colors and unicode symbols to be used # Define colors and unicode symbols to be used
export red="\033[1;31m" export red="\033[1;31m"

3
src/glacier_release Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
export GLACIER_RELEASE=$(printf "3.0.0\n")

View File

@ -1,10 +1,21 @@
#!/bin/sh #!/bin/sh
# gscripts - Extra Glacier scripts # gscripts - Scripts for Glacier operations
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
help)
printf "gscripts - backend for many Glacier functionalities since v3\n"
printf "gscripts {help} show this message\n"
printf "gscripts {integrity-check} verify package integrity\n"
printf "gscripts {download} download a package\n"
printf "gscripts {post-install} run post installation cleanup hooks\n"
printf "\n"
printf "this program can be distributed under the terms of the GNU General\n"
printf "Public License version 3 or higher\n"
exit 0
;;
preload) preload)
source /etc/glacier/hooks.sh source /etc/glacier/hooks
printf "Hooks loaded from /etc/glacier/hooks.sh.\n" printf "Hooks loaded from /etc/glacier/hooks.sh.\n"
exit 0 exit 0
;; ;;
@ -30,7 +41,15 @@ while [[ $# -gt 0 ]]; do
cd .. cd ..
rm -rf $input rm -rf $input
;; ;;
-*|--*)
printf "gscripts - no valid option was passed, see 'help' for details\n"
exit 1
;;
*)
printf "gscripts - no valid option was passed, see 'help' for details\n"
exit 1
;;
esac esac
done done
printf "gscripts - no option was passed\n" printf "gscripts - no option was passed, see 'help' for details\n"

7
src/hooks Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# Glacier Preloading Hooks
source /etc/make.conf
source /etc/glacier.conf
source /etc/glacier/messages
source /etc/glacier/glacier_release