diff --git a/APP-MANAGER b/APP-MANAGER index c519fbc24..5e94c1f93 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -352,7 +352,7 @@ available_options="about add apikey backup clean config disable downgrade downlo home icons info install install-appimage launcher list lock neodb newrepo nolibfuse off on overwrite \ purge query remove sandbox select sync template test unlock update --all --appimages --apps --byname \ --config --convert --debug --devmode-disable --devmode-enable --force-latest --home --icons --launcher \ - --less --pkg --rollback --disable-sandbox --sandbox --system --user" + --less --pkg --rollback --disable-sandbox --sandbox --system --toolpack --user" function _completion_lists() { # Remove existing lists and download new ones diff --git a/modules/database.am b/modules/database.am index d5739124d..35c799768 100644 --- a/modules/database.am +++ b/modules/database.am @@ -12,6 +12,14 @@ _about_show_markdown() { | sed '1,${ /^\s*#/ d; /^\s*!/ d; /\[Applications]/d; /\ --- /d; /\ | - | /d; /\!\[/d; }' \ | sed '$!N;s/^\s*\n\s*$//;P;D') echo "$markdown_page" | fold -sw 72 | sed 's/^ //g; s/^/ /g' + elif echo "$package_name" | grep -q ".toolpack"; then + toolpack_appimage_name=$(echo "$arg" | sed 's/\.toolpack//g') + if curl -o /dev/null -sIf "https://pkg.pkgforge.dev/$ARCH/$toolpack_appimage_name.AppImage.repology.json"; then + toolpack_readme="https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/$ARCH-Linux/README.md" + toolpack_description=$(curl -Ls "$toolpack_readme" | grep -i "$toolpack_appimage_name" | sed 's/ | /\n/g' | head -5 | tail -1) + toolpack_site=$(curl -Ls "$toolpack_readme" | grep -i "$toolpack_appimage_name" | sed 's/ | /\n/g' | tr '[()]' '\n' | grep "^http" | head -2 | tail -1) + printf "\n%b\n\nSOURCE: %b\n" "$toolpack_description" "$toolpack_site" | fold -sw 72 | sed 's/^ //g; s/^/ /g' + fi else printf ' "%s" IS NOT A VALID ARGUMENT\n' "$package_name" fi @@ -22,7 +30,7 @@ _about_page() { package_name="${Green}$1\033[0m" markdown_url="$AMCATALOGUEMARKDOWNS/${1}.md" printf " PACKAGE: %b\n" "$package_name" - app_name=$(echo "$1" | sed 's/-appimage//g; s/debian-testing-//g') + app_name=$(echo "$1" | sed 's/-appimage//g; s/debian-testing-//g; s/\.toolpack//g') argpath=$(echo "$ARGPATHS" | grep "/$app_name$") if [ -f "$argpath/remove" ]; then app_status="installed\033[0m" @@ -351,6 +359,8 @@ case "$1" in for arg in $entries; do if curl -o /dev/null -sIf "$AMCATALOGUEMARKDOWNS/${arg}.md" 1>/dev/null; then _about_page "$arg" + elif echo "$arg" | grep -q ".toolpack$"; then + _about_page "$arg" else printf " ERROR: %b not found\033[0m\n" "${RED}\"$arg\"" fi diff --git a/modules/install.am b/modules/install.am index 1458db88b..230e0e5f8 100644 --- a/modules/install.am +++ b/modules/install.am @@ -288,6 +288,17 @@ _install_local_script() { fi } +# This function is needed to handle AppImages from https://github.com/pkgforge/pkgcache +_toolpack_handler() { + mkdir -p "$CACHEDIR/toolpack" + curl -Ls "$AMREPO"/templates/AM-SAMPLE-AppImage > "$CACHEDIR/toolpack/$arg.toolpack" || exit 1 + sed -i "s#APP=SAMPLE#APP=$arg#g; \ + s#FUNCTION#curl -Ls https://pkg.pkgforge.dev/$ARCH/$arg.AppImage.version#g; \ + s#wget \"\$version\"#wget https://pkg.pkgforge.dev/$ARCH/$arg.AppImage#g" "$CACHEDIR/toolpack/$arg.toolpack" + chmod a+x "$CACHEDIR/toolpack/$arg.toolpack" + arg="$CACHEDIR/toolpack/$arg.toolpack" +} + # This is for scripts hosted on the official online database _install_normally() { mkdir -p "$AMCACHEDIR"/tmp && rm -f "$AMCACHEDIR"/tmp/* || return @@ -370,6 +381,13 @@ case "$1" in else echo " 💀 ERROR: the file \"$arg\" does NOT exist" fi + elif echo "$@" | grep -q -- "--toolpack"; then + if curl --output /dev/null --silent --head --fail "https://pkg.pkgforge.dev/$ARCH/$arg" 1>/dev/null; then + _toolpack_handler + _install_local_script + else + echo " 💀 ERROR: \"$arg\" does NOT exist in Toolpacks" + fi elif curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1>/dev/null; then _install_normally else