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 untrusted user who does not match committer: Ohio2
GPG key ID: 2746D0A9E4F21E80
3 changed files with 32 additions and 19 deletions

45
aps
View file

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

View file

@ -4,7 +4,7 @@
# Alnux Packaging System #
##########################
temp_location="/var/tmp"
install_root="/"
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"

Binary file not shown.