Skip to content

Commit

Permalink
fix(package-base.sh): accept child calls for local pacscripts (pacsta…
Browse files Browse the repository at this point in the history
…ll#1177)

Co-authored-by: ook37 <[email protected]>
  • Loading branch information
oklopfer and ook37 authored Jul 7, 2024
1 parent ea75e9d commit e2fdaa3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 9 additions & 3 deletions misc/scripts/package-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions pacstall
Original file line number Diff line number Diff line change
Expand Up @@ -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%/*}"
Expand Down

0 comments on commit e2fdaa3

Please sign in to comment.