From 41d1ff0628b655fb0546c9ab8ef8e58f1f5d6ff7 Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Sun, 3 Oct 2021 00:06:11 +0200 Subject: [PATCH] I Think APS 0.1.0 is done: Features: - SHA Sums - PKG_FIND --- aps | 49 +++++++++++++++++++++++++++++++------------------ config/config | 2 +- man/aps.8.gz | Bin 517 -> 0 bytes 3 files changed, 32 insertions(+), 19 deletions(-) delete mode 100644 man/aps.8.gz diff --git a/aps b/aps index 366d68b..d7476c7 100755 --- a/aps +++ b/aps @@ -14,8 +14,10 @@ elif [ -f "$HOME/.config/al/config" ]; then . $HOME/.config/al/config elif [ -f "/etc/al/config" ]; then . /etc/al/config -elif [ -f "/etc/skel/al/config "]; then +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..." - git pull + #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" diff --git a/config/config b/config/config index fd2aaf1..3f3d92b 100755 --- a/config/config +++ b/config/config @@ -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" diff --git a/man/aps.8.gz b/man/aps.8.gz deleted file mode 100644 index 3b747cf8584ed15d0592e4bc45fc483d4a0c1800..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 517 zcmV+g0{Z;13D!wHlWw6Nf85SV$=?> z0lug)(79LDTEVWA*&$qB&J#E;OTz&!i2tq+GT71Hs3#ojpSjU70X+IgW= z1f)|qCo5BpQYVPiRHzeP8V!w92-G6H1gYxr%30`JD{729$0__zQHz~9}DT z;)p7nw7glIg=6!oy&K1sXg~2C61|GM;7^%9(4l&&dQ@X)9?v1O!o4)IE4}!S)J0UbL~l1GrwT HW&;2KuR`-u