One last commit

This commit is contained in:
Ohio2 2021-10-04 22:54:22 +02:00
parent ef4ccbef46
commit e115d7d554
Signed by untrusted user who does not match committer: Ohio2
GPG key ID: 2746D0A9E4F21E80

77
aps
View file

@ -17,10 +17,17 @@ function conf_fetch(){
. /etc/al/config . /etc/al/config
elif [ -f "/etc/skel/al/config" ]; then elif [ -f "/etc/skel/al/config" ]; then
. /etc/skel/al/config . /etc/skel/al/config
#elif [ -f $AL_CFG ]; then #elif [ -f $AL_CFG ]; then
# . $AL_CFG # . $AL_CFG
else else
err "No config file!" wrn "No config file!"
temp_location="/var/tmp"
install_root="/var/tmp/alroot"
installed_pkg_database="${install_root}/var/aps/installed"
locpkg_database="${install_root}/var/aps/repos"
lock="${install_root}/var/aps/lock"
official="https://git.hippoz.xyz/alnux/repo"
debug=off
fi fi
} }
case ${debug} in case ${debug} in
@ -52,33 +59,16 @@ function confirm(){
# wrn "This is a debug build, that may not work!" # wrn "This is a debug build, that may not work!"
#} #}
function sources(){ function sources(){
#pkg_config_url=$(cat sources) pkg_config_url="$1"
#pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::')
#curl -fLO ${pkg_config_url}
#mkdir --parents pkgex
#pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft})
#case $pkg_config_archv_ft in
# *.tar*) prn $(tar -xf ${pkg_config_archv} -C pkgex) ;;
# *.xz) prn $(cd pkgex && xz -d ../${pkg_config_archv} && cd ..) ;;
# *.bz2) prn $(cd pkgex && bzip2 -d ../${pkg_config_archv} && cd ..) ;;
# *.gz) prn $(cd pkgex && gzip -d ../${pkg_config_archv} && cd ..) ;;
# *.zst) prn $(cd pkgex && zstd -dc && cd ..) ;;
# *) wrn "Not a tar! But it will be kept!"
#esac
#mkdir --parents pkgsrc
#cp -r pkgex/*/* pkgsrc
pkg_config_url=$1
pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::') pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::')
curl -fLO ${pkg_config_url} curl -fLO "${pkg_config_url}"
mkdir --parents pkgex mkdir --parents pkgex
pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft}) pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft})
case $pkg_config_archv_ft in case $pkg_config_archv_ft in
*.tar*) prn $(tar -xf ${pkg_config_archv} -C pkgex) ;; *.tar*) prn $(tar -xf ${pkg_config_archv} -C pkgex) ;;
*.xz) prn $(cd pkgex && xz -d ../${pkg_config_archv} && cd ..) ;; *.xz) prn $(cd pkgex && xz -d ../${pkg_config_archv} && cd ..) ;;
*.bz2) prn $(cd pkgex && bzip2 -d ../${pkg_config_archv} && cd ..) ;; *.bz2) prn $(cd pkgex && bzip2 -d ../${pkg_config_archv} && cd ..) ;;
*.gz) prn $(cd pkgex && gzip -d ../${pkg_config_archv} && cd ..) ;; *.gz) prwork
*.zst) prn $(cd pkgex && zstd -dc && cd ..) ;;
*) wrn "Not a tar! But it will be kept!"
esac esac
mkdir --parents pkgsrc mkdir --parents pkgsrc
cp -r pkgex/*/* pkgsrc cp -r pkgex/*/* pkgsrc
@ -93,19 +83,6 @@ function sha256(){
err "Sha failed!" err "Sha failed!"
fi fi
} }
#function md5(){
# sum="$(cat $@/sums)"
# md5sum "$sum"
#}
#function versum(){
# sumrest=$(cat $@/sums | cut -d'+' -f-)
# sumtype=$(cat $@/sums | cut -d'+' -f2)
# case $sumtype in
# sha256) sha256 "$1.sha256sum" ;;
# md5) err "MD5 is not supported." ;;
# esac
#}
function runbuildsh(){ function runbuildsh(){
if [ -x "${2}/${1}" ]; then if [ -x "${2}/${1}" ]; then
prn "Running $1" prn "Running $1"
@ -133,9 +110,9 @@ function pkg_find(){
#esac #esac
} }
function pkg_local(){ function pkg_local(){
if [ -z "$AL_REPO" ]; then #if [ -z "$AL_REPO" ]; then
err "Alnux Repo variable is not set. Will not continue" # err "Alnux Repo variable is not set. Will not continue"
fi #fi
pkg_find $1 pkg_find $1
cp -prv "${1}" "${temp_location}" cp -prv "${1}" "${temp_location}"
@ -152,15 +129,12 @@ function pkg_local(){
mkdir -p "${pkg_path}/payload" mkdir -p "${pkg_path}/payload"
. "${pkg_path}/package" . "${pkg_path}/package"
cd "${pkg_path}" cd "${pkg_path}"
if [ -f *.sources ]; then if [ -f sources ]; then
sources $(cat sources) sources "$(cat ${pkg_path}/sources)"
#"$(cat *.sources)" #"$(cat *.sources)"
fi
if [ -f *.sha256sums ]; then
sha256 "*.sha256sum}"
else
wrn "No sums file(s) found! Be careful!"
fi fi
# for SOURCES in *.sources; do sources "$(cat $SOURCES)"; done
for SHASUM in *.sha256sum; do sha256 "$(cat $SHASUM)"; done
runbuildsh "build" "${pkg_path}/pkgsrc" runbuildsh "build" "${pkg_path}/pkgsrc"
runbuildsh "predeploy" "${pkg_path}/pkgsrc" runbuildsh "predeploy" "${pkg_path}/pkgsrc"
# Old APS code from before the rewrite! # Old APS code from before the rewrite!
@ -182,8 +156,8 @@ function pkg_local(){
err "Target ${pkg_name} does not have a package script (it's an invalid package!). Exiting..." err "Target ${pkg_name} does not have a package script (it's an invalid package!). Exiting..."
fi fi
# Old Cleanup, might work # Old Cleanup, might work
rm -r "${pkg_path}" #rm -r "${pkg_path}"
rm "${temp_location}/${pkg_name}-payloadfiles" #rm "${temp_location}/${pkg_name}-payloadfiles"
cd "${install_root}" || err "Could not return to main directory. Exiting..." cd "${install_root}" || err "Could not return to main directory. Exiting..."
unset pkg_path unset pkg_path
unset pkg_name unset pkg_name
@ -209,9 +183,9 @@ sync_local_repo_database() {
} }
install_package_from_repo() { # NOTE(hippoz): This can get a tad confusing... ${1} is the repo and ${2} is the package install_package_from_repo() { # NOTE(hippoz): This can get a tad confusing... ${1} is the repo and ${2} is the package
prn "Installing package(s) ${2} from ${1} repo" prn "Installing package(s) ${2} from ${1} repo"
[ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found."
pkg_local "${locpkg_database}/${1}/${2}" pkg_local "${locpkg_database}/${1}/${2}"
} }
[ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found."
update() { update() {
prn "Upgrading installed packages" prn "Upgrading installed packages"
cd "${installed_pkg_database}" || err "Could not enter local installed package database directory. Exiting..." cd "${installed_pkg_database}" || err "Could not enter local installed package database directory. Exiting..."
@ -252,7 +226,7 @@ function main(){
case $1 in case $1 in
s|sync) sync_local_repo_database "${official}" ${official} s|sync) sync_local_repo_database "${official}" ${official}
[ -z "${2}" ] && exit 0 [ -z "${2}" ] && exit 0
install_package_from_repo "${official}" "${2}" ;; install_package_from_repo "${official}" "${@: -1}" ;;
#confirm "install" ;; #confirm "install" ;;
i|install) pkg_local ${*: -1} ;; i|install) pkg_local ${*: -1} ;;
# confirm "install" ;; # confirm "install" ;;
@ -260,6 +234,7 @@ function main(){
# confirm "update" ;; # confirm "update" ;;
v|version) version ;; v|version) version ;;
h|help) help ;; h|help) help ;;
#tus|tusync) hwclock --systohc ;;
*) err "Invalid option" *) err "Invalid option"
esac esac
} }