From e115d7d554e5ae806540d7e52e0f2a78518533d6 Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Mon, 4 Oct 2021 22:54:22 +0200 Subject: [PATCH] One last commit --- aps | 77 +++++++++++++++++++++---------------------------------------- 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/aps b/aps index 5b47d49..5e0819d 100755 --- a/aps +++ b/aps @@ -17,10 +17,17 @@ function conf_fetch(){ . /etc/al/config elif [ -f "/etc/skel/al/config" ]; then . /etc/skel/al/config -#elif [ -f $AL_CFG ]; then -# . $AL_CFG + #elif [ -f $AL_CFG ]; then + # . $AL_CFG 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 } case ${debug} in @@ -52,33 +59,16 @@ function confirm(){ # wrn "This is a debug build, that may not work!" #} function sources(){ - #pkg_config_url=$(cat sources) - #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_url="$1" pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::') - curl -fLO ${pkg_config_url} + 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!" + *.gz) prwork esac mkdir --parents pkgsrc cp -r pkgex/*/* pkgsrc @@ -93,19 +83,6 @@ function sha256(){ err "Sha failed!" 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(){ if [ -x "${2}/${1}" ]; then prn "Running $1" @@ -133,9 +110,9 @@ function pkg_find(){ #esac } function pkg_local(){ - if [ -z "$AL_REPO" ]; then - err "Alnux Repo variable is not set. Will not continue" - fi + #if [ -z "$AL_REPO" ]; then + # err "Alnux Repo variable is not set. Will not continue" + #fi pkg_find $1 cp -prv "${1}" "${temp_location}" @@ -152,15 +129,12 @@ function pkg_local(){ mkdir -p "${pkg_path}/payload" . "${pkg_path}/package" cd "${pkg_path}" - if [ -f *.sources ]; then - sources $(cat sources) - #"$(cat *.sources)" - fi - if [ -f *.sha256sums ]; then - sha256 "*.sha256sum}" - else - wrn "No sums file(s) found! Be careful!" + if [ -f sources ]; then + sources "$(cat ${pkg_path}/sources)" + #"$(cat *.sources)" 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 "predeploy" "${pkg_path}/pkgsrc" # 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..." fi # Old Cleanup, might work - rm -r "${pkg_path}" - rm "${temp_location}/${pkg_name}-payloadfiles" + #rm -r "${pkg_path}" + #rm "${temp_location}/${pkg_name}-payloadfiles" cd "${install_root}" || err "Could not return to main directory. Exiting..." unset pkg_path 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 prn "Installing package(s) ${2} from ${1} repo" - [ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found." pkg_local "${locpkg_database}/${1}/${2}" } + [ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found." update() { prn "Upgrading installed packages" cd "${installed_pkg_database}" || err "Could not enter local installed package database directory. Exiting..." @@ -252,7 +226,7 @@ function main(){ case $1 in s|sync) sync_local_repo_database "${official}" ${official} [ -z "${2}" ] && exit 0 - install_package_from_repo "${official}" "${2}" ;; + install_package_from_repo "${official}" "${@: -1}" ;; #confirm "install" ;; i|install) pkg_local ${*: -1} ;; # confirm "install" ;; @@ -260,6 +234,7 @@ function main(){ # confirm "update" ;; v|version) version ;; h|help) help ;; + #tus|tusync) hwclock --systohc ;; *) err "Invalid option" esac }