From 46de0ea71616c0a8fff0bb1366dc123696a86990 Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Thu, 30 Sep 2021 16:26:01 +0200 Subject: [PATCH] Add sources support --- altools/chroot-al | 0 altools/repo | 4 ++-- aps | 61 +++++++++++++++++++++++++++++++++++++---------- 3 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 altools/chroot-al diff --git a/altools/chroot-al b/altools/chroot-al new file mode 100644 index 0000000..e69de29 diff --git a/altools/repo b/altools/repo index a854b9e..720bc64 100755 --- a/altools/repo +++ b/altools/repo @@ -6,13 +6,13 @@ . /etc/al/config case $1 in # add a repo - add) git clone https://${3}/${2}.git ${install_root}/var/aps/repos/${2} + add) git clone ${2} ${install_root}/var/db/repos echo "${2}" >> ${install_root}/etc/al/repo.conf ;; # update a repo update) pushd && cd ${install_root}/var/aps/repos/${2} && git pull && popd ;; # destroy a repo (remove) - destroy) rm -rfv ${install_root}/var/aps/repos/${2} + destroy) rm -rfv ${install_root}/var/db/aps/repos/${2} sed -i "/^${2}/d" ${install_root}/etc/al/repo.conf ;; esac diff --git a/aps b/aps index e8ec162..2275d9b 100755 --- a/aps +++ b/aps @@ -18,20 +18,33 @@ function prn(){ function wrn(){ echo -e "\e[34m==>\e[33m WARNING:\e[39m $1" } -function run(){ - printf '%s\n' "$*" - "$@" -} +#function run(){ +# printf '%s\n' "$*" +# "$@" +#} function err(){ echo -e "\e[34m==>\e[31m ERROR:\e[39m $1" && - rm ${lock} 2>&1 > /dev/null && + rm ${lock} 2> /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!" + wrn "This is a debug build, that may not work!" +} +function sources(){ + if [ -f sources ]; then + pkg_config_url=$(getopt -o hf:gb -1 help,file:,sources) + pkg_config_archv=$(echo ${pkg_config_url} | sed 's:.*/::') + curl -fLO ${pkg_config_url} + mkdir --parents pkgex + tar -xvf ${pkg_config_archv} -C pkgex + mkdir --parents pkgsrc + cp -r pkgex/*/* pkgsrc + else + err "Sources not found, exiting!" + fi } function runbuildsh(){ if [ -x "${2}/${1}" ]; then @@ -61,24 +74,45 @@ function pkg_find(){ } function pkg_local(){ if [ -z "$AL_REPO" ]; then - wrn "Alnux Repo variable is not set, Setting to /var/db/repo/core!" + 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" + export AL_REPO="/var/aps/repos/official/core" notf "AL_REPO set to /var/db/repo/core" + prn "Verifying if AL_REPO is set..." + if [ -z $AL_REPO ]; then + err "AL_REPO is not set." + else + prn "$(echo $AL_REPO)... yes." + fi fi - cp -prv "${1}" "${temp_location}" pkg_find $@ + cp -prv "${1}" "${temp_location}" + + # - - - - - # + # VARIABLES # + # - - - - - # + pkg_name="${1%/}" + pkg_name="${pkg_name##*/}" + pkg_name=$(echo "${pkg_name}" | cut -f 1 -d '.') + # - - - - - - -# + # PKG CONFIG # + # - - - - - - -# + pkg_config_deploy=true + pkg_config_ver="0" + pkg_config_makedepends="" + pkg_config_depends="" } function help(){ prn "h|help) prints this message" prn "v|version) version" - prn "s|sync) install package(s)" + prn "s|sync) install package(s), and sync repositories" prn "u|update) update" + prn "y|upgrade) upgrade" prn "i|install) install LOCAL package(s)" } function version(){ @@ -87,10 +121,13 @@ function version(){ function main(){ dbg case $1 in - s|sync) pkg_local $@ ;; + s|sync) pkg_local ${@: -1} ;; + i|install) pkg_local ${@: -1} ;; + u|update) update ;; + y|upgrade) upgrade ;; v|version) version ;; h|help) help ;; *) err "Invalid option" esac } -main $1 \ No newline at end of file +main $1 ${@: -1} \ No newline at end of file