Glacier v3.0.0

This commit is contained in:
lw-everestlinux 2022-10-25 16:38:18 -04:00
parent 2be842a411
commit 65c2ad8146
18 changed files with 583 additions and 500 deletions

79
README Normal file
View File

@ -0,0 +1,79 @@
+-----------------+
| [*] Glacier [*] |
+-----------------+
Manage packages on an Everest Linux system
+-----------------------+
| [?] About Glacier [?] |
+-----------------------+
Glacier's main goal is to combine the power of
source based packaging with the simplicity of
binary based packaging.
Glacier downloads source code from
https://git.everestlinux.org/EverestLinux/glacier-pkgs
and compiles it locally on your system.
+----------------------+
| [!] Dependencies [!] |
+----------------------+
Glacier requires the following programs to function:
- sh
- wget/curl (any program that can download files)
- tar
- make
+----------------------------+
| [🠗] Installing Glacier [🠗] |
+----------------------------+
Obtain the source code:
$ git clone https://git.everestlinux.org/EverestLinux/glacier
$ cd glacier
Copy install.conf.def to install.conf
$ mv install.conf.def install.conf
Make necessary adjustments to install.conf, then run
INSTALL.sh as root.
# ./INSTALL.sh
+-----------------+
| [>_] Usage [>_] |
+-----------------+
# glacier install/-f
# glacier update/-u
# glacier remove/-x
$ glacier query/-q
# glacier cache/-c
# glacier cache-install/-ci
# glacier cache-clear/-cc
$ glacier --debuginfo
$ glacier -h/--help
$ glacier -v/--version
+-------------------+
| [©] Licensing [©] |
+-------------------+
(C) 2021-2022 Everest Developers
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/>.

View File

@ -1,74 +0,0 @@
![alt text](https://raw.githubusercontent.com/everest-linux/amogus3016/main/glacier.png)
# Glacier
Glacier is the package manager developed for Everest Linux. It fetches packages from https://github.com/everest-linux/glacier-pkgs
Install Glacier by pasting the following command into your terminal:
```
rm -rf /tmp/glacier && cd /tmp && git clone https://git.everestlinux.org/EverestLinux/glacier &&
cd glacier/install && chmod +x INSTALL-GLACIER.sh && sudo ./INSTALL-GLACIER.sh || doas ./INSTALL-GLACIER.sh
```
For Glacier to work properly, you need to have both wget and tar installed.
Glacier depends on either wget, curl, or aria2, and tar for its backends. It also requires a working C compiler for source packages to work correctly. Some packages may have their own sets of dependencies. All of these are configured by default in the Everest rootfs tarball, but you may need some extra configuration to get these programs on other distros, most notably, Arch and its derivatives.
Glacier is intended to be a universal package manager, and should work on all distros, providing you have wget and tar installed. For the sake of compatibility, all scripts submitted should contain **NON DISTRO SPECIFIC COMMANDS**.
Glacier features both apt-like and pacman-like syntax (`glacier install` or `glacier -f`)
# Submitting Packages
Packages should be submitted by sending a pull request to https://github.com/everest-linux/glacier-pkgs, with your package in the proper testing repository (if its system software, world-testing, if its gpl software, galaxy-testing, etc). A maintainer will test the package to make sure it downloads correctly.
# Latest News
9/6/22 > Added package integrity checking. v2.3.0
8/26/22 > 8/26/22 > Improved help message output and included a tarball for installation through the ELIF. v2.2.3
7/14/22 > Download backend can now be changed. v2.2
6/21/22 > Changed repositories in `glacier.conf` to reflect the migration from GitHub to `git.everestlinux.org`.
6/10/22 > ARM packages may be available soon. In the event you wish to install Everest on an ARM device, update `/etc/glacier.conf` accordingly, changing `glacier-pkgs` to `glacier-arm-pkgs`. x86 packages will be designated as `amd64`, and ARM packages will be designated as `aarch64`
6/8/22 > Basic package integrity checking. 2.1
5/31/22 > Added command line parsing and condensed Glacier into a single script. 2.0
5/27/22 > Happy Memorial Day to everyone in the US. I've added a new file, `/etc/glacier/hooks.sh` that will define startup hooks when any Glacier script is run. It is highly recommended to keep both default hooks, and to create `/etc/make.conf`. 1.3
5/17/22 > Considering adding command line parsing
5/3/22 > Multi repository support is back! 1.2
5/3/22 > Multi-repository support might return, as I've discovered "||". 1.1 (only minor changes, such as line printing)
4/20/22 > Colored output, and proper unicode symbols. First stable Glacier release, 1.0
4/13/22 > Multi-repository support has been temporarily removed, due to incorrect error handling. 0.7.5rc
4/12/22 > Added support for multiple repositories (world, galaxy, universe, multiverse, and their testing counterparts).
4/5/22 > Added package timestamps. New package uploads will be halted until all current packages have timestamp capabilities added. To do this, add a script called (package_name).ts.sh, which should contain 2 commands:
```
touch /var/log/glacier/(package_name).timestamp
date >> /var/log/glacier/(package_name).timestamp
```
0.6rc.
3/28/22 (again) > Added package caching. This is useful if the user wishes to customize package instruction scripts before installing. 0.5rc
3/28/22 > Recovered from sickness, released 0.4rc. This update provides proper cleanup after an operation is complete. This is done by making a temporary directory that the tarball will be unpacked into. Also added the logo to README.md
3/22/22 > Sorry for a lack of updates recently, I've been sick
3/16/22 > Vim has been added to Glacier's package collection as a source package. Additionally, a couple of bugs have been ironed out. To install vim, you must be on the latest version of Glacier. This can be done by cloning this repository, marking UPDATE-GLACIER.sh as executable, and running it as root. I plan on porting more vital system software to the repositories before I release another Everest tarball. Current version: (0.3rc)
3/10/22 > Proper error handling has finally been added! If an operation fails, the package manager will quit, instead of continuing with the operation. Current version: (0.2rc)
# Roadmap
Future: musl libc and musl compiler compatability (change gcc to $CC) (no clue why this is here because its already done lol)
Sometime within the next few months: command line parsing and multi-repository support, all neccessary packages ported (still need more GNU packages)

View File

@ -1,7 +0,0 @@
# Reporting Issues
While reporting an issue, make sure to include the following:
- Glacier output
- A debug info file (this can be acquired by running 'glacier --showDebugInfo > glacier.debug')

View File

@ -1,22 +0,0 @@
#!/bin/sh
# Glacier Installation Script
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "[ X ] Please run Glacier installation script as root."
exit
fi
mv ../scripts/glacier.conf /etc
mkdir /etc/glacier && echo "[ i ] Creating Glacier directory..."
mkdir /etc/glacier/pkginfo && echo "[ i ] Creating Glacier package list directory..."
mkdir /var/cache/glacier && echo "[ i ] Creating Glacier package cache..."
mkdir /var/log/glacier && echo "[ i ] Creating Glacier timestamp log..."
mv ../scripts/hooks.sh /etc/glacier
chmod +x ../scripts/glacier
echo "[ i ] Installing glacier..."
cd ../scripts
mv glacier /bin
mv GLACIER_INTEGRITY_CHECK /bin
touch /etc/make.conf
printf "[ i ] Glacier has finished installing."

45
install/INSTALL.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "must be run as root\n"
exit 1
fi
WORKING_DIR=$(pwd)
SRC_DIR=$(pwd)/../src
printf "parsing install.conf\n"
source $WORKING_DIR/install.conf
if [ "$?" != 0 ]; then
printf "install.conf not found\n"
exit 1
fi
printf "installing executable\n"
mv $SRC_DIR/glacier $PREFIX/bin
if [ "$?" != 0 ]; then
mv $SRC_DIR/glacier $PREFIX
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
fi
printf "installing configuration files\n"
mv $SRC_DIR/glacier.conf $CONFDIR
if [ "$?" != 0 ]; then
printf "$CONFDIR does not exist\n"
printf "this can be corrected by running:\n"
printf "# mkdir -pv $CONFDIR\n"
exit 1
fi
mkdir /opt/glacier
mkdir /opt/glacier/workspace
mkdir /var/log/glacier
mkdir /var/cache/glacier
mkdir /etc/glacier
mkdir /etc/glacier/pkginfo
mv $SRC_DIR/hooks $CONFDIR/glacier
mv $SRC_DIR/hooks.sh $CONFDIR/glacier
mv $SRC_DIR/make.conf $CONFDIR
printf "finished installation\n"
exit 0

View File

@ -1,20 +0,0 @@
#!/bin/sh
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "[ X ] Please run Glacier uninstallation as root."
exit
fi
echo "[ ! ] It is recommended to uninstall all Glacier packages before uninstalling Glacier."
echo "[ ! ] This will prevent untracked packages from remaining on your system and possibly creating a security risk."
echo "[ ! ] To see which packages are installed on your system, run the following command:"
echo "[ ! ] ls /etc/glacier/pkginfo"
while true; do
read -p "[ ? ] Would you like to uninstall Glacier?" yn
case $yn in
[Yy]* ) rm -rf /etc/glacier && rm -rf /var/cache/glacier && rm -rf /var/log/glacier && rm /bin/glacier; break;;
[Nn]* ) exit;;
* ) echo "[ ! ] You must answer either yes or no.";;
esac
done

9
install/UNINSTALL.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
rm -rf /etc/glacier
rm -rf /var/log/glacier
rm -rf /var/cache/glacier
rm -rf /opt/glacier
rm /bin/glacier

Binary file not shown.

10
install/install.conf.def Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# install.conf
# Installation prefix
# On Everest, this should be /usr, because /bin, /sbin, and /lib are all symlinks to /usr
PREFIX="/usr"
# System config directory
# On almost all systems, this should be /etc
CONFDIR="/etc"

View File

@ -1,14 +0,0 @@
#!/bin/sh
ORIGIN_CHECKSUM=$($GLACIER_DOWNLOAD_BACKEND $GREPO1/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO2/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO3/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO4/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO5/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO6/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO7/$input.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO8/$input.checksum)
PKG_CHECKSUM=$(sha256sum $input.tar.gz)
if [ "$ORIGIN_CHECKSUM" == "$PKG_CHECKSUM" ]; then
printf "$green [ $check ]$reset Integrity check passed.\n"
rm $input.checksum
else
printf "$red [ $error ]$reset Integrity check failed.\n"
rm $input.checksum
exit 1
fi

View File

@ -1,318 +0,0 @@
#!/bin/sh
# Glacier - A source based package manager written in POSIX sh
# (C) 2022 Everest Developers
# 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
source /etc/glacier/hooks.sh
export input # This preloading hook must take place within this script
# Main Script
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
printf "$blue [ * ] Glacier - A source based package manager written in POSIX sh [ * ] $reset\n"
printf "$blue=== Information ====================================================================================$reset\n"
printf "$ glacier {-h --help} show this message and exit\n"
printf "$ glacier {--version} display the current Glacier version and exit\n"
printf "$blue=== Package Operations =============================================================================$reset\n"
printf "# glacier {install -f} install a package\n"
printf "# glacier {update -u} update a package\n"
printf "# glacier {remove -x} remove a package\n"
printf "$ glacier {query -q} query a package\n"
printf "# glacier {cache -c} cache a package\n"
printf "# glacier {cache-install -ci} install a cached package\n"
printf "# glacier {cache-clear -cc} clear the package cache\n"
printf "$blue=== Debugging ======================================================================================$reset\n"
printf "$ glacier {--showDebugInfo} show debugging info\n"
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 <https://www.gnu.org/licenses/>.\n"
exit 0
;;
--version)
printf "$blue Glacier v2.3.0 $reset\n"
exit 0
;;
install|-f)
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "\033[1;31m [ \xE2\x9C\x95 ] \033[m Please run Glacier as root.\n"
exit
fi
# Get package name and download package archive
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Installing $input.tar.gz...\n"
printf "\033[1;34m [ i ] \033[m Checking databases... " && $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
if [ "$?" != "0" ]; then
printf "\033[1;31m [ \xE2\x9C\x95 ] \033[m Package not found.\n" 1>&2
exit 1
fi
# Unpack Tarball
printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz...\n"
mkdir $input && mv $input.tar.gz $input && cd $input
printf "$blue [ i ]$reset Verifying integrity of package...\n"
#GLACIER_INTEGRITY_CHECK
# if [ "$?" != "0" ]; then
# exit 0
# fi
tar -xf $input.tar.gz
if [ "$?" != "0" ]; then
printf "\033[1;31m [ \xE2\x9C\x95 ] \033[m Could not unpack $input.tar.gz.\n" 1>&2
cd .. && rm -rf $input
exit 1
fi
# Run installation hooks
chmod +x INSTALL.sh
chmod +x $input.ts.sh
printf "$blue [ i ]$reset The following instruction set will be executed:\n"
cat INSTALL.sh
printf "\033[1;34m [ i ] \033[m Executing installation instructions...\n"
./INSTALL.sh
if [ "$?" != "0" ]; then
printf "$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n" 1>&2
cd .. && rm -rf $input
exit 1
fi
./$input.ts.sh
# Clean up
printf "\033[1;34m [ i ] \033[m Cleaning up...\n"
mv $input-pkginfo.json /etc/glacier/pkginfo
cd ..
rm -rf $input
printf "\033[1;32m [ \xE2\x9C\x93 ] \033[m Operation completed.\n"
exit 0
;;
update|-u)
# Require Glacier to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root.\n"
exit
fi
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Installing $input.tar.gz...\n"
printf "\033[1;34m [ i ] \033[m Checking databases... " && $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
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Package not found.\n" 1>&2
exit 1
fi
printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz...\n"
mkdir $input && mv $input.tar.gz $input && cd $input
printf "$blue [ i ]$reset Verifying integrity of package...\n"
#GLACIER_INTEGRITY_CHECK
# if [ "$?" != "0" ]; then
# exit 0
# fi
tar -xf $input.tar.gz
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Could not unpack $input.tar.gz.\n" 1>&2
exit 1
fi
rm /var/log/glacier/$input.timestamp
chmod +x UPDATE.sh
chmod +x $input.ts.sh
printf "$blue [ i ]$reset The following instruction set will be executed:\n"
cat UPDATE.sh
printf "\033[1;34m [ i ] \033[m Executing update instructions...\n"
./UPDATE.sh
if [ "$?" != "0" ]; then
printf "$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n" 1>&2
exit 1
fi
./$input.ts.sh
printf "\033[1;34m [ i ] \033[m Cleaning up...\n"
mv $input-pkginfo.json /etc/glacier/pkginfo
cd ..
rm -rf $input
printf "\033[1;32m [ $check ] \033[m Operation completed.\n"
exit 0
;;
remove|-x)
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root.\n"
exit
fi
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Removing $input.tar.gz...\n"
printf "\033[1;34m [ i ] \033[m Checking databases... " && $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
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Package not found.\n" 1>&2
exit 1
fi
printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz...\n"
mkdir $input && mv $input.tar.gz $input && cd $input
printf "$blue [ i ]$reset Verifying integrity of package...\n"
#GLACIER_INTEGRITY_CHECK
# if [ "$?" != "0" ]; then
# exit 0
# fi
tar -xf $input.tar.gz
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Could not unpack $input.tar.gz.\n" 1>&2
exit 1
fi
chmod +x REMOVE.sh
printf "$blue [ i ] $reset The following instruction set will be executed:\n"
cat REMOVE.sh
printf "$blue [ i ] $reset Executing removal instructions...\n"
./REMOVE.sh
if [ "$?" != "0" ]; then
printf "$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n" 1>&2
exit 1
fi
rm /var/log/glacier/$input.timestamp
printf "\033[1;34m [ i ] \033[m Cleaning up... \n" # Status message
cd ..
rm -rf $input
rm /etc/glacier/pkginfo/$input-pkginfo.json
printf "\033[1;32m [ $check ] \033[m Operation completed.\n"
exit 0
;;
query|-q)
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
cat /etc/glacier/pkginfo/$input-pkginfo.json
cat /var/log/glacier/$input.timestamp
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Package not found.\n" 1>&2
exit 1
fi
exit 0
;;
cache|-c)
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root.\n"
exit
fi
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Caching $input.tar.gz...\n"
printf "\033[1;34m [ i ] \033[m Checking databases... " && $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
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Package not found.\n" 1>&2
exit 1
fi
printf "$blue [ i ]$reset Verifying integrity of package...\n"
#GLACIER_INTEGRITY_CHECK
# if [ "$?" != "0" ]; then
# exit 0
# fi
mv $input.tar.gz /var/cache/glacier
printf "\033[1;32m [ $check ] \033[m Operation completed.\n"
exit 0
;;
cache-install|-ci)
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "$red[ $error ]$reset Please run Glacier as root.\n"
exit
fi
printf "\033[1;34m [ ? ] \033[m Enter package name: " && read input
printf "\033[1;34m [ i ] \033[m Checking cache for $input.tar.gz...\n"
cd /var/cache/glacier && cp $input.tar.gz /tmp && cd /tmp
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Could not fetch package from cache.\n" 1>&2
exit 1
fi
printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz...\n"
mkdir $input && mv $input.tar.gz $input && cd $input
tar -xf $input.tar.gz
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Could not unpack $input.tar.gz.\n" 1>&2
exit 1
fi
chmod +x INSTALL.sh
chmod +x $input.ts.sh
./INSTALL.sh # Actually executes installation script
if [ "$?" != "0" ]; then
printf "$red [ $error ]$reset Instructions were either unable to execute, or encountered an error while executing.\n" 1>&2
exit 1
fi
./$input.ts.sh
printf "\033[1;34m [ i ] \033[m Cleaning up...\n" # Status message
mv -v $input-pkginfo.json /etc/glacier/pkginfo
cd ..
rm -rvf $input
printf "\033[1;32m [ $check ] \033[m Operation completed.\n"
exit 0
;;
cache-clear|-cc)
# Require the script to be run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "\033[1;31m [ $error ] \033[m Please run Glacier as root.\n"
exit
fi
printf "\033[1;34m [ i ] \033[m Clearing cache...\n"
cd /var/cache/glacier && rm -rf *
if [ "$?" != "0" ]; then
printf "\033[1;31m [ $error ] \033[m Some items could not be cleared.\n" 1>&2
exit 1
fi
printf "\033[1;32m [ $check ] \033[m Cache cleared.\n"
exit 0
;;
--showDebugInfo)
printf "Glacier v2.3.0\n"
printf ":: Checking for 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 ":: Any missing files above, especially make.conf, will cause Glavier to behave abnormally.\n"
printf ":: Checking that unicode symbols display properly...\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 ":: Ensuring repositories are correct...\n"
echo $GREPO1
echo $GREPO2
echo $GREPO3
echo $GREPO4
echo $GREPO5
echo $GREPO6
echo $GREPO7
echo $GREPO8
printf ":: Debug info has been gathered.\n"
printf ":: If you wish to save this information to a file, run 'glacier --showDebugInfo > glacier.debug'.\n"
exit 0
;;
-*|--*)
printf "$red [ $error ]$reset Unknown option, use 'glacier -h' to see usage.\n"
exit 1
;;
*)
printf "$red [ $error ]$reset Unknown option, use 'glacier -h' to see usage.\n"
exit 1
;;
esac
done
printf "$red [ $error ]$reset Unknown option, use 'glacier -h' to see usage.\n"

View File

@ -1,36 +0,0 @@
#
# /etc/glacier.conf
# The settings stored in this file will be loaded when Glacier is called
# For more information on each of these options, see https://git.everest
#
# 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
# Define colors and unicode symbols to be used
export red="\033[1;31m"
export green="\033[1;32m"
export yellow="\033[1;33m"
export blue="\033[1;34m"
export reset="\033[m"
export check="\xE2\x9C\x93"
export error="\xE2\x9C\x95"
export warning="\x21"
export question="\x3F"
# 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="curl --output $input.tar.gz"
#export GLACIER_DOWNLOAD_BACKEND="aria2c"
#
# end /etc/glacier.conf
#

View File

@ -1,9 +0,0 @@
#!/bin/sh
# /etc/glacier/hooks.sh
# Hooks that will be run while calling Glacier
# DO NOT DELETE THE 2 HOOKS BELOW
source /etc/glacier.conf
source /etc/make.conf
# Custom hooks can be put below

322
src/glacier Executable file
View File

@ -0,0 +1,322 @@
#!/bin/sh
# Glacier - manage installed packages on a Linux system
# This program is free software - you can distribute it
# under the terms of the GNU General Public License v3.0,
# or at your option, any later version.
# A copy of the GNU General Public License should have been
# recieved along with this program. If not, see
# <https://www.gnu.org/licenses>
source /etc/glacier/hooks
get_pkg() {
printf "$blue[ i ]$reset Downloading archive for package '$2'...\n"
$GLACIER_DOWNLOAD_BACKEND $GREPO1/$2.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO2/$2.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO3/$2.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO4/$2.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO5/$2.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO6/$2.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO7/$2.tar.gz || $GLACIER_DOWNLOAD_BACKEND $GREPO8/$2.tar.gz
if [ "$?" != "0" ]; then
printf "$red[ $error ]$reset Package '$2' not found.\n"
exit 1
fi
}
# implementing this later because this whole section is a clusterfuck
#int_check () {
# printf "$blue[ i ]$reset Checking package integrity...\n"
# LOCAL_CHECKSUM=$(cat $2.checksum)
# hsh $2.tar.gz $LOCAL_CHECKSUM
# if [ "$?" != "0" ]; then
# printf "$red[ $error ]$reset Integrity check failed.\n"
# exit 1
# else
# printf "$green[ $check ]$reset Integrity check passed.\n"
# exit 0
# fi
#}
unpack_pkg() {
printf "$blue[ i ]$reset Unpacking $2.tar.gz...\n"
mkdir $2 && mv $2.tar.gz $2 && cd $2
tar -xvf $2.tar.gz
if [ "$?" != "0" ]; then
printf "$red[ $error ]$reset Could not unpack $2.tar.gz.\n"
cd .. && rm -rf $2
exit 1
fi
}
installpkg() {
printf "$blue[ i ]$reset Installing $2...\n"
sleep 1
chmod +x *
./INSTALL.sh
if [ "$?" != "0" ]; then
printf "$red[ $error ]$reset Failed to update $2.\n"
cd .. && rm -rf $2
exit 1
fi
./$2.ts.sh
mv $2-pkginfo.json /etc/glacier/pkginfo
}
updatepkg() {
printf "$blue[ i ]$reset Updating $2...\n"
sleep 1
chmod +x *
./UPDATE.sh
if [ "$?" != "0" ]; then
printf "$red[ $error ]$reset Failed to update $2.\n"
cd .. && rm -rf $2
exit 1
fi
./$2.ts.sh
}
removepkg() {
printf "$blue[ i ]$reset Removing $2...\n"
sleep 1
chmod +x *
./REMOVE.sh
if [ "$?" != "0" ]; then
printf "$red[ $error ]$reset Failed to remove $2.\n"
cd .. && rm -rf $2
exit 1
fi
rm /var/log/glacier/$2.timestamp
rm /etc/glacier/pkginfo/$2-pkginfo.json
}
installpkg_from_cache() {
printf "$blue[ i ]$reset Installing $2 from cache...\n"
sleep 1
cd /var/cache/glacier && cp $2.tar.gz /tmp && cd /tmp
if [ "$?" != "0" ]; then
printf "$red[ $error ]$reset Package does not exist in cache.\n"
exit 1
fi
unpack_pkg
install_pkg
}
clear_cache() {
printf "$blue[ i ]$reset Clearing cache...\n"
sleep 1
cd /var/cache/glacier && rm -rf *
if [ "$?" != "0" ]; then
printf "$red[ $error ]$reset Some items could not be cleared.\n"
exit 1
fi
}
debug_info() {
printf "$blue>> Glacier v3.0.0$reset\n"
printf ">> Checking for valid 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 files are present...\n"
whereis glacier glacier.conf make.conf
ls /var/log | grep glacier
ls /var/cache | grep glacier
printf ">> If any files are missing, Glacier will not behave properly.\n"
printf ">> Checking if terminal can output unicode symbols...\n"
printf "$check\n"
printf "$error\n"
printf "$warning\n"
printf "$question\n"
printf "$red Red.$reset\n"
printf "$green Green.$reset\n"
printf "$yellow Yellow.$reset\n"
printf "$blue Blue.$reset\n"
printf "NOTE: If you use a custom colorscheme, colors will not match.\n"
printf ">> Checking if repositories are valid...\n"
echo $GREPO1
echo $GREPO2
echo $GREPO3
echo $GREPO4
echo $GREPO5
echo $GREPO6
echo $GREPO7
echo $GREPO8
printf ">> Checking which shell is in use...\n"
which $SHELL
printf "NOTE: If you use zsh, a percentage symbol may appear after some lines.\n"
printf ">> Gathered debug information.\n"
printf ">> To save this information to a file, run:\n"
printf ">> $ glacier --debuginfo > glacier.debug\n"
}
query() {
printf "$blue[ i ]$reset Showing information for package '$2'.\n"
printf "$blue>> Package name:$reset " && cat /etc/glacier/pkginfo/$2-pkginfo.json | jq .package_name
printf "$blue>> Package version:$reset " && cat /etc/glacier/pkginfo/$2-pkginfo.json | jq .package_version
printf "$blue>> Package description:$reset " && cat /etc/glacier/pkginfo/$2-pkginfo.json | jq .package_description
printf "$blue>> Source tree size:$reset " && cat /etc/glacier/pkginfo/$2-pkginfo.json | jq .src_tree_size
printf "$blue>> Size of installed files:$reset " && cat /etc/glacier/pkginfo/$2-pkginfo.json | jq .exec_size
printf "$blue>> License:$reset " && cat /etc/glacier/pkginfo/$2-pkginfo.json | jq .license
printf "$blue>> Installation date:$reset " && cat /var/log/glacier/$2.timestamp
}
cleanup () {
printf "$blue[ i ]$reset Cleaning up...\n"
cd .. && rm -rf $2
}
case $1 in
-h|--help)
printf "Glacier - Manage installed packages on the system\n"
printf "usage: glacier {action} {package-name}\n"
printf "\n"
printf "=== Information ===\n"
printf "glacier {-h/--help} - Show this message and exit\n"
printf "glacier {-v/--version} - Show the version and exit\n"
printf "\n"
printf "=== Operations ===\n"
printf "glacier {-f/install} - Install a new package\n"
printf "glacier {-u/update} - Update an installed package\n"
printf "glacier {-x/remove} - Remove an installed package\n"
printf "glacier {-q/query} - Query an installed package\n"
printf "glacier {-c/cache} - Download a package to the cache\n"
printf "glacier {-ci/cache-install} - Install a package from the cache\n"
printf "glacier {-cc/cache-clear} - Clear the cache\n"
printf "\n"
printf "=== Debugging ===\n"
printf "glacier {--debuginfo} - Show debugging information\n"
printf "\n"
printf "=== Licensing ===\n"
printf "This program is free software: you can redistribute it and/or modify it\n"
printf "under the terms of the GNU General Public License as published by the\n"
printf "Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n"
exit 0
;;
-v|--version)
printf "$blue Glacier v3.0.0$reset\n"
exit 0
;;
-f|-install)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "$red[ $error ]$reset Please run Glacier as root.\n"
exit 1
fi
printf "$blue[ i ]$reset Installing package '$2'.\n"
read -p "$(printf "$blue[ ? ]$reset Proceed with this operation? (y/n) ")" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
cd /opt/glacier/workspace
printf "\n"
get_pkg "$@"
#int_check # Will implement this later on
unpack_pkg "$@"
installpkg "$@"
cleanup "$@"
printf "$green[ $check ]$reset Operation completed.\n"
exit 0
fi
;;
-u|update)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "$red[ $error ]$reset Please run Glacier as root.\n"
exit 1
fi
printf "$blue[ i ]$reset Updating package '$2'.\n"
read -p "$(printf "$blue[ ? ]$reset Proceed with this operation? (y/n) ")" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
cd /opt/glacier/workspace
printf "\n"
get_pkg "$@"
#int_check
unpack_pkg "$@"
updatepkg "$@"
cleanup "$@"
printf "$green[ $check ]$reset Operation completed.\n"
exit 0
fi
;;
-x|remove)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "$red[ $error ]$reset Please run Glacier as root.\n"
exit 1
fi
printf "$blue[ i ]$reset Removing package '$2'.\n"
read -p "$(printf "$blue[ ? ]$reset Proceed with this operation? (y/n) ")" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
cd /opt/glacier/workspace
printf "\n"
get_pkg "$@"
#int_check
unpack_pkg "$@"
removepkg "$@"
cleanup "$@"
printf "$green[ $check ]$reset Operation completed.\n"
exit 0
fi
;;
-q|query)
query "$@"
exit 0
;;
-c|cache)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "$red[ $error ]$reset Please run Glacier as root.\n"
exit 1
fi
printf "$blue[ i ]$reset Caching package '$2'.\n"
read -p "$(printf "$blue[ ? ]$reset Proceed with this operation? (y/n) ")" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
cd /var/cache/glacier
printf "\n"
get_pkg "$@"
printf "$green[ $check ]$reset Operation completed.\n"
exit 0
fi
;;
-ci|cache-install)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "$red[ $error ]$reset Please run Glacier as root.\n"
exit 1
fi
printf "$blue[ i ]$reset Installing package '$2' from cache.\n"
read -p "$(printf "$blue[ ? ]$reset Proceed with this operation? (y/n) ")" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
cd /var/cache/glacier
mv $2.tar.gz /opt/glacier/workspace
cd /opt/glacier/workspace
printf "\n"
unpack_pkg "$@"
installpkg "$@"
cleanup "$@"
printf "$green[ $check ]$reset Operation completed.\n"
exit 0
fi
;;
-cc|cache-clear)
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "$red[ $error ]$reset Please run Glacier as root.\n"
exit 1
fi
clear_cache "$@"
printf "$green[ $check ]$reset Operation completed.\n"
exit 0
;;
--debuginfo)
debug_info "$@"
exit 0
;;
-*|--*)
printf "$red[ $error ]$reset Unknown option, see 'glacier -h' for usage.\n"
exit 1
;;
*)
printf "$red[ $error ]$reset Unknown option, see 'glacier -h' for usage.\n"
exit 1
;;
esac
printf "$red[ $error ]$reset Unknown option, see 'glacier -h' for usage.\n"
exit 1

63
src/glacier.conf Executable file
View File

@ -0,0 +1,63 @@
# /etc/glacier.conf
# The settings stored in this file will be loaded when Glacier is called
# For more information on each of these options, see https://git.everest
#
# Repositories Glacier will use
#[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/raw/branch/main/world/"
export GALAXY_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/galaxy/"
export UNIEVRSE_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/universe/"
export MULTIVERSE_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/multiverse"
export WORLD_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/world-testing"
export GALAXY_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/galaxy-testing"
export UNIVERSE_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/universe-testing"
export MULTIVERSE_TESTING_SUM="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main/multiverse-testing"
# Define colors and unicode symbols to be used
export red="\033[1;31m"
export green="\033[1;32m"
export yellow="\033[1;33m"
export blue="\033[1;34m"
export reset="\033[m"
export check="\xE2\x9C\x93"
export error="\xE2\x9C\x95"
export warning="\x21"
export question="\x3F"
# 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="curl --output $2.tar.gz"
#export GLACIER_DOWNLOAD_BACKEND="aria2c"
#
# end /etc/glacier.conf
#

5
src/hooks Executable file
View File

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

10
src/hooks.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# This file is meant to maintain legacy support.
printf "This package uses the legacy hooks file (/etc/glacier/hooks.sh).\n"
printf ">>> This is not an error. <<<\n"
printf "If you are not the maintainer of this package, there is no manual intervention required.\n"
printf "If you are the maintainer of this package, please update your usrbuild.sh, usrupdate.sh, and usrremove.sh accordingly.\n"
source /etc/glacier/hooks && /etc/glacier/hooks

40
src/make.conf Executable file
View File

@ -0,0 +1,40 @@
#
# 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}"
# Flag which treats all warnings as errors.
# Not recommended, as many packages with large codebases will refuse to compile.
#CFLAGS="-Werror"
# Prefix for installed packages. Most packages will follow this.
# Some packages may have their own prefix. For instance, appimages will install to /usr/share/appimages, and be symlinked to /bin.
PREFIX="/usr"
#PREFIX="/usr/local"
# CPU architecture. Most users will use x86_64.
# This setting should manually set itself. If it doesn't, set it manually.
# Note that some packages will not compile for other architectures.
# Example: ARCH="x86_64"
ARCH="${MACHTYPE}"
# Triplet for the target system.
# This should only be used if cross compiling.
# For reference, Everest's triplet is x86_64-linux-musl.
#TARGET="x86_64-linux-musl"
#TARGET="x86_64-pc-linux-gnu"
#TARGET="i386-linux-musl"
#TARGET="i386-pc-linux-gnu"
#
# end make.conf
#