From e2fdaa3cc852f0f203a8d22f5d980a7a96f0fba8 Mon Sep 17 00:00:00 2001 From: oklopfer <104327997+oklopfer@users.noreply.github.com> Date: Sun, 7 Jul 2024 03:07:37 -0400 Subject: [PATCH] fix(package-base.sh): accept child calls for local pacscripts (#1177) Co-authored-by: ook37 --- misc/scripts/package-base.sh | 12 +++++++++--- pacstall | 11 ++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/misc/scripts/package-base.sh b/misc/scripts/package-base.sh index 0d842734a..de25c430a 100755 --- a/misc/scripts/package-base.sh +++ b/misc/scripts/package-base.sh @@ -91,7 +91,7 @@ function package_pkg() { # shellcheck disable=SC2031 fancy_message info "Found pkgbase: ${PURPLE}${pkgbase}${NC}" if ((${#pkgname[@]} > 1)); then - if [[ -z ${CHILD} ]]; then + if [[ -z ${CHILD} || ${CHILD} == "pkgbase" ]]; then # We do this so that arrays 'start at' 1 to the user z=1 echo -e "\t\t[${BIRed}0${NC}] Exit" @@ -121,8 +121,14 @@ function package_pkg() { # Did we get actual answers? if [[ ${choices[0]} != "n" && ${choices[0]} != "0" ]] || [[ -n ${CHILD} ]]; then local pacnames - if [[ -n ${CHILD} ]]; then - pacnames=("${CHILD}") + if [[ -n ${CHILD} && ${CHILD} != "pkgbase" ]]; then + if array.contains pkgname "${CHILD}"; then + pacnames=("${CHILD}") + else + fancy_message error "${PKGPATH:+${PKGPATH}/}${PACKAGE}${PKGPATH:+.pacscript}:${CHILD} does not exist" + cleanup + exit 1 + fi else for i in "${choices[@]}"; do # Set our user array that started at 1 down to 0 based diff --git a/pacstall b/pacstall index 4158958fe..d1188c658 100755 --- a/pacstall +++ b/pacstall @@ -824,9 +824,14 @@ Helpful links: else unset pac_body pac_text fi - if [[ ${2##*.} == "pacscript" ]]; then - export PACKAGE="${2%.pacscript}" - PACKAGE="${PACKAGE##*/}" + if [[ ${2##*.} == "pacscript" || ${2##*.} == "pacscript:"* ]]; then + if [[ ${2##*.} =~ ^pacscript(:([a-zA-Z0-9_.-]+))$ ]]; then + export CHILD="${BASH_REMATCH[2]/\:/}" + PACKAGE="${2%.pacscript:${CHILD}}" + else + PACKAGE="${2%.pacscript}" + fi + export PACKAGE="${PACKAGE##*/}" export type="install" export local="yes" PKGPATH="${2%/*}"