From 5adf51bb6bbb4a3b0fedc57f78dfa321bcf9c4b0 Mon Sep 17 00:00:00 2001 From: lw-everestlinux Date: Tue, 4 Oct 2022 14:11:27 -0400 Subject: [PATCH] 10/4/22 - iron out tons of bugs --- TODO | 6 ++++++ src/glacier | 49 +++++++++++++++++++++++++++++--------------- src/glacier.conf | 50 ++++++++++++++++++++++++++++++--------------- src/glacier_release | 2 +- src/gscripts | 25 ++++++++++++----------- src/hooks | 1 - src/make.conf | 26 +++++++++++++++++++++++ src/messages | 27 ++++++++++++------------ 8 files changed, 125 insertions(+), 61 deletions(-) create mode 100644 TODO create mode 100644 src/make.conf diff --git a/TODO b/TODO new file mode 100644 index 0000000..a1153b2 --- /dev/null +++ b/TODO @@ -0,0 +1,6 @@ +### TODO LIST ### + +#- fix messages not printing (ASAP) +- fix archives not downloading + /usr/bin/gscripts: line 37: /nano.tar.gz: No such file or directory +- Colors not printing diff --git a/src/glacier b/src/glacier index 6d7b72f..fd97d1a 100755 --- a/src/glacier +++ b/src/glacier @@ -17,8 +17,25 @@ # Preloading /usr/bin/gscripts preload + source /etc/glacier.conf export input + # Define messages + # Errors + GLACIER_ERROR_NO_ROOT=$(printf "$red [ $error ]$reset Please run Glacier as root.\n") + GLACIER_ERROR_DOES_NOT_EXIST=$(printf "$red [ $error ]$reset Package $input either does not exist, or is in a repository that is not enabled.\n") + GLACIER_ERROR_CANNOT_UNPACK=$(printf "$red [ $error ]$reset Package archive cannot be unpacked.\n") + GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE=$(printf "$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n") + GLACIER_ERROR_NO_SUCH_OPTION=$(printf "$red [ $error ]$reset Unknown option, see 'glacier -h' for usage.\n") + # Status + GLACIER_STATUS_INSTALLING=$(printf "$blue [ i ]$reset Installing $input...\n") + GLACIER_STATUS_UPDATING=$(printf "$blue [ i ]$reset Updating $input...\n") + GLACIER_STATUS_REMOVING=$(printf "$blue [ i ]$reset Removing $input...\n") + GLACIER_STATUS_CACHING=$(printf "$blue [ i ]$reset Caching $input...\n") + GLACIER_STATUS_UNPACKING=$(printf "$blue [ i ]$reset Unpacking $input.tar.gz...\n") + GLACIER_STATUS_INTEGRITY_CHECK=$(printf "$blue [ i ]$reset Verifying integrity of package...\n") + GLACIER_STATUS_EXECUTING=$(printf "$blue [ i ]$reset Executing instructions...\n") + GLACIER_WHICH_PKG=$(printf "$blue [ $question ]$reset Enter package name: ") # Main Script while [[ $# -gt 0 ]]; do case $1 in @@ -40,7 +57,7 @@ printf "$blue=== Licensing ======================================================================================$reset\n" printf "This program is freely distributable under the terms of the GNU General Public License version 3 or later.\n" printf "You should have recieved a copy of the GNU General Public License along with this program. If not, see .\n" - printf "======================================================================================================\n" + printf "$blue======================================================================================================\n" exit 0 ;; --version) @@ -50,41 +67,41 @@ install|-f) # Require script to be run as root if [[ $(/usr/bin/id -u) -ne 0 ]]; then - $GLACIER_ERROR_NO_ROOT + echo ${GLACIER_ERROR_NO_ROOT} exit 1 fi - $GLACIER_WHICH_PKG && read input + echo $GLACIER_WHICH_PKG && read input export input - $GLACIER_STATUS_INSTALLING + echo $GLACIER_STATUS_INSTALLING /usr/bin/gscripts download if [ "$?" != "0" ]; then - $GLACIER_ERROR_DOES_NOT_EXIST + echo $GLACIER_ERROR_DOES_NOT_EXIST exit 1 fi - $GLACIER_STATUS_INTEGRITY_CHECK + echo $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 + echo $GLACIER_STATUS_UNPACKING tar -xvf $input.tar.gz if [ "$?" != "0" ]; then - $GLACIER_ERROR_CANNOT_UNPACK + echo $GLACIER_ERROR_CANNOT_UNPACK exit 1 fi chmod +x INSTALL.sh chmod +x $input.ts.sh - $GLACIER_STATUS_EXECUTING + echo $GLACIER_STATUS_EXECUTING ./INSTALL.sh if [ "$?" != "0" ]; then - $GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE + echo $GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE exit 1 fi ./$input.ts.sh /usr/bin/gscripts post-install - $GLACIER_SUCCESS + echo $GLACIER_SUCCESS exit 0 ;; update|-u) @@ -264,10 +281,10 @@ 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 "$red Red.$reset\n" + printf "$green Green.$reset\n" + printf "$yellow Yellow.$reset\n" + printf "$blue Blue.$reset\n" printf ">> Checking repositories...\n" echo $GREPO1 echo $GREPO2 @@ -292,5 +309,3 @@ esac done -$GLACIER_ERROR_NO_SUCH_OPTION -exit 1 diff --git a/src/glacier.conf b/src/glacier.conf index 5508f51..2edae7f 100755 --- a/src/glacier.conf +++ b/src/glacier.conf @@ -5,25 +5,41 @@ # # Repositories Glacier will use - export GREPO1=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/world # System Software - export GREPO2=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/galaxy # GPL Only Software - export GREPO3=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/universe # All Open Source Software - #export GREPO4=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/multiverse # Proprietary Software - #export GREPO5=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/world-testing - #export GREPO6=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/galaxy-testing - #export GREPO7=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/universe-testing - #export GREPO8=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/multiverse-testing + +#[world] +export GREPO1="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/world" # System Software + +#[galaxy] +export GREPO2="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/galaxy" # GPL Only Software + +#[universe] +export GREPO3="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/universe" # All Open Source Software + +#[multiverse] +#export GREPO4=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/multiverse # Proprietary Software + +#[world-testing] +#export GREPO5=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/world-testing + +#[galaxy-testing] +#export GREPO6=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/galaxy-testing + +#[universe-testing] +#export GREPO7=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/universe-testing + +#[multiverse-testing] +#export GREPO8=https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/multiverse-testing # Checksum locations - 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 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 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 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 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 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 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 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" # Define colors and unicode symbols to be used export red="\033[1;31m" @@ -38,7 +54,7 @@ # Which backend Glacier will use to download files # Selecting more than one backend will cause breakage - export GLACIER_DOWNLOAD_BACKEND="wget --quiet --show-progress" + export GLACIER_DOWNLOAD_BACKEND="(wget --quiet --show-progress" #export GLACIER_DOWNLOAD_BACKEND="curl --output $input.tar.gz" #export GLACIER_DOWNLOAD_BACKEND="aria2c" diff --git a/src/glacier_release b/src/glacier_release index d8df11f..ddb61e4 100755 --- a/src/glacier_release +++ b/src/glacier_release @@ -1,3 +1,3 @@ #!/bin/sh -export GLACIER_RELEASE=$(printf "3.0.0\n") +export GLACIER_RELEASE="3.0.0" diff --git a/src/gscripts b/src/gscripts index 819cc96..3373e05 100755 --- a/src/gscripts +++ b/src/gscripts @@ -1,6 +1,8 @@ #!/bin/sh # gscripts - Scripts for Glacier operations +source /etc/glacier.conf + while [[ $# -gt 0 ]]; do case $1 in help) @@ -15,40 +17,39 @@ while [[ $# -gt 0 ]]; do exit 0 ;; preload) - source /etc/glacier/hooks - printf "Hooks loaded from /etc/glacier/hooks.sh.\n" + /etc/glacier/hooks + if [ "$?" != "0" ]; then + exit 1 + fi exit 0 ;; integrity-check) - printf "Getting checksum from server...\n" - REMOTE_SUM=$(curl $WORLD_SUM/$input.checksum || curl $GALAXY_SUM/$input.checksum || curl $UNIVERSE_SUM/$input.checksum || curl $MULTIVERSE_SUM/$input.checksum || curl $WORLD_TESTING_SUM/$input.checksum || curl $GALAXY_TESTING_SUM/$input.checksum || curl $UNIVERSE_TESTING_SUM/$input.checksum || curl $MULTIVERSE_TESTING_SUM/$input.checksum) + $GLACIER_DOWNLOAD_BACKEND $WORLD_SUM/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GALAXY_SUM/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $UNIVERSE_SUM/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $MULTIVERSE_SUM/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $WORLD_TESTING_SUM/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GALAXY_TESTING_SUM/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $UNIVERSE_TESTING_SUM/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $MULTIVERSE_TESTING_SUM/$input.checksum || printf "error in subprocess /usr/bin/gscripts: no checksum found\n" && exit 1 LOCAL_SUM=$(sha256sum $input.tar.gz) - if [ "$REMOTE_SUM" = "$LOCAL_SUM" ]; then + if [ $input.checksum = $LOCAL_SUM ]; then printf "$green [ $check ]$reset Integrity check passed.\n" + rm $input.checksum exit 0 else printf "$red [ $error ]$reset Integrity check failed.\n" + rm $input.checksum exit 1 fi ;; download) - $GLACIER_DOWNLOAD_BACKEND $GREPO1/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO2/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO3/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO4/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO5/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO6/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO7/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO8/$input.tar.gz + $GLACIER_DOWNLOAD_BACKEND $GREPO1/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO2/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO3/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO4/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO5/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO6/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO7/$input.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO8/$input.tar.gz || printf "error in subprocess /usr/bin/gscripts: no package found\n" && exit 1 ;; post-install) - mv $input-pkginfo.json /etc/glacier/pkginfo + mv -vf -- $input-pkginfo.json /etc/glacier/pkginfo || printf "error in subprocess /usr/bin/gscripts: could not stat $input-pkginfo.json\n" && exit 1 cd .. - rm -rf $input + rm -rf $input || printf "error in subprocess /usr/bin/gscripts: could not remove package source\n" && exit 1 ;; -*|--*) 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 done diff --git a/src/hooks b/src/hooks index 85e3445..7d75750 100755 --- a/src/hooks +++ b/src/hooks @@ -3,5 +3,4 @@ source /etc/make.conf source /etc/glacier.conf - source /etc/glacier/messages source /etc/glacier/glacier_release diff --git a/src/make.conf b/src/make.conf new file mode 100644 index 0000000..5c2912c --- /dev/null +++ b/src/make.conf @@ -0,0 +1,26 @@ +# +# make.conf - optimizations and flags for make +# + +# Number of parallel makejobs. Change this number to your CPUs cores + threads. +# Example: 6 cores + 6 threads = 12 +MAKEFLAGS="-j1" + +# Build and compile flags for C and C++ programs. +# Disable these if packages are breaking. +# Using too many optimizations may break packages. +CFLAGS="-02" +CXXFLAGS="${CFLAGS}" + +# Prefix for installed packages. Most packages will follow this. +# Some packages may have their own prefix, for instance, appimages. +PREFIX="/usr" +#PREFIX="/usr/local" + +# CPU architecture. Most users will use x86. +# This setting shouldn't require changing. Only change if errors occur. +ARCH="${MACHTYPE}" + +# +# end make.conf +# diff --git a/src/messages b/src/messages index f4df8db..96e72de 100755 --- a/src/messages +++ b/src/messages @@ -1,18 +1,19 @@ #!/bin/sh +source /etc/glacier.conf + # Errors -export GLACIER_ERROR_NO_ROOT=$(printf "$red [ $error ]$reset Please run Glacier as root.\n") -export GLACIER_ERROR_DOES_NOT_EXIST=$(printf "$red [ $error ]$reset Package $input either does not exist, or is in a repository that is not enabled.\n") -export GLACIER_ERROR_CANNOT_UNPACK=$(printf "$red [ $error ]$reset Package archive cannot be unpacked.\n") -export GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE=$(printf "$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n") +export GLACIER_ERROR_NO_ROOT="$red [ $error ]$reset Please run Glacier as root.\n" +export GLACIER_ERROR_DOES_NOT_EXIST="$red [ $error ]$reset Package $input either does not exist, or is in a repository that is not enabled.\n" +export GLACIER_ERROR_CANNOT_UNPACK="$red [ $error ]$reset Package archive cannot be unpacked.\n" +export GLACIER_ERROR_INSTRUCTIONS_CANNOT_EXECUTE="$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n" # Status -export GLACIER_STATUS_INSTALLING=$(printf "$blue [ i ]$reset Installing $input...\n") -export GLACIER_STATUS_UPDATING=$(printf "$blue [ i ]$reset Updating $input...\n") -export GLACIER_STATUS_REMOVING=$(printf "$blue [ i ]$reset Removing $input...\n") -export GLACIER_STATUS_CACHING=$(printf "$blue [ i ]$reset Caching $input...\n") -export GLACIER_STATUS_UNPACKING=$(printf "$blue [ i ]$reset Unpacking $input.tar.gz...\n") -export GLACIER_STATUS_INTEGRITY_CHECK=$(printf "$blue [ i ]$reset Verifying integrity of package...\n") -export GLACIER_STATUS_EXECUTING=$(printf "$blue [ i ]$reset Executing instructions...\n") -) -export GLACIER_WHICH_PKG=$(printf "$blue [ $question ]$reset Enter package name: ") +export GLACIER_STATUS_INSTALLING="$blue [ i ]$reset Installing $input...\n" +export GLACIER_STATUS_UPDATING="$blue [ i ]$reset Updating $input...\n" +export GLACIER_STATUS_REMOVING="$blue [ i ]$reset Removing $input...\n" +export GLACIER_STATUS_CACHING="$blue [ i ]$reset Caching $input...\n" +export GLACIER_STATUS_UNPACKING="$blue [ i ]$reset Unpacking $input.tar.gz...\n" +export GLACIER_STATUS_INTEGRITY_CHECK="$blue [ i ]$reset Verifying integrity of package...\n" +export GLACIER_STATUS_EXECUTING=printf "$blue [ i ]$reset Executing instructions...\n" +export GLACIER_WHICH_PKG="$blue [ $question ]$reset Enter package name: "