I Think APS 0.1.0 is done:

Features:
		- SHA Sums
		- PKG_FIND
This commit is contained in:
Ohio2 2021-10-03 00:06:11 +02:00
parent a713b01352
commit 41d1ff0628
Signed by: Ohio2
GPG key ID: 2746D0A9E4F21E80
3 changed files with 32 additions and 19 deletions

49
aps
View file

@ -14,8 +14,10 @@ elif [ -f "$HOME/.config/al/config" ]; then
. $HOME/.config/al/config . $HOME/.config/al/config
elif [ -f "/etc/al/config" ]; then elif [ -f "/etc/al/config" ]; then
. /etc/al/config . /etc/al/config
elif [ -f "/etc/skel/al/config "]; then elif [ -f "/etc/skel/al/config" ]; then
. /etc/skel/al/config . /etc/skel/al/config
elif [ -f $AL_CFG ]; then
. $AL_CFG
else else
wrn "No config file!" wrn "No config file!"
fi fi
@ -41,7 +43,7 @@ function notf(){
echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1" echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1"
} }
function confirm(){ function confirm(){
prn "To install, press ENTER, to cancel, press CTRL+C (unix process break key)" prn "To $1, press ENTER, to cancel, press CTRL+C"
} }
#function dbg(){ #function dbg(){
# wrn "This is a debug build, that may not work!" # wrn "This is a debug build, that may not work!"
@ -63,7 +65,7 @@ function sources(){
#mkdir --parents pkgsrc #mkdir --parents pkgsrc
#cp -r pkgex/*/* pkgsrc #cp -r pkgex/*/* pkgsrc
pkg_config_url=$1 pkg_config_url=$1
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
pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft}) pkg_config_archv_ft=$(file --extension ${pkg_config_archv_ft})
@ -147,12 +149,11 @@ function pkg_local(){
mkdir -p "${pkg_path}/payload" mkdir -p "${pkg_path}/payload"
. "${pkg_path}/package" . "${pkg_path}/package"
cd "${pkg_path}" cd "${pkg_path}"
if [ -f *.sources ] if [ -f *.sources ]; then
sources "$(cat *.sources)" sources $(cat sources)
else #"$(cat *.sources)"
err "No sources exist!"
fi fi
if [ -f *.sha256sums ] if [ -f *.sha256sums ]; then
sha256 "*.sha256sum}" sha256 "*.sha256sum}"
else else
wrn "No sums file(s) found! Be careful!" wrn "No sums file(s) found! Be careful!"
@ -171,7 +172,7 @@ function pkg_local(){
# Yet more old APS code # Yet more old APS code
if [ -x "${pkg_path}/package" ]; then if [ -x "${pkg_path}/package" ]; then
prn "Adding target ${pkg_name} to installed package database..." prn "Adding target ${pkg_name} to installed package database..."
[ ! -d "${installed_pkg_database}/${pkg_name}" ] && mkdir "${installed_pkg_database}/${pkg_name}" [ ! -d "${installed_pkg_database}/${pkg_name}" ] && mkdir -p "${installed_pkg_database}/${pkg_name}"
cp -pv "${pkg_path}/package" "${installed_pkg_database}/${pkg_name}/package" 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" [ -e "${temp_location}/${pkg_name}-payloadfiles" ] && cp -pv "${temp_location}/${pkg_name}-payloadfiles" "${installed_pkg_database}/${pkg_name}/payloadfiles"
else else
@ -191,13 +192,22 @@ function pkg_local(){
} }
sync_local_repo_database() { sync_local_repo_database() {
# Local database for repo already exists - sync it # Local database for repo already exists - sync it
cd "${1}" || err "Could not enter local database directory. Exiting..." #cd "${1}" || err "Could not enter local database directory. Exiting..."
git pull #git pull
prn "Syncing local database for $1"
if [ ! -d "${locpkg_database}/${1}" ]; then
# Local database for repo doesnt exists - clone it
git clone "${2}" "${locpkg_database}/${1}"
else
# Local database for repo already exists - sync it
cd "${locpkg_database}/${1}" || die "Could not enter local database directory. Exiting..."
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" prn "Installing package(s) ${2} from ${1} repo"
[ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found." [ ! -d "${locpkg_database}/${1}/${2}" ] && err "Target not found."
install_local_package "${locpkg_database}/${1}/${2}" pkg_local "${locpkg_database}/${1}/${2}"
} }
update() { update() {
prn "Upgrading installed packages" prn "Upgrading installed packages"
@ -231,17 +241,20 @@ 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}
[ -z "${2}" ] && exit 0 [ -z "${2}" ] && exit 0
install_package_from_repo "official" "${2}" ;; install_package_from_repo "${official}" "${2}" ;;
#confirm "install" ;;
i|install) pkg_local ${*: -1} ;; i|install) pkg_local ${*: -1} ;;
# confirm "install" ;;
u|update) update ;; u|update) update ;;
# confirm "update" ;;
v|version) version ;; v|version) version ;;
h|help) help ;; h|help) help ;;
*) err "Invalid option" *) err "Invalid option"

View file

@ -4,7 +4,7 @@
# Alnux Packaging System # # Alnux Packaging System #
########################## ##########################
temp_location="/var/tmp" temp_location="/var/tmp"
install_root="/" install_root="/var/tmp/alroot"
installed_pkg_database="${install_root}/var/aps/installed" installed_pkg_database="${install_root}/var/aps/installed"
locpkg_database="${install_root}/var/aps/repos" locpkg_database="${install_root}/var/aps/repos"
lock="${install_root}/var/aps/lock" lock="${install_root}/var/aps/lock"

Binary file not shown.