diff --git a/install/Makefile b/install/Makefile
index 819fd92..8deab88 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -4,15 +4,15 @@ all:
@echo Run \'make install\'.
install:
- mkdir -p $(DESTDIR)/etc/glacier
- mkdir -p $(DESTDIR)/usr/glacier
- mkdir -p $(DESTDIR)/usr/glacier/index
- install ../src/bin/gpkg $(DESTDIR)/usr/bin
- install ../src/bin/gquery $(DESTDIR)/usr/bin
- install ../src/bin/syspkg $(DESTDIR)/usr/bin
- install ../src/bin/gpc $(DESTDIR)/usr/bin
- install ../src/bin/glist $(DESTDIR)/usr/bin
- install ../src/bin/glacier-mkprofile $(DESTDIR)/usr/bin
- install ../src/etc/glacier.conf /etc
- install ../src/etc/make.conf /etc
- install ../src/etc/call-hooks /etc/glacier
+ mkdir -p $(PREFIX)/etc/glacier
+ mkdir -p $(PREFIX)/usr/glacier
+ mkdir -p $(PREFIX)/usr/glacier/index
+ install ../src/bin/gpkg $(PREFIX)/usr/bin
+ install ../src/bin/gquery $(PREFIX)/usr/bin
+ install ../src/bin/syspkg $(PREFIX)/usr/bin
+ install ../src/bin/gpc $(PREFIX)/usr/bin
+ install ../src/bin/glist $(PREFIX)/usr/bin
+ install ../src/bin/glacier-mkprofile $(PREFIX)/usr/bin
+ install ../src/etc/glacier.conf $(PREFIX)/etc
+ install ../src/etc/make.conf $(PREFIX)/etc
+ install ../src/etc/call-hooks $(PREFIX)/etc/glacier
diff --git a/install/config.mk b/install/config.mk
index 716b138..b1c9975 100644
--- a/install/config.mk
+++ b/install/config.mk
@@ -1 +1 @@
-PREFIX = /usr
+PREFIX = /home/arco/Projects/glacier4/testing
diff --git a/src/bin/glacier-mkprofile b/src/bin/glacier-mkprofile
index cfe6c2c..7c3802d 100755
--- a/src/bin/glacier-mkprofile
+++ b/src/bin/glacier-mkprofile
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/bin/bash
# glacier-mkprofile - update the Glacier system profile
# This file is part of Glacier.
@@ -18,6 +18,14 @@
# You should have received a copy of the GNU General Public License
# along with Glacier. If not, see .
+#
+# Meaning of different positional parameters:
+# ${0} - Program name
+# ${1} - flag passed to program (ie. -h, -v, etc)
+# ${2} - selected system profile
+# ${3} - directory to update profile in
+#
+
source /etc/glacier.conf
usage() {
@@ -36,6 +44,27 @@ usage_small() {
printf "usage: ${0} [-h] [-v] [-l] PROFILE_NAME\n"
}
+check_if_option_is_blank() {
+ if [ "${1}" == "" ]; then
+ printf "[x] No option specified. See '${0} -h for a list of options.\n"
+ exit 1
+ fi
+}
+
+check_if_profile_is_blank() {
+ if [ "${2}" == "" ]; then
+ printf "[x] Profile cannot be blank. See ${0} -l for a list of profiles.\n"
+ exit 1
+ fi
+}
+
+check_if_dir_is_blank() {
+ if [ "${3}" == "" ]; then
+ printf "[x] Directory cannot be blank.\n"
+ exit 1
+ fi
+}
+
available_profiles() {
printf "${blue}[i]${reset} Available profiles:\n"
printf "x86-musl\n"
@@ -84,7 +113,7 @@ glacier_conf() {
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"
+ printf "[x] Invalid or incompatible profile chosen. See 'glacier-mkprofile -l' to see all available profiles.\n"
exit 1
;;
esac
@@ -139,7 +168,39 @@ glacier_profile_conf() {
echo "GLACIER_SYSTEM_PROFILE='x86-glibc-multilib'" >> /etc/glacier/profile.conf
;;
*)
- printf "[x] Invalid profile chosen. See 'glacier-mkprofile -l' to see all available profiles.\n"
+ printf "[x] Invalid or incompatible profile chosen. See 'glacier-mkprofile -l' to see all available profiles.\n"
+ exit 1
+ ;;
+ esac
+}
+
+glacier_pkg_index() {
+ ROOT_URL="https://git.everestlinux.org/EverestLinux"
+ cd ${3}/usr/glacier
+ case ${2} in
+ x86-musl)
+ git clone ${ROOT_URL}/epkgs-x86-musl
+ ;;
+ x86-glibc)
+ git clone ${ROOT_URL}/epkgs-x86-glibc
+ ;;
+ x86-musl-selinux)
+ git clone ${ROOT_URL}/epkgs-x86-musl-selinux
+ ;;
+ x86-glibc-selinux)
+ git clone ${ROOT_URL}/epkgs-x86-glibc-selinux
+ ;;
+ x86-glibc-systemd)
+ git clone ${ROOT_URL}/epkgs-x86-glibc-systemd
+ ;;
+ x86-musl-multilib)
+ git clone ${ROOT_URL}/epkgs-x86-musl-multilib
+ ;;
+ x86-glibc-multilib)
+ git clone ${ROOT_URL}/epkgs-x86-glibc-multilib
+ ;;
+ *)
+ printf "[x] Invalid or incompatible profile chosen. See 'glacier-mkprofile -l' to see all available profiles.\n"
exit 1
;;
esac
diff --git a/src/bin/glacier-update-pkgdb b/src/bin/glacier-update-pkgdb
new file mode 100755
index 0000000..1a33e0a
--- /dev/null
+++ b/src/bin/glacier-update-pkgdb
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# glacier-update-pkgdb - update glacier package database
+# This file is part of Glacier.
+#
+# Copyright (C) 2023 Everest Linux
+#
+# 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 .
+
+if [ -f "/etc/glacier/profile.conf" ]; then
+ source /etc/glacier/profile.conf
+elif [ ! -f "/etc/glacier/profile.conf" ]; then
+ printf "\033[1;31m[x]\033[m /etc/glacier/profile.conf does not exist.\n"
+ exit 1
+fi
+ROOT_URL="https://git.everestlinux.org/EverestLinux"
+
+update_pkgdb() {
+ MV_TO_DB="cd /usr/glacier/epkgs"
+ ${MV_TO_DB}-${GLACIER_SYSTEM_PROFILE}
+ if [ "$?" != 0 ]; then
+ printf "\033[1;31m[x]\033[m Package database does not exist.\n"
+ exit 1
+ fi
+ git pull
+ if [ "$?" != 0 ]; then
+ printf "\033[1;31m[x]\033[m Error while updating database.\n"
+ exit 1
+ fi
+}
+
+print_info() {
+ printf "\033[1;34m[i]\033[m Using profile settings:\n"
+ printf "System profile: ${GLACIER_SYSTEM_PROFILE}\n"
+}
+
+printf "\033[1;34m[i]\033[m Updating Glacier package database...\n"
+print_info "$@"
+update_pkgdb "$@"
diff --git a/src/bin/glacierg b/src/bin/glacierg
new file mode 100755
index 0000000..18aae66
--- /dev/null
+++ b/src/bin/glacierg
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# glacierg - TUI for Glacier
+# This file is part of Glacier.
+#
+# Copyright (C) 2023 Everest Linux
+#
+# 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 .
+
+if [ -f "/etc/glacier/call-hooks" ]; then
+ source /etc/glacier/call-hooks
+elif [ ! -f "/etc/glacier/call-hooks" ]; then
+ dialog --msgbox "/etc/glacier/call-hooks does not exist." 6 40
+ printf "\e[2J\e[H"
+ exit 1
+fi
+
+
diff --git a/src/bin/glist b/src/bin/glist
index 787e775..6fc63fa 100755
--- a/src/bin/glist
+++ b/src/bin/glist
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/bin/bash
# glist - list packages from a package index
# This file is part of Glacier.
diff --git a/src/bin/gpc b/src/bin/gpc
index beb78b3..2c72275 100755
--- a/src/bin/gpc
+++ b/src/bin/gpc
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/bin/bash
# gpc - Check integrity of Glacier packages
# This file is part of Glacier.
@@ -19,6 +19,7 @@
# along with Glacier. If not, see .
red="\033[1;31m"
+yellow="\033[1;33m"
green="\033[1;32m"
blue="\033[1;34m"
reset="\033[m"
@@ -33,16 +34,16 @@ check_if_vars_exist() {
VAR_FAILED=0
printf "${blue}[i]${reset} Checking variables...\n"
- sleep 0.5
+ sleep 0.05
for m in ${MVARS[@]}; do
if [ ! -v $m ]; then
printf "${red}[x]${reset} Variable $m does not exist.\n"
VAR_FAILED=$((VAR_FAILED+1))
- sleep 0.1
+ sleep 0.02
elif [ -v $m ]; then
printf "${green}[${check}]${reset} Variable $m exists.\n"
- sleep 0.1
+ sleep 0.02
fi
done
@@ -50,10 +51,10 @@ check_if_vars_exist() {
if [ ! -v $f ]; then
printf "${red}[x]${reset} Variable $f does not exist.\n"
VAR_FAILED=$((VAR_FAILED+1))
- sleep 0.1
+ sleep 0.02
elif [ -v $f ]; then
printf "${green}[${check}]${reset} Variable $f exists.\n"
- sleep 0.1
+ sleep 0.02
fi
done
@@ -61,10 +62,10 @@ check_if_vars_exist() {
if [ ! -v $i ]; then
printf "${red}[x]${reset} Variable $i does not exist.\n"
VAR_FAILED=$((VAR_FAILED+1))
- sleep 0.1
+ sleep 0.02
elif [ -v $i ]; then
printf "${green}[${check}]${reset} Variable $i exists.\n"
- sleep 0.1
+ sleep 0.02
fi
done
@@ -72,10 +73,10 @@ check_if_vars_exist() {
if [ ! -v $s ]; then
printf "${red}[x]${reset} Variable $s does not exist.\n"
VAR_FAILED=$((VAR_FAILED+1))
- sleep 0.1
+ sleep 0.02
elif [ -v $s ]; then
printf "${green}[${check}]${reset} Variable $s exists.\n"
- sleep 0.1
+ sleep 0.02
fi
done
}
@@ -88,17 +89,17 @@ check_if_functions_exist() {
FUNCTION_FAILED=0
printf "${blue}[i]${reset} Checking functions...\n"
- sleep 0.5
+ sleep 0.05
for u in ${UNIFUNCTIONS[@]}; do
declare -f -F $u > /dev/null
if [ $? != 0 ]; then
printf "${red}[x]${reset} Function $u does not exist.\n"
FUNCTION_FAILED=$((FUNCTION_FAILED+1))
- sleep 0.1
+ sleep 0.02
else
printf "${green}[${check}]${reset} Function $u exists.\n"
- sleep 0.1
+ sleep 0.02
fi
done
@@ -107,10 +108,10 @@ check_if_functions_exist() {
if [ $? != 0 ]; then
printf "${red}[x]${reset} Function $g does not exist.\n"
FUNCTION_FAILED=$((FUNCTION_FAILED+1))
- sleep 0.1
+ sleep 0.02
else
printf "${green}[${check}]${reset} Function $g exists.\n"
- sleep 0.1
+ sleep 0.02
fi
done
@@ -119,18 +120,49 @@ check_if_functions_exist() {
if [ $? != 0 ]; then
printf "${red}[x]${reset} Function $s does not exist.\n"
FUNCTION_FAILED=$((FUNCTION_FAILED+1))
- sleep 0.1
+ sleep 0.02
else
printf "${green}[${check}]${reset} Function $s exists.\n"
- sleep 0.1
+ sleep 0.02
fi
done
}
+check_syntax_errors() {
+ ERRORS_GENERATED=0
+ WARNINGS_GENERATED=0
+ printf "${blue}[i]${reset} Checking syntax errors...\n"
+ sleep 0.05
+ if [ "${SHA256SUMS}" == "" ]; then
+ printf "${yellow}[!]${reset} Warning @ variable 'SHA256SUMS'\n"
+ printf "${yellow}[!]${reset} No checksum provided.\n"
+ printf "${yellow}[!]${reset} This package will not work when integrity checking is on.\n"
+ WARNINGS_GENERATED=$((WARNINGS_GENERATED+1))
+ sleep 0.02
+ fi
+
+ if [ "${PACKAGE_SRC}" == "" ]; then
+ printf "${red}[x]${reset} error @ variable 'PACKAGE_SRC'\n"
+ printf "${red}[x]${reset} No sources provided.\n"
+ ERRORS_GENERATED=$((ERRORS_GENERATED+1))
+ sleep 0.02
+ fi
+
+ if [ ${ERRORS_GENERATED} == 0 ]; then
+ printf "${green}[${check}]${reset} No errors to report.\n"
+ fi
+
+ if [ ${WARNINGS_GENERATED} == 0 ]; then
+ printf "${green}[${check}]${reset} No warnings to report.\n"
+ fi
+}
+
results() {
printf "${blue}[*]${reset} Results:\n"
- printf "Missing variables: $VAR_FAILED\n"
- printf "Missing functions: $FUNCTION_FAILED\n"
+ printf "${blue}[*]${reset} Missing variables: $VAR_FAILED\n"
+ printf "${blue}[*]${reset} Missing functions: $FUNCTION_FAILED\n"
+ printf "${blue}[*]${reset} Warnings generated: $WARNINGS_GENERATED\n"
+ printf "${blue}[*]${reset} Errors generated: $ERRORS_GENERATED\n"
}
if [ "${1}" == "" ]; then
@@ -144,9 +176,8 @@ if [ ! -f "${1}" ]; then
exit 1
fi
printf "${blue}[*]${reset} Sourcing package file...\n"
-sleep 0.5
source $1
-printf "source ${1}\n"
check_if_vars_exist "$@"
check_if_functions_exist "$@"
+check_syntax_errors "$@"
results "$@"
diff --git a/src/bin/gpkg b/src/bin/gpkg
index c19e6d9..4ff338f 100755
--- a/src/bin/gpkg
+++ b/src/bin/gpkg
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/bin/bash
# gpkg - merge a package into the local package index
# This file is part of Glacier.
@@ -71,16 +71,41 @@ check_if_input_is_blank() {
exit 1
fi
}
+# Deprecated in favor of the new local index
+#dload_pkg() {
+# # Store all positional parameters ["${@}"] in an array [pkgs=()]
+# pkgs=("${@}")
+# # if no packages are specified, exit
+# printf "${blue}[i]${reset} Downloading package(s)...\n"
+# for i in ${pkgs[@]}; do
+# ${GLACIER_DOWNLOAD_BACKEND} ${GREPO}/${i}
+# if [ "$?" != "0" ]; then
+# printf "${red}[${error}]${reset} Could not find package.\n"
+# exit 1
+# fi
+# done
+#}
dload_pkg() {
- # Store all positional parameters ["${@}"] in an array [pkgs=()]
pkgs=("${@}")
- # if no packages are specified, exit
- printf "${blue}[i]${reset} Downloading package(s)...\n"
+ printf "${blue}[i]${reset} Retrieving package from local database...\n"
for i in ${pkgs[@]}; do
- ${GLACIER_DOWNLOAD_BACKEND} ${GREPO}/${i}
- if [ "$?" != "0" ]; then
- printf "${red}[${error}]${reset} Could not find package.\n"
+ cp /usr/glacier/epkgs-${GLACIER_SYSTEM_PROFILE}/${i} /opt/glacier/workspace
+ if [ "$?" != 0 ]; then
+ printf "${red}[${error}]${reset} Error retrieving package ${i}.\n"
+ clean_after_failed "$@"
+ exit 1
+ fi
+ done
+}
+
+mv_pkgs() {
+ pkgs=("${@}")
+ printf "${blue}[i]${reset} Preparing package(s)...\n"
+ for i in ${pkgs[@]}; do
+ cp /usr/glacier/epkgs-${GLACIER_SYSTEM_PROFILE}/${i} /opt/glacier/workspace
+ if [ "$?" != 0 ]; then
+ printf "${red}[${error}]${reset} Error moving package.\n"
exit 1
fi
done
@@ -120,12 +145,41 @@ install_pkg() {
done
}
+install_pkg_local() {
+ pkgs=("${@}")
+ if [ -f ${pkgs[@]} ]; then
+ cp ${pkgs[@]} /opt/glacier/workspace
+ else
+ printf "${red}[${error}]${reset} Package does not exist.\n"
+ exit 1
+ fi
+ for i in /opt/glacier/workspace; do
+ source ${i}
+ buildpkg
+ installpkg
+ done
+}
+
update_pkg() {
pkgs=("${@}")
+ if [ "${pkgs}" == "" ]; then
+ update_system "$@"
+ else
+ for i in /opt/glacier/workspace/*; do
+ source ${i}
+ updatepkg
+ done
+ fi
+}
+
+update_system() {
+ cp /glacier/index/* /opt/glacier/workspace
for i in /opt/glacier/workspace/*; do
- source ${i}
+ source ${i}
updatepkg
done
+ rm /glacier/index/*
+ cp /opt/glacier/workspace/* /glacier/index
}
remove_pkg() {
diff --git a/src/bin/gquery b/src/bin/gquery
index 0604599..0b0d850 100755
--- a/src/bin/gquery
+++ b/src/bin/gquery
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/bin/bash
# gquery - query a package's information
# This file is part of Glacier.
diff --git a/src/bin/syspkg b/src/bin/syspkg
index f4ca3fd..496d2c7 100755
--- a/src/bin/syspkg
+++ b/src/bin/syspkg
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/bin/bash
# syspkg - merge a package into the system package index
# This file is part of Glacier.