snapshot 30.09.2021

This commit is contained in:
Ohio2 2021-09-30 19:35:13 +02:00
parent 46de0ea716
commit 28b70404cb

114
aps
View file

@ -30,18 +30,30 @@ function err(){
function notf(){ function notf(){
echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1" echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1"
} }
function confirm(){
prn "To install, press ENTER, to cancel, press CTRL+C (unix process break key)"
}
function dbg(){ function dbg(){
wrn "This is a debug build, that may not work!" wrn "This is a debug build, that may not work!"
} }
function sources(){ function sources(){
if [ -f sources ]; then if [ -f sources ]; then
pkg_config_url=$(getopt -o hf:gb -1 help,file:,sources) pkg_config_url=$(cat sources)
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
tar -xvf ${pkg_config_archv} -C 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 mkdir --parents pkgsrc
cp -r pkgex/*/* pkgsrc cp -r pkgex/*/* pkgsrc
else else
err "Sources not found, exiting!" err "Sources not found, exiting!"
fi fi
@ -74,22 +86,22 @@ function pkg_find(){
} }
function pkg_local(){ function pkg_local(){
if [ -z "$AL_REPO" ]; then if [ -z "$AL_REPO" ]; then
wrn "Alnux Repo variable is not set, setting to /var/db/repo/core!" #wrn "Alnux Repo variable is not set, setting to /var/db/repo/core!"
prn "To set the Alnux Repo var, either:" #prn "To set the Alnux Repo var, either:"
prn " edit /etc/profile or your shell's profile to include your repo and sub-repos, " #prn " edit /etc/profile or your shell's profile to include your repo and sub-repos, "
prn " much like this: export AL_REPO=/var/db/repo/core:/var/db/repo/extra OR" #prn " much like this: export AL_REPO=/var/db/repo/core:/var/db/repo/extra OR"
prn " export Alnux Repo var like this: export AL_REPO=/var/db/repo/core:/var/db/repo/extra" #prn " export Alnux Repo var like this: export AL_REPO=/var/db/repo/core:/var/db/repo/extra"
export AL_REPO="/var/aps/repos/official/core" #export AL_REPO="/var/aps/repos/official/core"
notf "AL_REPO set to /var/db/repo/core" #notf "AL_REPO set to /var/db/repo/core"
prn "Verifying if AL_REPO is set..." #prn "Verifying if AL_REPO is set..."
if [ -z $AL_REPO ]; then #if [ -z $AL_REPO ]; then
err "AL_REPO is not set." # err "AL_REPO is not set."
else #else
prn "$(echo $AL_REPO)... yes." # prn "$(echo $AL_REPO)... yes."
#fi
err "Alnux Repo variable is not set. Will not continue"
fi fi
pkg_find $1
fi
pkg_find $@
cp -prv "${1}" "${temp_location}" cp -prv "${1}" "${temp_location}"
# - - - - - # # - - - - - #
@ -98,21 +110,61 @@ function pkg_local(){
pkg_name="${1%/}" pkg_name="${1%/}"
pkg_name="${pkg_name##*/}" pkg_name="${pkg_name##*/}"
pkg_name=$(echo "${pkg_name}" | cut -f 1 -d '.') pkg_name=$(echo "${pkg_name}" | cut -f 1 -d '.')
# - - - - - - -# pkg_path="${temp_location}/${pkg_name}"
# PKG CONFIG # # - - #
# - - - - - - -# # #
pkg_config_deploy=true # - - #
pkg_config_ver="0" mkdir -p "${pkg_path}/payload"
pkg_config_makedepends="" . "${pkg_path}/package"
pkg_config_depends="" cd "${pkg_path}"
sources
runbuildsh "build" "${pkg_path}"
runbuildsh "predeploy" "${pkg_path}"
# Old APS code from before the rewrite!
# Deploy package
if [ "${pkg_config_deploy}" = true ]; then
echo ":: Deploying target ${pkg_name}..."
cp -rpv "${pkg_path}/payload"/* "${install_root}" > "${temp_location}/${pkg_name}-payloaddeploylog"
sed 's/^.*-> //' "${temp_location}/${pkg_name}-payloaddeploylog" | tr -d \'\" > "${temp_location}/${pkg_name}-payloadfiles"
rm "${temp_location}/${pkg_name}-payloaddeploylog"
fi
runbuildsh "postdeploy" "${pkg_path}"
# Yet more old APS code
if [ -x "${pkg_path}/package" ]; then
echo ":: Adding target ${pkg_name} to installed package database..."
[ ! -d "${installed_pkg_database}/${pkg_name}" ] && mkdir "${installed_pkg_database}/${pkg_name}"
cp -pv "${pkg_path}/package" "${installed_pkg_database}/${pkg_name}/package"
[ -e "${temp_location}/${pkg_name}-payloadfiles" ] && cp -pv "${temp_location}/${pkg_name}-payloadfiles" "${installed_pkg_database}/${pkg_name}/payloadfiles"
else
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"
cd "${install_root}" || err "Could not return to main directory. Exiting..."
unset pkg_path
unset pkg_name
unset pkg_config_deploy
unset pkg_config_ver
unset pkg_config_makedepends
unset pkg_config_depends
prn "Install complete for package ${pkg_name}"
}
sync_local_repo_database() {
# Local database for repo already exists - sync it
cd "${1}" || err "Could not enter local database directory. Exiting..."
git pull
}
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."
install_local_package "${locpkg_database}/${1}/${2}"
} }
function help(){ function help(){
prn "h|help) prints this message" prn "h|help) prints this message"
prn "v|version) version" prn "v|version) version"
prn "s|sync) install package(s), and sync repositories" prn "s|sync) install package(s), and sync repositories"
prn "u|update) update" prn "u|update) update"
prn "y|upgrade) upgrade"
prn "i|install) install LOCAL package(s)" prn "i|install) install LOCAL package(s)"
} }
function version(){ function version(){
@ -121,10 +173,12 @@ function version(){
function main(){ function main(){
dbg dbg
case $1 in case $1 in
s|sync) pkg_local ${@: -1} ;; s|sync) sync_local_repo_database "official" ${official}
i|install) pkg_local ${@: -1} ;; [ -z "${2}" ] && exit 0
u|update) update ;; install_package_from_repo "official" "${2}" ;;
y|upgrade) upgrade ;; i|install) pkg_local ${*: -1} ;;
#u|update) update ;;
u|update) err "This feature is currently disabled in APS" ;;
v|version) version ;; v|version) version ;;
h|help) help ;; h|help) help ;;
*) err "Invalid option" *) err "Invalid option"