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:
parent
e115d7d554
commit
f37d2a58d7
1 changed files with 31 additions and 24 deletions
55
aps
55
aps
|
@ -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,24 +59,30 @@ 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)
|
||||||
mkdir --parents pkgex
|
case $pkg_config_url_prefix in
|
||||||
pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft})
|
git) mkdir pkgsrc && git clone ${pkg_config_url_rest} pkgsrc ;;
|
||||||
case $pkg_config_archv_ft in
|
web) pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::')
|
||||||
*.tar*) prn $(tar -xf ${pkg_config_archv} -C pkgex) ;;
|
curl -fLO "${pkg_config_url_rest}"
|
||||||
*.xz) prn $(cd pkgex && xz -d ../${pkg_config_archv} && cd ..) ;;
|
mkdir --parents pkgex
|
||||||
*.bz2) prn $(cd pkgex && bzip2 -d ../${pkg_config_archv} && cd ..) ;;
|
pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft})
|
||||||
*.gz) prwork
|
case $pkg_config_archv_ft in
|
||||||
esac
|
*.tar*) prn $(tar -xf ${pkg_config_archv} -C pkgex) ;;
|
||||||
mkdir --parents pkgsrc
|
*.xz) prn $(cd pkgex && xz -d ../${pkg_config_archv} && cd ..) ;;
|
||||||
cp -r pkgex/*/* pkgsrc
|
*.bz2) prn $(cd pkgex && bzip2 -d ../${pkg_config_archv} && cd ..) ;;
|
||||||
|
*.gz) prwork
|
||||||
|
esac
|
||||||
|
mkdir --parents 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!"
|
||||||
|
@ -181,11 +186,11 @@ sync_local_repo_database() {
|
||||||
git pull
|
git pull
|
||||||
fi
|
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"
|
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}
|
Loading…
Reference in a new issue