From b2d646c84ac0b23221f5589c911eb3a075ebebac Mon Sep 17 00:00:00 2001 From: Liam Waldron Date: Fri, 17 Feb 2023 17:01:06 -0500 Subject: [PATCH] 2/17/23 --- src/bin/glacier-mkprofile | 74 +++++++++++++++++++++++++++++++++++++++ src/{ => bin}/glist | 0 src/{ => bin}/gpkg | 2 +- src/{ => bin}/gquery | 0 src/{ => bin}/syspkg | 0 src/etc/glacier.conf | 18 ++++++++++ 6 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 src/bin/glacier-mkprofile rename src/{ => bin}/glist (100%) rename src/{ => bin}/gpkg (99%) rename src/{ => bin}/gquery (100%) rename src/{ => bin}/syspkg (100%) create mode 100644 src/etc/glacier.conf diff --git a/src/bin/glacier-mkprofile b/src/bin/glacier-mkprofile new file mode 100755 index 0000000..37f89bc --- /dev/null +++ b/src/bin/glacier-mkprofile @@ -0,0 +1,74 @@ +#!/bin/sh + +source /etc/glacier.conf + +usage() { + printf "${0} - Update the Glacier system profile\n" + printf "usage: ${0} [-h] [-v] [-l] PROFILE_NAME\n" + printf "\n" + printf "${0} {-h} Show this message\n" + printf "${0} {-v} Show the current version\n" + printf "${0} {-l} List all available system profiles\n" + printf "\n" + printf "This program is free software.\n" + printf "See the GNU GPL version 3 for details.\n" +} + +usage_small() { + printf "usage: ${0} [-h] [-v] [-l] PROFILE_NAME\n" +} + +available_profiles() { + printf "${blue}[i]${reset} Available profiles:\n" + printf "x86-musl\n" + printf "x86-glibc\n" + printf "x86-musl-selinux\n" + printf "x86-glibc-selinux\n" + printf "x86-glibc-systemd\n" + printf "x86-musl-multilib\n" + printf "x86-glibc-multilib\n" +} + +warn() { + printf "${red}[!!!] WARNING:${reset}\n" + printf "Switching the Glacier profile on an already running system\n" + printf "may cause SERIOUS DAMAGE to the system.\n" + printf "Before switching profiles, do the following:\n" + printf "- Change the git branch on /, corresponding to the profile you want to switch to.\n" + printf "(root)# cd /\n" + printf "(root)# git checkout x86-musl\n" + printf "- Pull in changes.\n" + printf "(root)# git pull\n" +} + +mkconfig() { + ROOT_URL="https://git.everestlinux.org/EverestLinux/" + touch /etc/glacier.conf + case ${2} in + x86-musl) + echo "GREPO='${ROOT_URL}/epkgs-x86-musl/raw/branch/main'" >> /etc/glacier.conf + ;; + x86-glibc) + echo "GREPO='${ROOT_URL}/epkgs-x86-glibc/raw/branch/main'" >> /etc/glacier.conf + ;; + x86-musl-selinux) + echo "GREPO='${ROOT_URL}/epkgs-x86-musl-selinux/raw/branch/main'" >> /etc/glacier.conf + ;; + x86-glibc-selinux) + echo "GREPO='${ROOT_URL}/epkgs-x86-glibc-selinux/raw/branch/main'" >> /etc/glacier.conf + ;; + x86-glibc-systemd) + echo "GREPO='${ROOT_URL}/epkgs-x86-glibc-systemd/raw/branch/main'" >> /etc/glacier.conf + ;; + x86-musl-multilib) + echo "GREPO='${ROOT_URL}/epkgs-x86-musl-multilib/raw/branch/main'" >> /etc/glacier.conf + ;; + x86-glibc-multilib) + echo "GREPO='${ROOT_URL}/epkgs-x86-glibc-multilib/raw/branch/main'" >> /etc/glacier.conf + ;; + *) + printf "[x] Invalid profile chosen. See 'glacier-mkprofile -l' to see all available profiles.\n" + exit 1 + ;; + esac +} diff --git a/src/glist b/src/bin/glist similarity index 100% rename from src/glist rename to src/bin/glist diff --git a/src/gpkg b/src/bin/gpkg similarity index 99% rename from src/gpkg rename to src/bin/gpkg index fcb40e2..d03731e 100755 --- a/src/gpkg +++ b/src/bin/gpkg @@ -42,7 +42,7 @@ dload_pkg() { # Store all positional parameters ["${@}"] in an array [pkgs=()] pkgs=("${@}") # if no packages are specified, exit - if [[ $pkgs == "" ]]; then + if [ $pkgs == "" ]; then printf "${red}[${error}]${reset} No package(s) were specified.\n" exit 1 fi diff --git a/src/gquery b/src/bin/gquery similarity index 100% rename from src/gquery rename to src/bin/gquery diff --git a/src/syspkg b/src/bin/syspkg similarity index 100% rename from src/syspkg rename to src/bin/syspkg diff --git a/src/etc/glacier.conf b/src/etc/glacier.conf new file mode 100644 index 0000000..db18c70 --- /dev/null +++ b/src/etc/glacier.conf @@ -0,0 +1,18 @@ +# +# /etc/glacier.conf +# + +# Colors and 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" + +# Command to be used for downloading packages +export GLACIER_DOWNLOAD_BACKEND="wget --quiet --show-progress" + +# Package repository +# WARNING: DO NOT SET OR CHANGE MANUALLY!!!