Compare commits
107 Commits
Author | SHA1 | Date | |
---|---|---|---|
f02f83b6a9 | |||
f029628842 | |||
a11e8330c0 | |||
df51893d22 | |||
13cb96df04 | |||
bd07427378 | |||
4e84af0217 | |||
b0d28489e9 | |||
|
d43995befa | ||
|
8a9641be67 | ||
|
9381aecd34 | ||
|
0da359f81b | ||
|
1b94d281a6 | ||
|
974fe1f618 | ||
|
fa1162a88c | ||
|
a2b3ad34d4 | ||
|
346b351ad0 | ||
|
3b4c6f33cf | ||
|
f09d6d45ea | ||
|
5531e98595 | ||
|
0c342167f8 | ||
|
657cbd5e78 | ||
|
96a1c55008 | ||
|
64e58daf40 | ||
|
1c62bd5b19 | ||
|
d419e95f1c | ||
|
bc7b8df2e5 | ||
|
7705ecfb8a | ||
|
677d414a28 | ||
|
de2725a475 | ||
|
f6fce7323d | ||
|
65c2ad8146 | ||
|
2be842a411 | ||
|
5688b4753d | ||
|
b5c28dd802 | ||
|
0807a13286 | ||
|
22e368c5fa | ||
|
3c4919cf0c | ||
|
ebe5e3930e | ||
9c529d1ab2 | |||
|
3b3d5ab369 | ||
8c1f892e2c | |||
e117737527 | |||
69a5f0444a | |||
|
fd6e494314 | ||
4d65c0fb9e | |||
57505be3a2 | |||
0f94ed93b6 | |||
eeac5ed390 | |||
|
b5faa209f2 | ||
1682faa871 | |||
aa0c1ff1ac | |||
863d361e98 | |||
a09bbcaa6b | |||
1e2e514b49 | |||
d5122b918b | |||
cfd90804fe | |||
8749f46706 | |||
|
5beabdbca4 | ||
|
faf8fe7ec8 | ||
|
efada985df | ||
|
73daf1bfbb | ||
|
d751e25f59 | ||
|
343a7c1285 | ||
|
a80d75b5ef | ||
|
f123f98fd6 | ||
|
0b645bd629 | ||
|
17cdc140bb | ||
|
fdc4014672 | ||
|
749b77dcd8 | ||
|
b4749dc30b | ||
|
975ad4fcd2 | ||
|
de61a35eef | ||
|
7caa78f3dd | ||
|
089fe7d668 | ||
|
2b062b9a3d | ||
|
b6aa112bd1 | ||
|
5fe0e37d68 | ||
|
e7ae67d256 | ||
|
34327f5d08 | ||
|
014a8c82a9 | ||
|
983f98d1a0 | ||
|
752ff88e76 | ||
|
b53666a47d | ||
|
49475014da | ||
|
2df34b663d | ||
|
16657923ad | ||
|
5336379812 | ||
|
683626ed85 | ||
|
88d836f4ec | ||
|
b8dbfec436 | ||
|
91bd0a6806 | ||
|
8ef2dd8bf7 | ||
|
8118597e51 | ||
|
0c8862f7b0 | ||
|
40ee42ce9b | ||
|
b2e8ec0b9e | ||
|
de0f023009 | ||
|
1af0eeccb1 | ||
|
c14ef72f62 | ||
|
797f942301 | ||
|
f5b99b1efe | ||
|
f9fe4831e5 | ||
|
58ad767e30 | ||
|
d38cf63cd1 | ||
|
f6742f5a3e | ||
|
33d1d962b7 |
95
README
Normal file
95
README
Normal file
@ -0,0 +1,95 @@
|
||||
+-----------------+
|
||||
| [*] 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
|
||||
- a c compiler (tested with gcc, although others should work)
|
||||
- python (for integrity checking)
|
||||
|
||||
+----------------------------+
|
||||
| [🠗] 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
|
||||
build.sh as root.
|
||||
|
||||
# ./build.sh install # for first time installations
|
||||
# ./build.sh update # for existing installations
|
||||
|
||||
+-----------------+
|
||||
| [>_] 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
|
||||
|
||||
+------+
|
||||
| News |
|
||||
+------+
|
||||
|
||||
- 11/3/22 - Changing how packages are uninstalled
|
||||
In Glacier's current state, it needs to download the package archive in order to remove it.
|
||||
This is highly inefficient and presents its own risks.
|
||||
In an upcoming update, the removal script will be retained on the system.
|
||||
This method will be space efficient because:
|
||||
a) Instruction scripts are mere kilobytes
|
||||
b) For larger scripts, you will have the option of compressing them.
|
||||
This feature is expected around 3.2.0.
|
||||
|
||||
+-----------+
|
||||
| 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/>.
|
56
README.md
56
README.md
@ -1,56 +0,0 @@
|
||||
![alt text](https://raw.githubusercontent.com/everest-linux/amogus3016/main/glacierlogo.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://github.com/everest-linux/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 wget 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**.
|
||||
|
||||
# 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
|
||||
|
||||
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)
|
||||
|
||||
Sometime within the next few months: command line parsing and multi-repository support, all neccessary packages ported
|
22
glacier.conf
22
glacier.conf
@ -1,22 +0,0 @@
|
||||
# Glacier configuration file
|
||||
|
||||
# Repositories Glacier will use
|
||||
GREPO1=https://github.com/everest-linux/glacier-pkgs/raw/main/world # System Software
|
||||
GREPO2=https://github.com/everest-linux/glacier-pkgs/raw/main/galaxy # GPL Only Software
|
||||
GREPO3=https://github.com/everest-linux/glacier-pkgs/raw/main/universe # All Open Source Software
|
||||
#GREPO4=https://github.com/everest-linux/glacier-pkgs/raw/main/multiverse # Proprietary Software
|
||||
#GREPO5=https://github.com/everest-linux/glacier-pkgs/raw/main/world-testing
|
||||
#GREPO6=https://github.com/everest-linux/glacier-pkgs/raw/main/galaxy-testing
|
||||
#GREPO7=https://github.com/everest-linux/glacier-pkgs/raw/main/universe-testing
|
||||
#GREPO8=https://github.com/everest-linux/glacier-pkgs/raw/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"
|
@ -1,41 +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 ../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..."
|
||||
chmod +x ../scripts/glacier-install.sh
|
||||
chmod +x ../scripts/glacier-remove.sh
|
||||
chmod +x ../scripts/glacier-update.sh
|
||||
chmod +x ../scripts/glacier-query.sh
|
||||
chmod +x ../scripts/glacier-cache.sh
|
||||
chmod +x ../scripts/glacier-cache-install.sh
|
||||
chmod +x ../scripts/glacier-cache-clear.sh
|
||||
chmod +x ../scripts/glacier-help.sh
|
||||
echo "[ i ] Installing glacier..."
|
||||
cd ../scripts
|
||||
cp glacier-install.sh glacier-install
|
||||
cp glacier-remove.sh glacier-remove
|
||||
cp glacier-update.sh glacier-update
|
||||
cp glacier-query.sh glacier-query
|
||||
cp glacier-cache.sh glacier-cache
|
||||
cp glacier-cache-install.sh glacier-cache-install
|
||||
cp glacier-cache-clear.sh glacier-cache-clear
|
||||
cp glacier-help.sh glacier-help
|
||||
mv glacier-install /bin
|
||||
mv glacier-remove /bin
|
||||
mv glacier-update /bin
|
||||
mv glacier-query /bin
|
||||
mv glacier-cache /bin
|
||||
mv glacier-cache-install /bin
|
||||
mv glacier-cache-clear /bin
|
||||
mv glacier-help /bin
|
||||
echo "[ i ] Glacier has finished installing successfully."
|
@ -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-install && rm /bin/glacier-update && rm /bin/glacier-remove && rm /bin/glacier-query && rm /bin/glacier-help; break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "[ ! ] You must answer either yes or no.";;
|
||||
esac
|
||||
done
|
@ -1,34 +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 update script as root."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "[ i ] Removing outdated binaries..."
|
||||
rm /bin/glacier-install
|
||||
rm /bin/glacier-update
|
||||
rm /bin/glacier-remove
|
||||
rm /bin/glacier-query
|
||||
rm /bin/glacier-help
|
||||
echo "[ i ] Marking new binaries as executable..."
|
||||
cd ../scripts
|
||||
chmod +x glacier-install.sh
|
||||
chmod +x glacier-update.sh
|
||||
chmod +x glacier-remove.sh
|
||||
chmod +x glacier-query.sh
|
||||
chmod +x glacier-help.sh
|
||||
echo "[ i ] Preparing to install new binaries..."
|
||||
cp glacier-install.sh glacier-install
|
||||
cp glacier-update.sh glacier-update
|
||||
cp glacier-remove.sh glacier-remove
|
||||
cp glacier-query.sh glacier-query
|
||||
cp glacier-help.sh glacier-help
|
||||
echo "[ i ] Installing new binaries..."
|
||||
mv glacier-install /bin
|
||||
mv glacier-update /bin
|
||||
mv glacier-remove /bin
|
||||
mv glacier-query /bin
|
||||
mv glacier-help /bin
|
||||
echo "[ i ] Glacier was successfully updated to the latest version."
|
@ -1,3 +0,0 @@
|
||||
#!/bin.sh
|
||||
|
||||
rm -rf /tmp/glacier && cd /tmp && git clone https://github.com/everest-linux/glacier && cd glacier/install && chmod +x INSTALL-GLACIER.sh && sudo ./INSTALL-GLACIER.sh
|
72
install/build.sh
Executable file
72
install/build.sh
Executable file
@ -0,0 +1,72 @@
|
||||
#!/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
|
||||
|
||||
case $1 in
|
||||
install)
|
||||
printf "installing executable\n"
|
||||
mv -v $SRC_DIR/glacier $PREFIX/bin
|
||||
if [ "$?" != 0 ]; then
|
||||
mv -v $SRC_DIR/glacier $PREFIX
|
||||
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
|
||||
fi
|
||||
$CC $SRC_DIR/int-check/main.c -o glacier-integrity-check
|
||||
mv -v $SRC_DIR/int-check/glacier-integrity-check $PREFIX/bin
|
||||
if [ "$?" != 0 ]; then
|
||||
mv -v $SRC_DIR/int-check/glacier-integrity-check $PREFIX
|
||||
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead.\n"
|
||||
fi
|
||||
printf "installing configuration files\n"
|
||||
mv -v $SRC_DIR/glacier.conf $CONFDIR
|
||||
if [ "$?" != 0 ]; then
|
||||
printf "$CONFDIR does not exist\n"
|
||||
printf "this can be corrected by running:\n"
|
||||
printf "# mkdir -v -pv $CONFDIR\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -v /opt/glacier
|
||||
mkdir -v /opt/glacier/workspace
|
||||
mkdir -v /var/log/glacier
|
||||
mkdir -v /var/cache/glacier
|
||||
|
||||
mkdir -v /etc/glacier
|
||||
mkdir -v /etc/glacier/pkginfo
|
||||
|
||||
mv -v $SRC_DIR/hooks $CONFDIR/glacier
|
||||
mv -v $SRC_DIR/post-hooks $CONFDIR/glacier
|
||||
mv -v $SRC_DIR/pre-hooks $CONFDIR/glacier
|
||||
mv -v $SRC_DIR/hooks.sh $CONFDIR/glacier
|
||||
mv -v $SRC_DIR/make.conf $CONFDIR
|
||||
mv -v $SRC_DIR/glacier-integrity-check $PREFIX/bin
|
||||
if [ "$?" != "0" ]; then
|
||||
mv -v $SRC_DIR/glacier-integrity-check $PREFIX
|
||||
printf "directory $PREFIX/bin does not exist, moving to $PREFIX instead\n"
|
||||
fi
|
||||
|
||||
printf "finished installation\n"
|
||||
exit 0
|
||||
;;
|
||||
update)
|
||||
printf "updating executable\n"
|
||||
rm -v $PREFIX/bin/glacier || rm -v $PREFIX/glacier
|
||||
rm -v $PREFIX/bin/glacier-integrity-check || rm -v $PREFIX/glacier-integrity-check
|
||||
mv -v $SRC_DIR/glacier $PREFIX/bin || mv -v $SRC_DIR/glacier $PREFIX
|
||||
$CC $SRC_DIR/int-check/main.c -O2 -fstack-protector-strong -o $SRC_DIR/int-check/glacier-integrity-check
|
||||
mv -v $SRC_DIR/int-check/glacier-integrity-check $PREFIX/bin || mv -v $SRC_DIR/int-check/glacier-integrity-check $PREFIX
|
||||
printf "finished updating\n"
|
||||
exit 0
|
||||
esac
|
13
install/install.conf.def
Executable file
13
install/install.conf.def
Executable file
@ -0,0 +1,13 @@
|
||||
#!/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"
|
||||
|
||||
# C Compiler to use
|
||||
CC="gcc"
|
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
# glacier-cache-clear
|
||||
# Script used to clear Glacier's cache
|
||||
|
||||
# Glacier preloading
|
||||
|
||||
source /etc/glacier.conf
|
||||
|
||||
# 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."
|
||||
exit
|
||||
fi
|
||||
|
||||
printf "\033[1;34m [ i ] \033[m Clearing cache... "
|
||||
cd /var/cache/glacier && rm *
|
||||
printf "\033[1;32m [ $check ] \033[m Cache cleared."
|
@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
# glacier-cache-install
|
||||
# Script used to install cached packages
|
||||
|
||||
# Glacier preloading
|
||||
|
||||
source /etc/glacier.conf
|
||||
|
||||
# Require the script to be run as root
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
echo "[ X ] Please run Glacier as root."
|
||||
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... "
|
||||
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. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
printf "\033[1;34m [ i ] \033[m Unpacking $input.tar.gz... "
|
||||
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. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
chmod +x INSTALL.sh
|
||||
chmod +x $input.ts.sh
|
||||
./INSTALL.sh # Actually executes installation script
|
||||
./$input.ts.sh
|
||||
printf "\033[1;34m [ i ] \033[m Cleaning up... " # Status message
|
||||
mv -v $input-pkginfo.json /etc/glacier/pkginfo
|
||||
cd ..
|
||||
rm -rvf $input
|
||||
printf "\033[1;32m [ $check ] \033[m Operation completed."
|
@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
# glacier-cache
|
||||
# Script used to download a package and cache it
|
||||
|
||||
# Glacier preloading
|
||||
|
||||
source /etc/glacier.conf
|
||||
|
||||
# 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."
|
||||
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... " && wget $GREPO1/$input.tar.gz -q --show-progress || wget $GREPO2/$input.tar.gz -q --show-progress || wget $GREPO3/$input.tar.gz -q --show-progress || wget $GREPO4/$input.tar.gz -q --show-progress || wget $GREPO5/$input.tar.gz -q --show-progress || wget $GREPO6/$input.tar.gz -q --show-progress || wget $GREPO7/$input.tar.gz -q --show-progress || wget $GREPO8/$input.tar.gz -q --show-progress
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "\033[1;31m [ $error ] \033[m Package not found. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
mv $input.tar.gz /var/cache/glacier
|
||||
printf "\033[1;32m [ $check ] \033[m Operation completed."
|
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Glacier Package Manager v1.2"
|
||||
echo "====================================================================="
|
||||
echo "An extremely light and fast ackage manager written entirely in shell."
|
||||
echo ""
|
||||
echo "glacier-install - Install a package"
|
||||
echo "glacier-update - Update a package"
|
||||
echo "glacier-remove - Remove a package"
|
||||
echo "glacier-query - Query a package"
|
||||
echo "glacier-cache - Add a package to the cache"
|
||||
echo "glacier-cache-install - Install a cached package"
|
||||
echo "glacier-cache-clear - Clear Glacier's cache"
|
||||
echo ""
|
||||
echo "IMPORTANT REMINDER - Glacier will ask you which package to install, glacier-install <package> will not work."
|
||||
echo ""
|
||||
echo "Glacier - Copyright (C) 2022 Everest Linux"
|
||||
echo "This program comes with ABSOLUTELY NO WARRANTY; for details see section 15 of the GNU GPL v3."
|
||||
echo "This is free software, and you are welcome to redistribute it under certain conditions; see the GNU GPL v3 for details."
|
@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
# glacier-install
|
||||
# Script used to fetch installation scripts and run them
|
||||
|
||||
# Define colors
|
||||
export red="\033[1;31m"
|
||||
export green="\033[1;32m"
|
||||
export yellow="\033[1;33m"
|
||||
export blue="\033[1;34m"
|
||||
export reset="\033[m"
|
||||
|
||||
# Define unicode symbols
|
||||
export check="\xE2\x9C\x93"
|
||||
export error="\xE2\x9C\x95"
|
||||
export warning="\x21"
|
||||
export question="\x3F"
|
||||
|
||||
# Glacier preloading
|
||||
|
||||
source /etc/glacier.conf
|
||||
|
||||
# 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."
|
||||
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... " && wget $GREPO1/$input.tar.gz -q --show-progress || wget $GREPO2/$input.tar.gz -q --show-progress || wget $GREPO3/$input.tar.gz -q --show-progress || wget $GREPO4/$input.tar.gz -q --show-progress || wget $GREPO5/$input.tar.gz -q --show-progress || wget $GREPO6/$input.tar.gz -q --show-progress || wget $GREPO7/$input.tar.gz -q --show-progress || wget $GREPO8/$input.tar.gz -q --show-progress
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "\033[1;31m [ \xE2\x9C\x95 ] \033[m Package not found. " 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 [ \xE2\x9C\x95 ] \033[m Could not unpack $input.tar.gz. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
chmod +x INSTALL.sh
|
||||
chmod +x $input.ts.sh
|
||||
printf "\033[1;34m [ i ] \033[m Executing installation instructions...\n"
|
||||
./INSTALL.sh # Actually executes installation script
|
||||
./$input.ts.sh
|
||||
printf "\033[1;34m [ i ] \033[m Cleaning up...\n" # Status message
|
||||
mv $input-pkginfo.json /etc/glacier/pkginfo
|
||||
cd ..
|
||||
rm -rf $input
|
||||
printf "\033[1;32m [ \xE2\x9C\x93 ] \033[m Operation completed.\n"
|
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
# glacier-query
|
||||
# Script used to query packages on the system
|
||||
|
||||
# Glacier preloading
|
||||
|
||||
source /etc/glacier.conf
|
||||
|
||||
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. " 1>&2
|
||||
exit 1
|
||||
fi
|
@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
# glacier-remove
|
||||
# Script used to uninstall packages
|
||||
|
||||
# Define colors
|
||||
export red="\033[1;31m"
|
||||
export green="\033[1;32m"
|
||||
export yellow="\033[1;33m"
|
||||
export blue="\033[1;34m"
|
||||
export reset="\033[m"
|
||||
|
||||
# Define unicode symbols
|
||||
export check="\xE2\x9C\x93"
|
||||
export error="\xE2\x9C\x95"
|
||||
export warning="\x21"
|
||||
export question="\x3F"
|
||||
|
||||
# Glacier preloading
|
||||
|
||||
source /etc/glacier.conf
|
||||
|
||||
# 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."
|
||||
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... " && wget $GREPO1/$input.tar.gz -q --show-progress || wget $GREPO2/$input.tar.gz -q --show-progress || wget $GREPO3/$input.tar.gz -q --show-progress || wget $GREPO4/$input.tar.gz -q --show-progress || wget $GREPO5/$input.tar.gz -q --show-progress || wget $GREPO6/$input.tar.gz -q --show-progress || wget $GREPO7/$input.tar.gz -q --show-progress || wget $GREPO8/$input.tar.gz -q --show-progress
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "\033[1;31m [ $error ] \033[m Package not found. " 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. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
chmod +x REMOVE.sh
|
||||
./REMOVE.sh
|
||||
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"
|
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
# glacier-update
|
||||
# Script used to update packages
|
||||
|
||||
# Glacier preloading
|
||||
|
||||
source /etc/glacier.conf
|
||||
|
||||
# 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."
|
||||
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... " && wget $GREPO1/$input.tar.gz -q --show-progress || wget $GREPO2/$input.tar.gz -q --show-progress || wget $GREPO3/$input.tar.gz -q --show-progress || wget $GREPO4/$input.tar.gz -q --show-progress || wget $GREPO5/$input.tar.gz -q --show-progress || wget $GREPO6/$input.tar.gz -q --show-progress || wget $GREPO7/$input.tar.gz -q --show-progress || wget $GREPO8/$input.tar.gz -q --show-progress
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "\033[1;31m [ $error ] \033[m Package not found. " 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. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
rm /var/log/glacier/$input.timestamp
|
||||
chmod +x UPDATE.sh
|
||||
chmod +x $input.ts.sh
|
||||
./UPDATE.sh
|
||||
./$input.ts.sh
|
||||
printf "\033[1;34m [ i ] \033[m Cleaning up...\n"
|
||||
mv $input-pkginfo.json /etc/glacier/pkginfo
|
||||
mv $input.timestamp /var/log/glacier
|
||||
cd ..
|
||||
rm -rf $input
|
||||
printf "\033[1;32m [ $check ] \033[m Operation completed.\n"
|
490
src/glacier
Executable file
490
src/glacier
Executable file
@ -0,0 +1,490 @@
|
||||
#!/bin/sh
|
||||
# Glacier - manage installed packages on a Linux system
|
||||
#
|
||||
# This file is part of Glacier.
|
||||
#
|
||||
# Glacier 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.
|
||||
#
|
||||
# Glacier 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 Glacier. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
. /etc/glacier/hooks
|
||||
|
||||
get_pkg() {
|
||||
printf "$blue[ i ]$reset Downloading archive for package '$2'...\n"
|
||||
for r in ${ALLOWED_REPOS[@]}; do
|
||||
$GLACIER_DOWNLOAD_BACKEND $GREPO/${r}/$2.tar.gz
|
||||
done
|
||||
find $2.tar.gz
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red[ $error ]$reset Package '$2' not found.\n"
|
||||
exit 1
|
||||
fi
|
||||
printf "$blue[ i ]$reset Downloading checksum for package '$2'...\n"
|
||||
for r in ${ALLOWED_REPOS[@]}; do
|
||||
$GLACIER_DOWNLOAD_BACKEND $GREPO/${r}/$2.checksum
|
||||
done
|
||||
find $2.checksum
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red[ $error ]$reset Package checksum not found.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
int_check() {
|
||||
if [ "$GLACIER_DO_INT_CHECK" = "true" ]; then
|
||||
printf "$blue[ i ]$reset Checking package integrity...\n"
|
||||
mv *.checksum local_sum
|
||||
sha256sum *.tar.gz > pkg_sum
|
||||
/usr/bin/glacier-integrity-check local_sum pkg_sum
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red[ $error ]$reset Integrity check failed.\n"
|
||||
exit 1
|
||||
fi
|
||||
printf "$green[ $check ]$reset Integrity check passed.\n"
|
||||
else
|
||||
printf "$yellow[ ! ]$reset Skipping integrity check...\n"
|
||||
fi
|
||||
}
|
||||
|
||||
unpack_pkg() {
|
||||
printf "$blue[ i ]$reset Unpacking $2.tar.gz...\n"
|
||||
mkdir $2 && mv $2.tar.gz $2 && cd $2
|
||||
pv $2.tar.gz | tar -xz
|
||||
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 *
|
||||
/etc/glacier/pkginfo/$2.remove
|
||||
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 -rvf *
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red[ $error ]$reset Some items could not be cleared.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Show Glacier debugging info
|
||||
#
|
||||
|
||||
debug_info() {
|
||||
printf "$blue>> Glacier v3.3.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"
|
||||
}
|
||||
|
||||
#
|
||||
# Parses JSON from pkginfo files and outputs it
|
||||
#
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#
|
||||
# Will either keep removal script, update it with a new one, or delete it alltogether
|
||||
#
|
||||
|
||||
cleanup_keep_rm () {
|
||||
printf "$blue[ i ]$reset Cleaning up...\n"
|
||||
mv REMOVE.sh /etc/glacier/pkginfo/$2.remove
|
||||
cd .. && rm -rf *.checksum *.tar.* $2
|
||||
}
|
||||
|
||||
cleanup_update_rm () {
|
||||
printf "$blue[ i ]$reset Cleaning up...\n"
|
||||
rm /etc/glacier/pkginfo/$2.remove
|
||||
mv REMOVE.sh /etc/glacier/pkginfo/$2.remove
|
||||
cd .. && rm -rf *.checksum *.tar.* $2
|
||||
}
|
||||
|
||||
cleanup_del_rm () {
|
||||
printf "$blue[ i ]$reset Cleaning up...\n"
|
||||
rm /etc/glacier/pkginfo/$2.remove
|
||||
cd .. && rm -rf *.checksum *.tar.* $2
|
||||
}
|
||||
|
||||
#
|
||||
# Execute pre and posr hooks from files
|
||||
#
|
||||
|
||||
pre_hooks() {
|
||||
source /etc/glacier/hooks
|
||||
}
|
||||
|
||||
pre_op_hooks() {
|
||||
printf "$blue[ i ]$reset Executing pre-operation hooks...\n"
|
||||
/etc/glacier/pre-hooks
|
||||
}
|
||||
|
||||
post_hooks() {
|
||||
printf "$blue[ i ]$reset Executing post-operation hooks...\n"
|
||||
/etc/glacier/post-hooks
|
||||
}
|
||||
|
||||
search_for_local_pkg() {
|
||||
printf "$blue[ i ]$reset Searching working directory for package $2...\n"
|
||||
find $2.tar.gz
|
||||
if [ "$?" != 0 ]; then
|
||||
printf "$red[ $error ]$reset Package $2 not found.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
-h|--help)
|
||||
printf "$blue[ * ] Glacier - Manage installed packages on the system$reset\n"
|
||||
printf "usage: glacier [-f] [-u] [-x] [-q] [-c] [-ci] [-cc] [-li] [--debuginfo]\n"
|
||||
printf "\n"
|
||||
printf "$blue=== Information ===$reset\n"
|
||||
printf "glacier {-h/--help} - Show this message and exit\n"
|
||||
printf "glacier {-v/--version} - Show the version and exit\n"
|
||||
printf "\n"
|
||||
printf "$blue=== Operations ===$reset\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 "glacier {-li/local-install} - Install a package from a local directory\n"
|
||||
printf "\n"
|
||||
printf "$blue=== Debugging ===$reset\n"
|
||||
printf "glacier {--debuginfo} - Show debugging information\n"
|
||||
printf "\n"
|
||||
printf "$blue=== Licensing ===$reset\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.3.0${reset}\n"
|
||||
exit 0
|
||||
;;
|
||||
-f|install)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Failed to commit to transaction - permission denied. Are you root?\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
get_pkg "$@"
|
||||
int_check "$@"
|
||||
unpack_pkg "$@"
|
||||
pre_op_hooks "$@"
|
||||
installpkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_keep_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-u|update)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Failed to commit to transaction - permission denied. Are you root?\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
get_pkg "$@"
|
||||
int_check "$@"
|
||||
unpack_pkg "$@"
|
||||
pre_op_hooks "$@"
|
||||
updatepkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_update_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-x|remove)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Failed to commit to transaction - permission denied. Are you root?\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
removepkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_del_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-q|query)
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
query "$@"
|
||||
exit 0
|
||||
;;
|
||||
-c|cache)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Failed to commit to transaction - permission denied. Are you root?\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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 "$@"
|
||||
int_check "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-ci|cache-install)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Failed to commit to transaction - permission denied. Are you root?\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
unpack_pkg "$@"
|
||||
pre_op_hooks "$@"
|
||||
installpkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_keep_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-cc|cache-clear)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Failed to commit to transaction - permission denied. Are you root?\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clear_cache "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
;;
|
||||
-li|local-install)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Failed to commit to transaction - permission denied. Are you root?\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
search_for_local_pkg "$@"
|
||||
|
||||
printf "$blue[ i ]$reset Installing package '$2' from local file.\n"
|
||||
read -p "$(printf "$blue[ ? ]$reset Proceed with this operation? (y/n) ")" -n 1 -r
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
cp $2.tar.gz /opt/glacier/workspace
|
||||
cd /opt/glacier/workspace
|
||||
printf "\n"
|
||||
pre_hooks "$@"
|
||||
unpack_pkg "$@"
|
||||
pre_op_hooks "$@"
|
||||
installpkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_keep_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "$red[ $error ]$reset Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
--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
|
185
src/glacier-mkimg/glacier-mkimg
Executable file
185
src/glacier-mkimg/glacier-mkimg
Executable file
@ -0,0 +1,185 @@
|
||||
#!/bin/sh
|
||||
# glacier-mkimg - Generate a root filesystem image
|
||||
#
|
||||
# This file is part of Glacier.
|
||||
#
|
||||
# Glacier 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.
|
||||
#
|
||||
# Glacier 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 Glacier. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
am_i_root() {
|
||||
printf ">> Checking if user is root...\n"
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf ">> glacier-mkimg must be run as root.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
info() {
|
||||
printf ">> Building root filesystem image with the following settings:\n"
|
||||
printf "Image build location: /opt/everest\n"
|
||||
printf "Packages to be installed:\n"
|
||||
printf " - system-toolchain-bin\n"
|
||||
printf " - busybox-base-bin\n"
|
||||
printf " - glacier-base-bin\n"
|
||||
printf " - make-base-bin\n"
|
||||
}
|
||||
|
||||
init-env() {
|
||||
mkdir -v /opt/everest
|
||||
mkdir -v /opt/everest/{sources,toolchain,targetfs}
|
||||
cd /opt/everest
|
||||
}
|
||||
|
||||
get_skel() {
|
||||
printf ">> Creating directory layout in /opt/everest...\n"
|
||||
ROOT=/opt/everest/targetfs
|
||||
|
||||
mkdir -v $ROOT/{boot,dev,etc,home,mnt,opt,proc,root,srv,sys,tmp,var}
|
||||
mkdir -v $ROOT/usr
|
||||
mkdir -v $ROOT/usr/{bin,sbin,include,lib,lib64,libexec,local,sbin,share,src}
|
||||
mkdir -v $ROOT/var/{cache,lib,local,lock,log,opt,run,spool,tmp,www}
|
||||
mkdir -v $ROOT/var/cache/glacier
|
||||
mkdir -v $ROOT/var/log/glacier
|
||||
mkdir -v $ROOT/etc/glacier
|
||||
mkdir -v $ROOT/etc/glacier/pkginfo
|
||||
ln -sv $ROOT/usr/bin $ROOT/bin
|
||||
ln -sv $ROOT/usr/lib $ROOT/lib
|
||||
lv -sv $ROOT/usr/sbin $ROOT/sbin
|
||||
ln -sv $ROOT/usr/lib64 $ROOT/lib64
|
||||
printf ">> Finished.\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
prepare_for_pkg() {
|
||||
printf ">> Preparing for package installation...\n"
|
||||
glacier -c system-toolchain-bin
|
||||
glacier -c busybox-base-bin
|
||||
glacier -c glacier-base-bin
|
||||
glacier -c make-base-bin
|
||||
printf ">> Done.\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
install_pkg() {
|
||||
printf ">> Installing packages...\n"
|
||||
glacier -ci system-toolchain-bin
|
||||
if [ "$?" != "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
glacier -ci busybox-base-bin
|
||||
if [ "$?" != "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
glacier -ci glacier-base-bin
|
||||
if [ "$?" != "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
glacier -ci make-base-bin
|
||||
if [ "$?" != "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
warn_about_cache() {
|
||||
printf ">> WARNING: The cache was used for installing packages to the target.\n"
|
||||
printf ">> It is recommended to run the following command to clean the cache:\n"
|
||||
printf ">> glacier -cc\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
change_ownership() {
|
||||
printf ">> Ensuring file ownership is correct...\n"
|
||||
chown -Rv root:root /opt/everest/targetfs
|
||||
chgrp -v 13 /opt/everest/targetfs/var/log/lastlog
|
||||
printf ">> Done.\n"
|
||||
}
|
||||
|
||||
create_img() {
|
||||
printf ">> Creating filesystem image...\n"
|
||||
install -dv /opt/everest/build
|
||||
cd /opt/everest/targetfs
|
||||
tar -cvf /opt/everest/build/everestlinux-RELEASE-img.tar *
|
||||
zstd /opt/everest/build/everestlinux-RELEASE-img.tar
|
||||
rm /opt/everest/build/everestlinux-${EVEREST_RELEASE}-img.tar
|
||||
printf ">> Done.\n"
|
||||
}
|
||||
|
||||
finish() {
|
||||
printf ">> Build has finished.\n"
|
||||
printf ">> Filesystem image is located in the following directory:\n"
|
||||
printf ">> /opt/everest/build\n"
|
||||
}
|
||||
|
||||
showhelp_big() {
|
||||
printf "glacier-mkimg - easily compile an Everest Linux image\n"
|
||||
printf "usage - glacier-mkimg [-h] [init] [-t] [-s] [-p] [-o] [-i]\n"
|
||||
printf "\n"
|
||||
printf "glacier-mkimg {init} initialize the environment\n"
|
||||
printf "glacier-mkimg {-s} only download filesystem skeleton\n"
|
||||
printf "glacier-mkimg {-p} only install packages to /opt/everest\n"
|
||||
printf "glacier-mkimg {-o} only change ownership of /opt/everest\n"
|
||||
printf "glacier-mkimg {-i} only create image\n"
|
||||
printf "\n"
|
||||
printf "If no option is passed, glacier-mkimg will perform all tasks\n"
|
||||
printf "glacier-mkimg init must be run before anything else is done\n"
|
||||
printf "\n"
|
||||
printf "This program is free software.\n"
|
||||
printf "See the GNU GPL version 3 for details.\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
case $1 in
|
||||
-h|--help)
|
||||
showhelp_big
|
||||
;;
|
||||
init)
|
||||
am_i_root "$@"
|
||||
init_env "$@"
|
||||
exit 0
|
||||
;;
|
||||
-s)
|
||||
get_skel "$@"
|
||||
exit 0
|
||||
;;
|
||||
-p)
|
||||
prepare_for_pkg "$@"
|
||||
install_pkg "$@"
|
||||
warn_about_cache "$@"
|
||||
exit 0
|
||||
;;
|
||||
-o)
|
||||
change_ownership "$@"
|
||||
exit 0
|
||||
;;
|
||||
-i)
|
||||
create_img "$@"
|
||||
exit 0
|
||||
;;
|
||||
-*)
|
||||
printf "usage: glacier-mkimg [-h] [init] [-s] [-p] [-o] [-i]\n"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
get_skel "$@"
|
||||
prepare_for_pkg "$@"
|
||||
install_pkg "$@"
|
||||
warn_about_cache "$@"
|
||||
change_ownership "$@"
|
||||
create_img "$@"
|
||||
finish
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
printf "usage: glacier-mkimg [-h] [init] [-s] [-p] [-o] [-i]\n"
|
||||
exit 1
|
37
src/glacier.conf
Executable file
37
src/glacier.conf
Executable file
@ -0,0 +1,37 @@
|
||||
# /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
|
||||
#
|
||||
|
||||
# Repository Glacier will download programs from
|
||||
|
||||
export GREPO="https://git.everestlinux.org/EverestLinux/glacier-pkgs/raw/branch/main"
|
||||
export ALLOWED_REPOS=("world" "galaxy" "universe" "multiverse")
|
||||
|
||||
# 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"
|
||||
|
||||
# Enable/disable package integrity checking
|
||||
# WARNING: Keeping this enabled is strongly recommended.
|
||||
# This option ensures all packages from the repositories are genuine.
|
||||
|
||||
export GLACIER_DO_INT_CHECK="true"
|
||||
|
||||
#
|
||||
# end /etc/glacier.conf
|
||||
#
|
||||
|
430
src/glacier.test
Executable file
430
src/glacier.test
Executable file
@ -0,0 +1,430 @@
|
||||
#!/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 $(pwd)/glacier.conf
|
||||
|
||||
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
|
||||
$GLACIER_DOWNLOAD_BACKEND $GREPO1/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO2/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO3/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO4/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO5/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO6/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO7/$2.checksum || $GLACIER_DOWNLOAD_BACKEND $GREPO8/$2.tar.gz
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red[ $error ]$reset Package checksum not found.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
int_check() {
|
||||
if [ "$GLACIER_DO_INT_CHECK" = "true" ]; then
|
||||
printf "$blue[ i ]$reset Checking package integrity...\n"
|
||||
/usr/bin/glacier-integrity-check
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red[ $error ]$reset Integrity check failed.\n"
|
||||
exit 1
|
||||
fi
|
||||
printf "$green[ $check ]$reset Integrity check passed.\n"
|
||||
else
|
||||
printf "$yellow[ ! ]$reset Skipping integrity check...\n"
|
||||
fi
|
||||
}
|
||||
|
||||
unpack_pkg() {
|
||||
printf "$blue[ i ]$reset Unpacking $2.tar.gz...\n"
|
||||
mkdir $2 && mv $2.tar.gz $2 && cd $2
|
||||
tar -xf $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 *
|
||||
/etc/glacier/pkginfo/$2.remove
|
||||
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 -rvf *
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "$red[ $error ]$reset Some items could not be cleared.\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Show Glacier debugging info
|
||||
#
|
||||
|
||||
debug_info() {
|
||||
printf "$blue>> Glacier v3.2.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"
|
||||
}
|
||||
|
||||
#
|
||||
# Parses JSON from pkginfo files and outputs it
|
||||
#
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#
|
||||
# Will either keep removal script, update it with a new one, or delete it alltogether
|
||||
#
|
||||
|
||||
cleanup_keep_rm () {
|
||||
printf "$blue[ i ]$reset Cleaning up...\n"
|
||||
mv REMOVE.sh /etc/glacier/pkginfo/$2.remove
|
||||
cd .. && rm -rf *.checksum *.tar.* $2
|
||||
}
|
||||
|
||||
cleanup_update_rm () {
|
||||
printf "$blue[ i ]$reset Cleaning up...\n"
|
||||
rm /etc/glacier/pkginfo/$2.remove
|
||||
mv REMOVE.sh /etc/glacier/pkginfo/$2.remove
|
||||
cd .. && rm -rf *.checksum *.tar.* $2
|
||||
}
|
||||
|
||||
cleanup_del_rm () {
|
||||
printf "$blue[ i ]$reset Cleaning up...\n"
|
||||
rm /etc/glacier/pkginfo/$2.remove
|
||||
cd .. && rm -rf *.checksum *.tar.* $2
|
||||
}
|
||||
|
||||
#
|
||||
# Execute pre and posr hooks from files
|
||||
#
|
||||
|
||||
pre_hooks() {
|
||||
source /etc/glacier/hooks
|
||||
}
|
||||
|
||||
pre_op_hooks() {
|
||||
printf "$blue[ i ]$reset Executing pre-operation hooks...\n"
|
||||
/etc/glacier/pre-hooks
|
||||
}
|
||||
|
||||
post_hooks () {
|
||||
printf "$blue[ i ]$reset Executing post-operation hooks...\n"
|
||||
/etc/glacier/post-hooks
|
||||
}
|
||||
|
||||
case $1 in
|
||||
-h|--help)
|
||||
printf "$blue[ * ] Glacier - Manage installed packages on the system$reset\n"
|
||||
printf "usage: glacier [-f] [-u] [-x] [-q] [-c] [-ci] [-cc] [--debuginfo]\n"
|
||||
printf "\n"
|
||||
printf "$blue=== Information ===$reset\n"
|
||||
printf "glacier {-h/--help} - Show this message and exit\n"
|
||||
printf "glacier {-v/--version} - Show the version and exit\n"
|
||||
printf "\n"
|
||||
printf "$blue=== Operations ===$reset\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 "$blue=== Debugging ===$reset\n"
|
||||
printf "glacier {--debuginfo} - Show debugging information\n"
|
||||
printf "\n"
|
||||
printf "$blue=== Licensing ===$reset\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.2.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
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
get_pkg "$@"
|
||||
int_check "$@"
|
||||
unpack_pkg "$@"
|
||||
pre_op_hooks "$@"
|
||||
installpkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_keep_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-u|update)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Please run Glacier as root.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
get_pkg "$@"
|
||||
int_check "$@"
|
||||
unpack_pkg "$@"
|
||||
pre_op_hooks "$@"
|
||||
updatepkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_update_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-x|remove)
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
printf "$red[ $error ]$reset Please run Glacier as root.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
removepkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_del_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
-q|query)
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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 "$@"
|
||||
int_check "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
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
|
||||
|
||||
if [ "$2" == "" ]; then
|
||||
printf "$red[ $error ]$reset No package name was supplied.\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"
|
||||
pre_hooks "$@"
|
||||
unpack_pkg "$@"
|
||||
pre_op_hooks "$@"
|
||||
installpkg "$@"
|
||||
post_hooks "$@"
|
||||
cleanup_keep_rm "$@"
|
||||
printf "$green[ $check ]$reset Operation completed.\n"
|
||||
exit 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
printf "\n"
|
||||
printf "${red}[ $error ]${reset} Aborting.\n"
|
||||
exit 1
|
||||
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
|
5
src/hooks
Executable file
5
src/hooks
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Glacier Preloading Hooks
|
||||
|
||||
source /etc/make.conf
|
||||
source /etc/glacier.conf
|
10
src/hooks.sh
Executable file
10
src/hooks.sh
Executable 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
|
||||
|
72
src/int-check/main.c
Normal file
72
src/int-check/main.c
Normal file
@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2022-2023 Everest Linux Developers
|
||||
|
||||
This file is part Glacier.
|
||||
|
||||
Glacier 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.
|
||||
|
||||
Glacier 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 Glacier. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include<string.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *fp1;
|
||||
FILE *fp2;
|
||||
|
||||
int cnt1 = 0;
|
||||
int cnt2 = 0;
|
||||
int flg = 0;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("not enough arguments\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fp1 = fopen(argv[1],"r");
|
||||
if (fp1 == NULL) {
|
||||
printf("\n%s cannot open file \n",argv[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fseek(fp1,0,SEEK_END);
|
||||
cnt1 = ftell(fp1);
|
||||
|
||||
fp2 = fopen(argv[2],"r");
|
||||
if (fp2 == NULL) {
|
||||
printf("\n%s cannot open file \n",argv[2]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fseek(fp2,0,SEEK_END);
|
||||
cnt2 = ftell(fp2);
|
||||
|
||||
fseek(fp1,0,SEEK_SET);
|
||||
fseek(fp2,0,SEEK_SET);
|
||||
|
||||
if (cnt1 != cnt2) {
|
||||
return 1;
|
||||
} else {
|
||||
while ( ! feof(fp1)) {
|
||||
if (fgetc(fp1) != fgetc(fp2)) {
|
||||
flg = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flg) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
fclose(fp1);
|
||||
fclose(fp2);
|
||||
|
||||
return 0;
|
||||
}
|
40
src/make.conf
Executable file
40
src/make.conf
Executable 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
|
||||
#
|
5
src/post-hooks
Executable file
5
src/post-hooks
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Glacier post-operation hooks
|
||||
|
||||
printf "No hooks to be executed.\n"
|
||||
exit 1
|
5
src/pre-hooks
Executable file
5
src/pre-hooks
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Hooks to be executed before performing an operation on a package
|
||||
|
||||
printf "No hooks to be executed.\n"
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user