I was wrong about the commits; added a case for the url-prefix (git and web are the options) it now errors out when trying to use the old alnux-type sources

This commit is contained in:
Ohio2 2021-10-05 16:11:00 +02:00
parent e115d7d554
commit f37d2a58d7
Signed by: Ohio2
GPG key ID: 2746D0A9E4F21E80

35
aps
View file

@ -28,6 +28,9 @@ function conf_fetch(){
lock="${install_root}/var/aps/lock" lock="${install_root}/var/aps/lock"
official="https://git.hippoz.xyz/alnux/repo" official="https://git.hippoz.xyz/alnux/repo"
debug=off debug=off
#echo $AL_REPO
#AL_REPO=$(echo $AL_REPO | cut -d':')
#echo $AL_REPO
fi fi
} }
case ${debug} in case ${debug} in
@ -39,10 +42,6 @@ function prn(){
function wrn(){ function wrn(){
echo -e "\e[34m==>\e[33m WARNING:\e[39m $1" echo -e "\e[34m==>\e[33m WARNING:\e[39m $1"
} }
#function run(){
# printf '%s\n' "$*"
# "$@"
#}
function err(){ function err(){
echo -e "\e[34m==>\e[31m ERROR:\e[39m $1" && echo -e "\e[34m==>\e[31m ERROR:\e[39m $1" &&
rm ${lock} 2> /dev/null rm ${lock} 2> /dev/null
@ -60,8 +59,12 @@ function confirm(){
#} #}
function sources(){ function sources(){
pkg_config_url="$1" pkg_config_url="$1"
pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::') pkg_config_url_prefix=$(echo ${pkg_config_url} | cut -d'+' -f1)
curl -fLO "${pkg_config_url}" pkg_config_url_rest=$(echo ${pkg_config_url} | cut -d+ -f2)
case $pkg_config_url_prefix in
git) mkdir pkgsrc && git clone ${pkg_config_url_rest} pkgsrc ;;
web) pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::')
curl -fLO "${pkg_config_url_rest}"
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
@ -71,13 +74,15 @@ function sources(){
*.gz) prwork *.gz) prwork
esac esac
mkdir --parents pkgsrc mkdir --parents pkgsrc
cp -r pkgex/*/* pkgsrc cp -r pkgex/*/* pkgsrc ;;
*) wrn "Old Alnux sources is probably used!"
esac
} }
function sha256(){ function sha256(){
#sha256sum $sum > $1.sha256sum #sha256sum $sum > $1.sha256sum
sha256sum -c "$1" 1>&2 /dev/null sha256sum -c "$1" 1>&2 /dev/null
if [ "$?" -ne "0" ]; then if [ "$?" -eq "0" ]; then
prn "OK!" prn "OK!"
else else
err "Sha failed!" err "Sha failed!"
@ -184,8 +189,8 @@ 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"
pkg_local "${locpkg_database}/${1}/${2}" pkg_local "${locpkg_database}/${1}/${2}"
}
[ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found." [ ! -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..."
@ -218,10 +223,10 @@ function version(){
prn "APS Version 0.1.0" prn "APS Version 0.1.0"
} }
function main(){ function main(){
#if [ -f "${lock}" ]; then if [ -f "${lock}" ]; then
# err "A lock file already exists (another instance of the package manager could be running). If you're sure no package manager is running, remove the file ${lock}." err "A lock file already exists (another instance of the package manager could be running). If you're sure no package manager is running, remove the file ${lock}."
#fi fi
#touch "${lock}" touch "${lock}"
#dbg #dbg
case $1 in case $1 in
s|sync) sync_local_repo_database "${official}" ${official} s|sync) sync_local_repo_database "${official}" ${official}
@ -234,8 +239,10 @@ function main(){
# confirm "update" ;; # confirm "update" ;;
v|version) version ;; v|version) version ;;
h|help) help ;; h|help) help ;;
#tus|tusync) hwclock --systohc ;; apsinst) if [ $APS_PKG=y ]; then
install -v aps
*) err "Invalid option" *) err "Invalid option"
esac esac
rm ${lock}
} }
main $1 ${@: -1} main $1 ${@: -1}