06bba6f68f
0.1.0 is a complete rewrite @hippoz, @hippoz it is supposed to clean up aps. :trol:
83 lines
No EOL
2.3 KiB
Bash
Executable file
83 lines
No EOL
2.3 KiB
Bash
Executable file
#!/bin/sh
|
||
|
||
###################
|
||
# aps. rewritten. #
|
||
###################
|
||
# OHIO: aps *needs* to be rewritten, i can't add any thing else in the aps.old.sh
|
||
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
|
||
function prn(){
|
||
echo -e "\e[34m==>\e[39m $1"
|
||
}
|
||
function wrn(){
|
||
echo -e "\e[34m==>\e[33m WARNING:\e[39m $1"
|
||
}
|
||
function err(){
|
||
echo -e "\e[34m==>\e[31m ERROR:\e[39m $1" &&
|
||
rm ${lock} 2>&1 > /dev/null &&
|
||
exit 2
|
||
}
|
||
function notf(){
|
||
echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1"
|
||
}
|
||
function dbg(){
|
||
wrn "THIS IS A DEBUG TEST BUILD, IT MAY NOT WORK, IT'S GLITCHY AS FUCK!"
|
||
}
|
||
function pkg_find(){
|
||
# i could not even bother, i had to copy kiss in some sense
|
||
set -- "$1" "$2" "$3" "${4:-"$AL_REPO"}"
|
||
IFS=:
|
||
|
||
for _find_path in $4 "${3:-$sys_db}"; do set +f
|
||
for _find_pkg in "$_find_path/"$1; do
|
||
test "${3:--d}" "$_find_pkg" && set -f -- "$@" "$_find_pkg"
|
||
done
|
||
done
|
||
|
||
unset IFS
|
||
# alnux search i guess
|
||
#case $2-$# in
|
||
# *-4) return 1 ;;
|
||
# -*) repo_dir=$5; repo_name=${5##*/} ;;
|
||
# *) shift 4; printf '%s\n' "$@"
|
||
#esac
|
||
}
|
||
function pkg_local(){
|
||
if [ -z "$AL_REPO" ]; then
|
||
wrn "Alnux Repo variable is not set, Setting to /var/db/repo/core!"
|
||
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 " 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"
|
||
export AL_REPO=/var/db/repo/core
|
||
notf "AL_REPO set to /var/db/repo/core"
|
||
|
||
fi
|
||
pkg_find $@
|
||
}
|
||
function help(){
|
||
prn "APS Version 0.1.0"
|
||
prn "h|help) prints this message"
|
||
prn "v|version) version"
|
||
prn "s|sync) install package(s)"
|
||
prn "u|update) update"
|
||
prn "i|install) install LOCAL package(s)"
|
||
}
|
||
function version(){
|
||
prn "APS Version 0.1.0"
|
||
}
|
||
function main(){
|
||
dbg
|
||
case $1 in
|
||
s|sync) pkg_local $@ ;;
|
||
v|version) version ;;
|
||
h|help) help ;;
|
||
*) err "Invalid option"
|
||
esac
|
||
}
|
||
main $1 |