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 untrusted user who does not match committer: Ohio2
GPG key ID: 2746D0A9E4F21E80

37
aps
View file

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