From 8c10d64a4976e585f262d2578f4dd4066fd0e5ea Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 05:56:14 +0200
Subject: [PATCH 01/18] Update README.md
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 0cd42760b..88e9e39b0 100644
--- a/README.md
+++ b/README.md
@@ -3,10 +3,12 @@
+
| [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) |
| - | - | - |
| [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) |
+
"AM"/"AppMan" is a set of scripts and modules for installing, updating, and managing AppImage packages and other portable formats, in the same way that APT manages DEBs packages, DNF the RPMs, and so on... using a large database of Shell scripts inspired by the Arch User Repository, each dedicated to an app or set of applications.
From 86979b4667c1e19cddbf0211c91d11cc6041932e Mon Sep 17 00:00:00 2001
From: Samuel <36420837+Samueru-sama@users.noreply.github.com>
Date: Wed, 14 Aug 2024 23:57:59 -0400
Subject: [PATCH 02/18] Introduce check for spooky scripts, and some
refactoring
---
modules/install.am | 350 +++++++++++++++++++++++----------------------
1 file changed, 182 insertions(+), 168 deletions(-)
diff --git a/modules/install.am b/modules/install.am
index 78a17aec2..26d6839e7 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -1,102 +1,100 @@
#!/usr/bin/env bash
-# shellcheck disable=SC2016
-# shellcheck disable=SC2154
-
#############################################################################
# THIS MODULE IS USED TO INSTALL APPS FROM THE DATABASE OR FROM LOCAL SCRIPTS
#############################################################################
BINDIR="${XDG_BIN_HOME:-$HOME/.local/bin}"
+SUDOCMD="$SUDOCOMMAND"
# If you use the --latest option, add the "latest" flag to scripts that point to a very common "release"
-function _if_latest() {
+_if_latest() {
if grep -q 'force-latest' "$AMCACHEDIR"/install-args; then
sed -i 's#/releases#/releases/latest#g' ./"$arg"
fi
}
-# Patch to apply to installation scripts
-function _install_common_patch() {
- if ! grep -q -- "--debug" "$AMCACHEDIR"/install-args; then
- # Patch "wget" (version 1.x) to have a progress bar and fix errors when applying patches
- if wget --version | head -1 | grep -q ' 1.'; then
- sed -i "s#wget #wget -q --no-verbose --show-progress --progress=bar #g" ./"$arg"
+_spooky_check() {
+ if grep -i spooky ./"$arg" >/dev/null 2>&1; then
+ echo " WARNING: \"$arg\" does not have a transparent build process"
+ echo " We can't be sure as to what is inside the application"
+ echo " We highly recommend that you sandbox this application"
+ read -p " Do you wish to continue? (N/y): " yn
+ if ! echo "$yn" | grep -i '^y' >/dev/null 2>&1; then
+ printf "\n INSTALLATION ABORTED!\n"
+ exit 1
fi
fi
- sed -i "s# https://api.github.com#$HeaderAuthWithGITPAT https://api.github.com#g" ./"$arg"
}
-function _install_appman_local_patch() {
- sed -i "s#/opt/#$APPSPATH/#g" ./"$arg"
- sed -i "s# /opt# $APPSPATH#g" ./"$arg"
- sed -i "s# /usr/local/bin# $BINDIR#g" ./"$arg"
- sed -i 's# "/usr/local/bin# "'"$BINDIR"'#g' ./"$arg"
- sed -i "s# /usr/local/share/applications# $DATADIR/applications#g" ./"$arg"
+# Patch to apply to installation scripts
+_apply_patches() {
+ if [ "$AMCLI" = "appman" ]; then
+ # Patches /usr/local for $HOME equivalent for AppMan
+ sed -i -e "s#/usr/local/bin#\"$BINDIR\"#g" \
+ -e "s#/usr/local/share#\"$DATADIR\"#g" \
+ -e "s#/opt/#\"$APPSPATH\"/#g" ./"$arg"
+ else
+ "$SUDOCMD" mkdir -p /usr/local/{share/applications,bin}
+ fi
+ if ! grep -q -- "--debug" "$AMCACHEDIR"/install-args && wget --version | head -1 | grep -q ' 1.'; then
+ # Patch "wget" (version 1.x) to have a progress bar and fix errors when applying patches
+ sed -i "s#wget #wget -q --no-verbose --show-progress --progress=bar #g" ./"$arg"
+ fi
+ sed -i "s# https://api.github.com#$HeaderA uthWithGITPAT https://api.github.com#g" ./"$arg"
}
-function _apply_patches() {
- if [ "$AMCLI" = appman ] 2> /dev/null; then
- _install_common_patch
- _install_appman_local_patch
- else
- $SUDOCOMMAND mkdir -p /usr/local/bin
- $SUDOCOMMAND mkdir -p /usr/local/share/applications
- _install_common_patch
+_am_remover_check() {
+ # Put permission check in remove script and change ownership of directory
+ if [ "$AMCLI" = am ]; then
+ $SUDOCMD sed -i '1 a [ "$(id -u)" -ne 0 ] && echo "Permission denied" && exit 1' \
+ "${LASTDIRPATH}"/remove 2>/dev/null
+ $SUDOCMD chown -R $USER ${LASTDIRPATH} 2>/dev/null
fi
+
}
# Post-installation processes
-function _post_installation_processes() {
- LATESTDIR=$(ls -td "$APPSPATH"/* | head -1 | sed 's:.*/::')
- # Add a command to line 2 of the "remove" script to prevent use without root privileges
- # and take control of the directory to be able to manage and update the app without root privileges
- if [ "$AMCLI" = am ] 2> /dev/null; then
- $SUDOCOMMAND sed -i '1 a if [ "$(id -u)" -ne 0 ]; then echo "Permission denied"; exit 1; fi' "$APPSPATH"/"$LATESTDIR"/remove 2> /dev/null
- $SUDOCOMMAND chown -R $currentuser "$APPSPATH"/"$LATESTDIR" 2> /dev/null
- fi
- # Check if an AM-updater script exists, so the CLI can manage updates for the installed app
- # by comparing the hosted script with a downloaded one
- if test -f "$APPSPATH"/"$LATESTDIR"/AM-updater; then
- mkdir "$APPSPATH"/"$LATESTDIR"/.am-installer 2> /dev/null
- wget -q "$APPSDB"/"$arg" -O "$APPSPATH"/"$LATESTDIR"/.am-installer/"$arg"
- fi
+_post_installation_processes() {
+ LASTDIR=$(ls -td "$APPSPATH"/* | head -1 | sed 's:.*/::')
+ LASTDIRPATH="${APPSPATH}/${LASTDIR}"
+ _am_remover_check
+ # Check for AM-updater script sothat CLI can manage updates
+ [ -f "${LASTDIRPATH}"/AM-updater ] && mkdir "${LASTDIRPATH}"/.am-installer 2>/dev/null \
+ && wget -q "$APPSDB"/"$arg" -O "${LASTDIRPATH}"/.am-installer/"$arg"
+ find "${LASTDIRPATH}"/icons/* -xtype l -delete 2>/dev/null # Removes broken links
# If you have a broken or missing icon in your "icons" directory, download one from the catalog
- if test -d "$APPSPATH"/"$LATESTDIR"/icons; then
- find "$APPSPATH"/"$LATESTDIR"/icons/* -xtype l -delete 2> /dev/null
- if [ -z "$(ls -A "$APPSPATH"/"$LATESTDIR"/icons)" ]; then
- wget -q "$AMCATALOGUEICONS"/"$arg".png -O "$APPSPATH"/"$LATESTDIR"/icons/"$arg"
- fi
- fi
+ [ -z "$(ls -A "${LASTDIRPATH}"/icons)" ] \
+ && wget -q "$AMCATALOGUEICONS"/"$arg".png -O "${LASTDIRPATH}"/icons/"$arg"
# Patch .desktop to change paths if the app is installed locally
- if [ "$AMCLI" = appman ] 2> /dev/null; then
- sed -i "s#Icon=/opt#Icon=$HOME/$APPSDIR#g" "$DATADIR"/applications/*-AM.desktop 2> /dev/null
- sed -i "s#Exec=$arg#Exec=$BINDIR/$arg#g" "$DATADIR"/applications/*-AM.desktop 2> /dev/null
- sed -i 's#Exec=$APP#Exec='"$BINDIR"'/$APP#g' "$DATADIR"/applications/-AM.desktop 2> /dev/null
- sed -i "s#Exec=/usr/bin/#Exec=$BINDIR/#g" "$DATADIR"/applications/*-AM.desktop 2> /dev/null
- sed -i "s#Exec=/opt/#Exec=$BINDIR/#g" "$DATADIR"/applications/*-AM.desktop 2> /dev/null
- fi
+ if [ "$AMCLI" = "appman" ]; then
+ # Likely not needed anymore: "s#Icon=/opt#Icon=$HOME/$APPSDIR#g"
+ sed -i -e "s#Exec=$arg#Exec=$BINDIR/$arg#g" \
+ -e 's#Exec=$APP#Exec='"$BINDIR"'/$APP#g' \
+ -e "s#Exec=/usr/bin/#Exec=$BINDIR/#g" \
+ -e "s#Exec=/opt/#Exec=$BINDIR/#g" "$DATADIR"/applications/*-AM.desktop 2>/dev/null
+ fi
}
# End of the installation process
-function _ending_the_installation() {
- unset "$LATESTDIR"
- LATESTDIR=$(ls -td "$APPSPATH"/* | head -1 | sed 's:.*/::')
- if test -f "$APPSPATH"/"$LATESTDIR"/remove; then
- if test -d "$APPSPATH"/"$LATESTDIR"/tmp; then
+_ending_the_installation() {
+ unset "$LASTDIR" # Is this needed?
+ LASTDIR=$(ls -td "$APPSPATH"/* | head -1 | sed 's:.*/::')
+ if [ -f "${LASTDIRPATH}"/remove ]; then
+ if test -d "${LASTDIRPATH}"/tmp; then
echo " 💀 ERROR DURING INSTALLATION, REMOVED $APPNAME!"
- $AMCLIPATH -R "$LATESTDIR" 1> /dev/null
- elif test -f "$APPSPATH/$LATESTDIR/version" && [ -z "$(cat "$APPSPATH/$LATESTDIR/version")" ]; then
+ $AMCLIPATH -R "$LASTDIR" 1>/dev/null
+ elif test -f "$APPSPATH/$LASTDIR/version" && [ -z "$(cat "$APPSPATH/$LASTDIR/version")" ]; then
echo " 💀 ERROR DURING INSTALLATION, REMOVED $APPNAME!"
- $AMCLIPATH -R "$LATESTDIR" 1> /dev/null
+ $AMCLIPATH -R "$LASTDIR" 1> /dev/null
else
- chown -R $currentuser "$AMCACHEDIR"/about 2> /dev/null
+ chown -R $USER "$AMCACHEDIR"/about 2>/dev/null
for metapackage in $METAPACKAGES; do
if grep -q "$metapackage" ./"$arg" 2> /dev/null; then
- metascript="$LATESTDIR"
+ metascript="$LASTDIR"
fi
done
- APPSIZE=$(du -sm "$APPSPATH"/"$LATESTDIR" | awk '{print $1}' )
+ APPSIZE=$(du -sm "${LASTDIRPATH}" | awk '{print $1}' )
if [ -n "$metascript" ]; then
METASCRIPT_NAME=$(echo "\"$metascript\"" | tr '[:lower:]' '[:upper:]')
echo -ne " $METASCRIPT_NAME INSTALLED ($APPSIZE MB OF DISK SPACE)\n"
@@ -104,48 +102,53 @@ function _ending_the_installation() {
else
echo -ne " $APPNAME INSTALLED ($APPSIZE MB OF DISK SPACE)\n"
fi
- $SUDOCOMMAND rm "$AMCACHEDIR"/"$arg"
+ $SUDOCMD rm "$AMCACHEDIR"/"$arg"
_check_version
- app_version=$(grep -w " ◆ $LATESTDIR |" 0<"$AMCACHEDIR"/version-args | sed 's:.*| ::')
- echo " ◆ $LATESTDIR $app_version" >> "$AMCACHEDIR"/installed
+ app_version=$(grep -w " ◆ $LASTDIR |" 0<"$AMCACHEDIR"/version-args | sed 's:.*| ::')
+ echo " ◆ $LASTDIR $app_version" >> "$AMCACHEDIR"/installed
fi
else
echo " INSTALLATION ABORTED!"
fi
}
+# Check if the installation script contain a keyword related to a missing dependence
+_dependency_check_utils() {
+ app_deps="ar gcc glib-compile-schemas make tar unzip"
+ for name in $app_deps; do
+ if grep "^$name" ./"$arg" 1>/dev/null && ! command -v "$name" >/dev/null 2>&1; then
+ [ "$name" = "ar" ] && name="binutils"
+ echo " 💀 ERROR: cannot install \"$arg\" without \"$name\"" && return 0
+ fi
+ done
+}
+
+# Check if the installation script is a metapackage (example one of the 40+ kdegames scripts)
+_metapackage_check() {
+for metapackage in $METAPACKAGES; do
+ if grep -q "$metapackage" ./"$arg" 2> /dev/null; then
+ if [ -d "$APPSPATH"/"$metapackage"/tmp ]; then
+ $SUDOCMD "$APPSPATH"/"$metapackage"/remove 2> /dev/null
+ elif [ -d "$APPSPATH"/"$metapackage" ]; then
+ METAPACKAGE_NAME=$(echo "$metapackage" | tr '[:lower:]' '[:upper:]')
+ echo " ◆ \"$APPNAME\" IS PART OF \"$METAPACKAGE_NAME\", ALREADY INSTALLED"
+ return 0
+ fi
+ fi
+done
+}
+
+
######################
# INSTALLATION PROCESS
######################
# This function is needed to parse the installation script and then execute it
-function _install_arg() {
+_install_arg() {
APPNAME=$(echo "\"$arg\"" | tr '[:lower:]' '[:upper:]')
chmod a+x ./"$arg"
- # Check if the installation script is a metapackage (example one of the 40+ kdegames scripts)
- for metapackage in $METAPACKAGES; do
- if grep -q "$metapackage" ./"$arg" 2> /dev/null; then
- if test -d "$APPSPATH"/"$metapackage"/tmp; then
- $SUDOCOMMAND "$APPSPATH"/"$metapackage"/remove 2> /dev/null
- elif test -d "$APPSPATH"/"$metapackage"; then
- METAPACKAGE_NAME=$(echo "$metapackage" | tr '[:lower:]' '[:upper:]')
- echo " ◆ \"$APPNAME\" IS PART OF \"$METAPACKAGE_NAME\", ALREADY INSTALLED"; return 0
- fi
- fi
- done
- # Check if the installation script contain a keyword related to a missing dependence
- app_deps="ar gcc glib-compile-schemas make tar unzip"
- for name in $app_deps; do
- if grep "^$name" ./"$arg" 1> /dev/null; then
- if ! command -v "$name" &>/dev/null; then
- if [ "$name" = "ar" ]; then
- echo " 💀 ERROR: cannot install \"$arg\" without \"binutils\"" && return 0
- else
- echo " 💀 ERROR: cannot install \"$arg\" without \"$name\"" && return 0
- fi
- fi
- fi
- done
+ _metapackage_check
+ _dependency_check_utils
if grep -q 'ffwa-' ./"$arg"; then
ffbrowser=$(find ${PATH//:/ } -maxdepth 1 -name "firefox*" | sort | head -1)
if [ -z "$ffbrowser" ]; then
@@ -157,23 +160,23 @@ function _install_arg() {
appimage_bulder_script=$(grep "^wget " ./"$arg" | tr '"' '\n' | grep -i "^http" | sed 's/$APP/'"$arg"'/g')
if curl --output /dev/null --silent --head --fail "$appimage_bulder_script" 1> /dev/null; then
for name in $app_deps; do
- if curl -Ls "$appimage_bulder_script" | grep "^$name" 1> /dev/null; then
- if ! command -v "$name" &>/dev/null; then
- if [ "$name" = "ar" ]; then
- echo " 💀 ERROR: cannot install \"$arg\" without \"binutils\"" && return 0
- else
- echo " 💀 ERROR: cannot install \"$arg\" without \"$name\"" && return 0
- fi
+ if curl -Ls "$appimage_bulder_script" | grep "^$name" 1>/dev/null; then
+ if ! command -v "$name" >/dev/null 2>&1; then
+ [ "$name" = "ar" ] && name="binutils"
+ echo " 💀 ERROR: cannot install \"$arg\" without \"$name\""
+ return 0
fi
fi
done
- if curl -Ls "$appimage_bulder_script" | grep -ie "appimagetool\|pkg2appimage" 1> /dev/null; then
- if ! command -v convert &>/dev/null; then
- echo " 💀 ERROR: cannot create \"$arg\" without \"convert\" (from \"imagemagick\")"; return 0
+ if curl -Ls "$appimage_bulder_script" | grep -ie "appimagetool\|pkg2appimage" 1>/dev/null; then
+ if ! command -v convert >/dev/null 2>&1; then
+ echo " 💀 ERROR: cannot create \"$arg\" without \"convert\" (from \"imagemagick\")"
+ return 0
fi
fi
else
- echo " 💀 ERROR: cannot create \"$arg\", the builder does not exists"; return 0
+ echo " 💀 ERROR: cannot create \"$arg\", the builder does not exists"
+ return 0
fi
fi
# Check if you are installing an app or a library
@@ -182,13 +185,18 @@ function _install_arg() {
printf "\n This script will create an AppImage on the fly, please wait...\n"
elif grep -q "/usr/local/lib" ./"$arg"; then
printf "\n ⚠️ This script will install a system library in /usr/local/lib\n\n"
- read -r -p " Do you wish to continue (N,y)?" yn
- case "$yn" in 'y'|'Y') ;; 'n'|'N'|*) printf "\n INSTALLATION ABORTED!\n"; return 0;; esac
+ read -p " Do you wish to continue? (N/y): " yn
+ if ! echo "$yn" | grep -i '^y' >/dev/null 2>&1; then
+ printf "\n INSTALLATION ABORTED!\n"
+ return 0
+ fi
fi
+ _spooky_check
_if_latest
_apply_patches
echo ""
- $SUDOCOMMAND ./"$arg"
+ # Install script
+ $SUDOCMD ./"$arg"
echo ""
_post_installation_processes
_ending_the_installation
@@ -199,12 +207,12 @@ function _install_arg() {
####################
# This function is for local installation scripts
-function _install_local_script() {
+_install_local_script() {
path2arg="$arg"
arg=$(echo "$path2arg" | sed 's:.*/::')
- mkdir -p "$AMCACHEDIR"/tmp && rm -f "$AMCACHEDIR"/tmp/* &&
- cp "$path2arg" "$AMCACHEDIR"/tmp/"$arg" &&
- cd "$AMCACHEDIR" && mv ./tmp/"$arg" ./"$arg" && rmdir ./tmp || return
+ mkdir -p "$AMCACHEDIR"/tmp && rm -f "$AMCACHEDIR"/tmp/* \
+ && cp "$path2arg" "$AMCACHEDIR"/tmp/"$arg" && cd "$AMCACHEDIR" \
+ && mv ./tmp/"$arg" ./"$arg" && rmdir ./tmp || return
if ! test -d "$APPSPATH"/"$arg"; then
_install_arg
else
@@ -212,8 +220,8 @@ function _install_local_script() {
fi
}
-# # This function is for scripts hosted on the official online database or a third-party one
-function _install_normally() {
+# This is for scripts hosted on the official online database or a third-party one
+_install_normally() {
mkdir -p "$AMCACHEDIR"/tmp && rm -f "$AMCACHEDIR"/tmp/* &&
wget -q "$APPSDB"/"$arg" -O "$AMCACHEDIR"/tmp/"$arg" &&
cd "$AMCACHEDIR" && mkdir -p tmp && cd tmp || return
@@ -222,7 +230,7 @@ function _install_normally() {
}
# This function is entirely dedicated to third-party databases
-function _install_from_third_party_repo() {
+_install_from_third_party_repo() {
rm -R -f "$AMCACHEDIR/multirepo-args"
MULTIREPO=$(grep "Source=" "$AMPATH/neodb" | sed 's/Source=//g')
for anyrepo in $MULTIREPO; do
@@ -245,15 +253,19 @@ function _install_from_third_party_repo() {
_install_arg
else
printf '\n%s\n' " ◆ FOUND $APPNAME FROM MULTIPLE SOURCES:"
- printf '%s\n\n' " Select a URL from this menu (read carefully) or press CTRL+C to abort:"; sleep 1
- select d in $(cat "$AMCACHEDIR/multirepo-args"); do test -n "$d" && break; echo ">>> Invalid Selection"; done
+ printf '%s\n\n' " Select a URL from this menu (read carefully) or press CTRL+C to abort:"
+ sleep 1
+ select d in $(cat "$AMCACHEDIR/multirepo-args"); do
+ test -n "$d" && break
+ echo ">>> Invalid Selection"
+ done
mkdir -p "$AMCACHEDIR"/tmp && rm -f "$AMCACHEDIR"/tmp/* &&
wget -q "$d/$arg" -O "$AMCACHEDIR"/tmp/"$arg" &&
cd "$AMCACHEDIR" && mv ./tmp/"$arg" ./"$arg" && rmdir ./tmp || return
rm -R -f "$AMCACHEDIR/multirepo-args"
_install_arg
fi
- elif curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1> /dev/null; then
+ elif curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1>/dev/null; then
mkdir -p "$AMCACHEDIR"/tmp && rm -f "$AMCACHEDIR"/tmp/* &&
wget -q "$APPSDB"/"$arg" -O "$AMCACHEDIR"/tmp/"$arg" &&
cd "$AMCACHEDIR" && mv ./tmp/"$arg" ./"$arg" && rmdir ./tmp || return
@@ -262,7 +274,7 @@ function _install_from_third_party_repo() {
else
echo " 💀 ERROR: \"$arg\" does NOT exist in the database, see \"$AMCLI -l\""
fi
- elif curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1> /dev/null; then
+ elif curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1>/dev/null; then
_install_normally
else
echo " 💀 ERROR: \"$arg\" does NOT exist in the database, see \"$AMCLI -l\""
@@ -274,83 +286,87 @@ function _install_from_third_party_repo() {
##################################
while [ -n "$1" ]; do
-
case "$1" in
'-i'|'install')
- if [ -z "$2" ]; then
+ case $2 in
+ '--debug'|'--force-latest')
+ [ -z "$3" ] && echo " USAGE: $AMCLI $1 $2 [ARGUMENT]" && exit 1
+ ;;
+ '')
echo " USAGE: $AMCLI $1 [ARGUMENT]"
- echo " $AMCLI $1 --debug [ARGUMENT]"
- echo " $AMCLI $1 --force-latest [ARGUMENT]"; exit
- fi
- if [ "$AMCLI" = am ] 2> /dev/null; then
- $SUDOCOMMAND echo -ne "\r"
- if ! $SUDOCOMMAND -n true 2> /dev/null; then
- exit
- fi
- fi
+ echo " USAGE: $AMCLI $1 --debug [ARGUMENT]"
+ echo " USAGE: $AMCLI $1 --force-latest [ARGUMENT]"
+ exit 1
+ ;;
+ esac
+ [ "$AMCLI" = "am" ] && { $SUDOCMD echo -ne "\r" || exit 1; }
+
echo "############################################################################"
echo "## ##"
echo "## START OF ALL INSTALLATION PROCESSES ##"
echo "## ##"
echo "############################################################################"
- _clean_amcachedir 2> /dev/null
+ _clean_amcachedir 2>/dev/null
echo "$@" | tr ' ' '\n' >> "$AMCACHEDIR"/install-args
ARGS=$(tail -n +2 "$AMCACHEDIR"/install-args | grep -v -- "--")
- if [ "$2" = "--debug" ]; then
- printf "\n You have decided to read the complete messages to debug the installation\n"
- printf "____________________________________________________________________________\n"
- elif [ "$2" = "--force-latest" ]; then
- printf "\n You have decided to force downloads for the latest version (if it exists)\n"
- printf "____________________________________________________________________________\n"
- fi
METAPACKAGES="kdegames kdeutils node platform-tools"
for arg in $ARGS; do
echo ""
- cd "$REALDIR" || return
- # If the "tmp" directory is not removed, the installation failed, so remove the app
- if test -d "$APPSPATH"/"$arg"/tmp; then
- $SUDOCOMMAND "$APPSPATH"/"$arg"/remove 2> /dev/null
- fi
- # Various cases that may occur during installation (for example if you use a third-party repository)
- if test -f "$APPSPATH"/"$arg"/remove; then
- echo " ◆ \"$arg\" is already installed!" | tr '[:lower:]' '[:upper:]'
- else
- if echo "$arg" | grep -q "/"; then
- if test -f "$arg" 2> /dev/null; then
- _install_local_script
+ case $arg in
+ '--debug')
+ echo " You have decided to read the complete messages to debug the installation"
+ echo "____________________________________________________________________________"
+ ;;
+ '--force-latest')
+ echo " You have decided to force downloads for the latest version (if it exists)"
+ echo "____________________________________________________________________________"
+ ;;
+ *)
+ cd "$REALDIR" || return
+ # If the "tmp" directory is not removed, the installation failed, so remove the app
+ if [ -d "$APPSPATH"/"$arg"/tmp ]; then
+ $SUDOCMD "$APPSPATH"/"$arg"/remove 2> /dev/null
+ fi
+ # Various cases that may occur during installation (for example if you use a third-party repository)
+ if test -f "$APPSPATH"/"$arg"/remove; then
+ echo " ◆ \"$arg\" is already installed!" | tr '[:lower:]' '[:upper:]'
+ else
+ if echo "$arg" | grep -q "/"; then
+ if test -f "$arg" 2> /dev/null; then
+ _install_local_script
+ else
+ echo " 💀 ERROR: the file \"$arg\" does NOT exist"
+ fi
+ elif test -f "$AMPATH/neodb"; then
+ _install_from_third_party_repo
+ elif curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1>/dev/null; then
+ _install_normally
else
- echo " 💀 ERROR: the file \"$arg\" does NOT exist"
+ echo " 💀 ERROR: \"$arg\" does NOT exist in the database, see \"$AMCLI -l\""
fi
- elif test -f "$AMPATH/neodb"; then
- _install_from_third_party_repo
- elif curl --output /dev/null --silent --head --fail "$APPSDB"/"$arg" 1> /dev/null; then
- _install_normally
- else
- echo " 💀 ERROR: \"$arg\" does NOT exist in the database, see \"$AMCLI -l\""
fi
- fi
- echo "____________________________________________________________________________"
+ echo "____________________________________________________________________________"
+ ;;
+ esac
done
- if test -f "$AMCACHEDIR"/installed; then
+ if [ -f "$AMCACHEDIR"/installed ]; then
echo "############################################################################"
printf "\n END OF ALL INSTALLATION PROCESSES\n"
printf " The following new programs have been installed:\n\n"
grep -w -v "◆ am" 0<"$AMCACHEDIR"/installed
- printf "\n############################################################################\n"
- exit
+ echo "############################################################################"
+ exit 0
else
- exit
+ exit 1
fi
;;
'-e'|'extra')
- if [ -z "$2" ]; then
- echo " USAGE: $AMCLI $1 user/project [ARGUMENT]"
- echo " USAGE: $AMCLI $1 user/project [ARGUMENT] [KEYWORD]"; exit
- elif [ -z "$3" ]; then
+ if [ -z "$2" ] || [ -z "$3" ]; then
echo " USAGE: $AMCLI $1 user/project [ARGUMENT]"
- echo " USAGE: $AMCLI $1 user/project [ARGUMENT] [KEYWORD]"; exit
+ echo " USAGE: $AMCLI $1 user/project [ARGUMENT] [KEYWORD]"
+ exit 1
fi
mkdir -p "$CACHEDIR/extra"
rm -f "$CACHEDIR/extra/$3"
@@ -369,9 +385,7 @@ while [ -n "$1" ]; do
fi
FUNCTION='curl -Ls '"$API_GITHUB_REPO"' | sed '"$q"'s/[()",{} ]/\\n/g'"$q"' | grep -oi "https.*mage$"'"$FILTER"' | head -1'
sed -i "s#FUNCTION)#$FUNCTION)#g" "$CACHEDIR/extra/$3"
- if [ -n "$4" ]; then
- sed -i "s# head -1# grep -i \"$4\" | head -1#g" "$CACHEDIR/extra/$3"
- fi
+ [ -n "$4" ] && sed -i "s# head -1# grep -i \"$4\" | head -1#g" "$CACHEDIR/extra/$3"
chmod a+x "$CACHEDIR/extra/$3"
"$AMCLIPATH" -i "$CACHEDIR/extra/$3"
exit 1
From e3e76b2acef1c74410c74ec3c5df81443a9fba70 Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 06:50:06 +0200
Subject: [PATCH 03/18] Update install.am: one more space
---
modules/install.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules/install.am b/modules/install.am
index 26d6839e7..4bf30b62a 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -355,6 +355,7 @@ while [ -n "$1" ]; do
printf "\n END OF ALL INSTALLATION PROCESSES\n"
printf " The following new programs have been installed:\n\n"
grep -w -v "◆ am" 0<"$AMCACHEDIR"/installed
+ echo ""
echo "############################################################################"
exit 0
else
From b02d84279b8d79b28dee5aa77a309c528b41ab66 Mon Sep 17 00:00:00 2001
From: Samuel <36420837+Samueru-sama@users.noreply.github.com>
Date: Thu, 15 Aug 2024 01:26:41 -0400
Subject: [PATCH 04/18] Fix error where function exiting wouldn't exit parent
function
---
modules/install.am | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules/install.am b/modules/install.am
index 4bf30b62a..05b2976ef 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -22,7 +22,7 @@ _spooky_check() {
read -p " Do you wish to continue? (N/y): " yn
if ! echo "$yn" | grep -i '^y' >/dev/null 2>&1; then
printf "\n INSTALLATION ABORTED!\n"
- exit 1
+ return 1
fi
fi
}
@@ -118,7 +118,8 @@ _dependency_check_utils() {
for name in $app_deps; do
if grep "^$name" ./"$arg" 1>/dev/null && ! command -v "$name" >/dev/null 2>&1; then
[ "$name" = "ar" ] && name="binutils"
- echo " 💀 ERROR: cannot install \"$arg\" without \"$name\"" && return 0
+ echo " 💀 ERROR: cannot install \"$arg\" without \"$name\""
+ return 1
fi
done
}
@@ -132,7 +133,7 @@ for metapackage in $METAPACKAGES; do
elif [ -d "$APPSPATH"/"$metapackage" ]; then
METAPACKAGE_NAME=$(echo "$metapackage" | tr '[:lower:]' '[:upper:]')
echo " ◆ \"$APPNAME\" IS PART OF \"$METAPACKAGE_NAME\", ALREADY INSTALLED"
- return 0
+ return 1
fi
fi
done
@@ -147,8 +148,8 @@ done
_install_arg() {
APPNAME=$(echo "\"$arg\"" | tr '[:lower:]' '[:upper:]')
chmod a+x ./"$arg"
- _metapackage_check
- _dependency_check_utils
+ _metapackage_check || return 1
+ _dependency_check_utils || return 1
if grep -q 'ffwa-' ./"$arg"; then
ffbrowser=$(find ${PATH//:/ } -maxdepth 1 -name "firefox*" | sort | head -1)
if [ -z "$ffbrowser" ]; then
@@ -191,7 +192,7 @@ _install_arg() {
return 0
fi
fi
- _spooky_check
+ _spooky_check || return 1
_if_latest
_apply_patches
echo ""
From a5bc68be8e25621fd110d36db91f6a6ac69a6707 Mon Sep 17 00:00:00 2001
From: Samuel <36420837+Samueru-sama@users.noreply.github.com>
Date: Thu, 15 Aug 2024 03:16:14 -0400
Subject: [PATCH 05/18] Flag ppsspp
---
programs/x86_64/ppsspp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/x86_64/ppsspp b/programs/x86_64/ppsspp
index dee3bde10..461b8de63 100644
--- a/programs/x86_64/ppsspp
+++ b/programs/x86_64/ppsspp
@@ -1,5 +1,5 @@
#!/bin/sh
-
+# spooky
# AM INSTALL SCRIPT VERSION 3.5
set -u
APP=ppsspp
From bded481c5bb15f9392db819d64204ad8243f18f3 Mon Sep 17 00:00:00 2001
From: Samuel <36420837+Samueru-sama@users.noreply.github.com>
Date: Thu, 15 Aug 2024 03:17:20 -0400
Subject: [PATCH 06/18] Flag tesseract
---
programs/x86_64/tesseract | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/x86_64/tesseract b/programs/x86_64/tesseract
index f987782b0..b1ad861ab 100644
--- a/programs/x86_64/tesseract
+++ b/programs/x86_64/tesseract
@@ -1,5 +1,5 @@
#!/bin/sh
-
+# spooky
# AM INSTALL SCRIPT VERSION 3.5
set -u
APP=tesseract
From a711f122295f03ed1108602e2136d082f04327a3 Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 16:45:24 +0200
Subject: [PATCH 07/18] Update install.am: check if a "icons" directory exists
---
modules/install.am | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/install.am b/modules/install.am
index 05b2976ef..1e2a50e7c 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -62,10 +62,12 @@ _post_installation_processes() {
# Check for AM-updater script sothat CLI can manage updates
[ -f "${LASTDIRPATH}"/AM-updater ] && mkdir "${LASTDIRPATH}"/.am-installer 2>/dev/null \
&& wget -q "$APPSDB"/"$arg" -O "${LASTDIRPATH}"/.am-installer/"$arg"
- find "${LASTDIRPATH}"/icons/* -xtype l -delete 2>/dev/null # Removes broken links
- # If you have a broken or missing icon in your "icons" directory, download one from the catalog
- [ -z "$(ls -A "${LASTDIRPATH}"/icons)" ] \
- && wget -q "$AMCATALOGUEICONS"/"$arg".png -O "${LASTDIRPATH}"/icons/"$arg"
+ if test -d "${LASTDIRPATH}"/icons; then
+ find "${LASTDIRPATH}"/icons/* -xtype l -delete 2>/dev/null # Removes broken links
+ # If you have a broken or missing icon in your "icons" directory, download one from the catalog
+ [ -z "$(ls -A "${LASTDIRPATH}"/icons)" ] \
+ && wget -q "$AMCATALOGUEICONS"/"$arg".png -O "${LASTDIRPATH}"/icons/"$arg"
+ fi
# Patch .desktop to change paths if the app is installed locally
if [ "$AMCLI" = "appman" ]; then
# Likely not needed anymore: "s#Icon=/opt#Icon=$HOME/$APPSDIR#g"
From 462994de1ce687fc843f23b8002c7a15b2eab980 Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 16:53:19 +0200
Subject: [PATCH 08/18] Update install.am: Samu's style
---
modules/install.am | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/modules/install.am b/modules/install.am
index 1e2a50e7c..e17e30be3 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -62,12 +62,10 @@ _post_installation_processes() {
# Check for AM-updater script sothat CLI can manage updates
[ -f "${LASTDIRPATH}"/AM-updater ] && mkdir "${LASTDIRPATH}"/.am-installer 2>/dev/null \
&& wget -q "$APPSDB"/"$arg" -O "${LASTDIRPATH}"/.am-installer/"$arg"
- if test -d "${LASTDIRPATH}"/icons; then
- find "${LASTDIRPATH}"/icons/* -xtype l -delete 2>/dev/null # Removes broken links
- # If you have a broken or missing icon in your "icons" directory, download one from the catalog
- [ -z "$(ls -A "${LASTDIRPATH}"/icons)" ] \
- && wget -q "$AMCATALOGUEICONS"/"$arg".png -O "${LASTDIRPATH}"/icons/"$arg"
- fi
+ find "${LASTDIRPATH}"/icons/* -xtype l -delete 2>/dev/null # Removes broken links
+ # If you have a broken or missing icon in your "icons" directory, download one from the catalog
+ [ -z "$(ls -A "${LASTDIRPATH}"/icons 2>/dev/null)" ] \
+ && wget -q "$AMCATALOGUEICONS"/"$arg".png -O "${LASTDIRPATH}"/icons/"$arg" 2>/dev/null
# Patch .desktop to change paths if the app is installed locally
if [ "$AMCLI" = "appman" ]; then
# Likely not needed anymore: "s#Icon=/opt#Icon=$HOME/$APPSDIR#g"
From f0f4e2fd86fde85421744739c014cfa7563c9d7b Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 17:12:44 +0200
Subject: [PATCH 09/18] Update install.am:fix "mv DirIcon" errors in AppImages
(Type1, ndr)
---
modules/install.am | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules/install.am b/modules/install.am
index e17e30be3..6a4adf8bd 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -42,6 +42,8 @@ _apply_patches() {
sed -i "s#wget #wget -q --no-verbose --show-progress --progress=bar #g" ./"$arg"
fi
sed -i "s# https://api.github.com#$HeaderA uthWithGITPAT https://api.github.com#g" ./"$arg"
+ sed -i 's#DirIcon$#DirIcon 2>/dev/null#g' ./"$arg"
+ sed -i 's#DirIcon ./icons/"$APP" 1#DirIcon ./icons/"$APP" 2#g' ./"$arg"
}
_am_remover_check() {
From 0dd20f319bd3d0e6eeb762ac432f23038711dd33 Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 18:07:48 +0200
Subject: [PATCH 10/18] Use "$SUDOCMD" instead of "$SUDOCOMMAND"
---
AM-INSTALLER | 6 +++---
APP-MANAGER | 14 +++++++-------
modules/install.am | 1 -
modules/management.am | 6 +++---
modules/sandboxes.am | 6 +++---
5 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/AM-INSTALLER b/AM-INSTALLER
index 63a72d49b..1c61da40a 100644
--- a/AM-INSTALLER
+++ b/AM-INSTALLER
@@ -28,14 +28,14 @@ _install_am() {
rm -f "$CACHEDIR"/INSTALL-AM.sh || true
wget -q https://raw.githubusercontent.com/ivan-hc/AM/main/INSTALL -O "$CACHEDIR"/INSTALL-AM.sh && chmod a+x "$CACHEDIR"/INSTALL-AM.sh
if command -v sudo >/dev/null 2>&1; then
- SUDOCOMMAND="sudo"
+ SUDOCMD="sudo"
elif command -v doas >/dev/null 2>&1; then
- SUDOCOMMAND="doas"
+ SUDOCMD="doas"
else
echo 'ERROR: No sudo or doas found'
exit 1
fi
- $SUDOCOMMAND "$CACHEDIR"/INSTALL-AM.sh && rm -f "$CACHEDIR"/INSTALL-AM.sh
+ $SUDOCMD "$CACHEDIR"/INSTALL-AM.sh && rm -f "$CACHEDIR"/INSTALL-AM.sh
}
# INSTALL "AM" LOCALLY, AS "APPMAN"
diff --git a/APP-MANAGER b/APP-MANAGER
index 1ca1f4bc6..89039174b 100755
--- a/APP-MANAGER
+++ b/APP-MANAGER
@@ -55,9 +55,9 @@ function _am() {
AMCLI="am"
AMCLIPATH="$AMCLI"
if command -v sudo >/dev/null 2>&1; then
- SUDOCOMMAND="sudo"
+ SUDOCMD="sudo"
elif command -v doas >/dev/null 2>&1; then
- SUDOCOMMAND="doas"
+ SUDOCMD="doas"
else
echo 'ERROR: No sudo or doas found'
exit 1
@@ -98,7 +98,7 @@ function _appman_initialize() {
mkdir -p "$BINDIR" "$DATADIR"/applications "$DATADIR"/icons
AMCLI="appman"
AMCLIPATH="$DIR/$AMCLI"
- SUDOCOMMAND=""
+ SUDOCMD=""
COMPLETIONPATH="$HOME"
COMPLETIONFILE=".bash_completion"
APPSPATH="$HOME/$APPSDIR"
@@ -232,7 +232,7 @@ function _am_security_check() {
_am_dependences_check
# Check and create the $AMPATH directory if it does not exist
if [ ! -d "$AMPATH" ]; then
- $SUDOCOMMAND mkdir -p "$AMPATH"
+ $SUDOCMD mkdir -p "$AMPATH"
fi
}
@@ -406,7 +406,7 @@ function _remove_info_files() {
function _use_disable-completion() {
if [ "$(grep -o "$AMCLI" 0<"$COMPLETIONPATH/$COMPLETIONFILE" | head -1)" = "$AMCLI" ]; then
grep -v 'complete -W "$(cat '"$AMPATH"'/list 2>/dev/null)" '"$AMCLI"'' "$COMPLETIONPATH/$COMPLETIONFILE" > "$AMPATH"/$COMPLETIONFILE.backup &&
- $SUDOCOMMAND mv "$AMPATH"/$COMPLETIONFILE.backup "$COMPLETIONPATH/$COMPLETIONFILE"
+ $SUDOCMD mv "$AMPATH"/$COMPLETIONFILE.backup "$COMPLETIONPATH/$COMPLETIONFILE"
echo " Completion disabled! "
else
echo " Completion script is NOT enabled! "
@@ -417,7 +417,7 @@ function _use_enable_completion() {
if [ "$(grep -o "$AMCLI" 0<"$COMPLETIONPATH/$COMPLETIONFILE" | head -1)" = "$AMCLI" ]; then
echo " Completion script is already enabled!"
else
- $SUDOCOMMAND mkdir -p "$COMPLETIONPATH"
+ $SUDOCMD mkdir -p "$COMPLETIONPATH"
if [ "$AMCLI" = appman ]; then
if ! test -f "$COMPLETIONPATH/$COMPLETIONFILE"; then
echo '#!/usr/bin/env bash' >> "$COMPLETIONFILE"
@@ -427,7 +427,7 @@ function _use_enable_completion() {
fi
echo 'complete -W "$(cat '"$AMPATH"'/list 2>/dev/null)" '"$AMCLI"'' >> "$COMPLETIONFILE"
chmod a+x "$COMPLETIONFILE"
- $SUDOCOMMAND mv "$COMPLETIONFILE" "$COMPLETIONPATH/" 2> /dev/null
+ $SUDOCMD mv "$COMPLETIONFILE" "$COMPLETIONPATH/" 2> /dev/null
echo " Completion has been enabled!"
fi
if [ -f "$HOME/.zshrc" ] || [ -f "$ZDOTDIR/.zshrc" ]; then
diff --git a/modules/install.am b/modules/install.am
index 6a4adf8bd..6d9782208 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -5,7 +5,6 @@
#############################################################################
BINDIR="${XDG_BIN_HOME:-$HOME/.local/bin}"
-SUDOCMD="$SUDOCOMMAND"
# If you use the --latest option, add the "latest" flag to scripts that point to a very common "release"
_if_latest() {
diff --git a/modules/management.am b/modules/management.am
index d52798417..d71b8f267 100644
--- a/modules/management.am
+++ b/modules/management.am
@@ -33,7 +33,7 @@ function _remove_check_removals() {
function _REMOVE() {
if ls "$APPSPATH"/$arg > /dev/null 2>&1; then
- $SUDOCOMMAND "$APPSPATH"/$arg/remove && sleep 0.5 && echo ' ◆ "'"$(echo $arg | tr a-z A-Z)"'" HAS BEEN SUCCESSFULLY REMOVED!'
+ $SUDOCMD "$APPSPATH"/$arg/remove && sleep 0.5 && echo ' ◆ "'"$(echo $arg | tr a-z A-Z)"'" HAS BEEN SUCCESSFULLY REMOVED!'
else
echo " - $arg" >> "$AMCACHEDIR"/unavailable-args
fi
@@ -43,12 +43,12 @@ function _remove() {
if ls "$APPSPATH"/$arg > /dev/null 2>&1; then
case $arg in
*)
- $SUDOCOMMAND echo "" > /dev/null; read -p ' ◆ DO YOU WISH TO REMOVE "'"$(echo $arg | tr a-z A-Z)"'" (Y,n)?' yn
+ $SUDOCMD echo "" > /dev/null; read -p ' ◆ DO YOU WISH TO REMOVE "'"$(echo $arg | tr a-z A-Z)"'" (Y,n)?' yn
case $yn in
[Nn]* )
echo ' - "'"$(echo $arg | tr a-z A-Z)"'" HAS NOT BEEN REMOVED!'; echo "";;
[Yy]*|* )
- $SUDOCOMMAND "$APPSPATH"/$arg/remove && sleep 0.5 && echo ' ◆ "'"$(echo $arg | tr a-z A-Z)"'" HAS BEEN SUCCESSFULLY REMOVED!';;
+ $SUDOCMD "$APPSPATH"/$arg/remove && sleep 0.5 && echo ' ◆ "'"$(echo $arg | tr a-z A-Z)"'" HAS BEEN SUCCESSFULLY REMOVED!';;
esac
esac
else
diff --git a/modules/sandboxes.am b/modules/sandboxes.am
index 07e6e01cf..96472e4cc 100644
--- a/modules/sandboxes.am
+++ b/modules/sandboxes.am
@@ -251,14 +251,14 @@ case "$1" in
printf '\n\033[32m%s\n' " User directories access configured successfully!"
fi
- chmod a+x "$AMCACHEDIR/sandbox-scripts/$2" && sed -i "s|DUMMY|$APPIMAGE|g; s|SUDO |$SUDOCOMMAND |g" "$AMCACHEDIR/sandbox-scripts/$2" || exit 1
+ chmod a+x "$AMCACHEDIR/sandbox-scripts/$2" && sed -i "s|DUMMY|$APPIMAGE|g; s|SUDO |$SUDOCMD |g" "$AMCACHEDIR/sandbox-scripts/$2" || exit 1
# Remove the exec permission from the AppImage and its updater for better safety™
- $SUDOCOMMAND rm -f "$TARGET" && chmod a-x "$APPIMAGE" &&
+ $SUDOCMD rm -f "$TARGET" && chmod a-x "$APPIMAGE" &&
sed -i 's|chmod a+x|chmod a-x|g' "$APPIMAGEPATH/AM-updater" || exit 1
# Put sandbox script in the place of the appimage symlink
- $SUDOCOMMAND mv "$AMCACHEDIR/sandbox-scripts/$2" "$TARGET" && rmdir "$AMCACHEDIR/sandbox-scripts" || exit 1
+ $SUDOCMD mv "$AMCACHEDIR/sandbox-scripts/$2" "$TARGET" && rmdir "$AMCACHEDIR/sandbox-scripts" || exit 1
printf '\n%s\n' " \"$2\" successfully sandboxed!"
printf '\n\033[0m%s\n' " The app will be sandboxed in \"${SANDBOXDIR:-$HOME/.local/am-sandboxes}\" once launched"
From 582a6034b690904a1630a448c3fcdc3dab7086ad Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 18:16:34 +0200
Subject: [PATCH 11/18] Update APP-MANAGER: revert previous commit only here
---
APP-MANAGER | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/APP-MANAGER b/APP-MANAGER
index 89039174b..1ca1f4bc6 100755
--- a/APP-MANAGER
+++ b/APP-MANAGER
@@ -55,9 +55,9 @@ function _am() {
AMCLI="am"
AMCLIPATH="$AMCLI"
if command -v sudo >/dev/null 2>&1; then
- SUDOCMD="sudo"
+ SUDOCOMMAND="sudo"
elif command -v doas >/dev/null 2>&1; then
- SUDOCMD="doas"
+ SUDOCOMMAND="doas"
else
echo 'ERROR: No sudo or doas found'
exit 1
@@ -98,7 +98,7 @@ function _appman_initialize() {
mkdir -p "$BINDIR" "$DATADIR"/applications "$DATADIR"/icons
AMCLI="appman"
AMCLIPATH="$DIR/$AMCLI"
- SUDOCMD=""
+ SUDOCOMMAND=""
COMPLETIONPATH="$HOME"
COMPLETIONFILE=".bash_completion"
APPSPATH="$HOME/$APPSDIR"
@@ -232,7 +232,7 @@ function _am_security_check() {
_am_dependences_check
# Check and create the $AMPATH directory if it does not exist
if [ ! -d "$AMPATH" ]; then
- $SUDOCMD mkdir -p "$AMPATH"
+ $SUDOCOMMAND mkdir -p "$AMPATH"
fi
}
@@ -406,7 +406,7 @@ function _remove_info_files() {
function _use_disable-completion() {
if [ "$(grep -o "$AMCLI" 0<"$COMPLETIONPATH/$COMPLETIONFILE" | head -1)" = "$AMCLI" ]; then
grep -v 'complete -W "$(cat '"$AMPATH"'/list 2>/dev/null)" '"$AMCLI"'' "$COMPLETIONPATH/$COMPLETIONFILE" > "$AMPATH"/$COMPLETIONFILE.backup &&
- $SUDOCMD mv "$AMPATH"/$COMPLETIONFILE.backup "$COMPLETIONPATH/$COMPLETIONFILE"
+ $SUDOCOMMAND mv "$AMPATH"/$COMPLETIONFILE.backup "$COMPLETIONPATH/$COMPLETIONFILE"
echo " Completion disabled! "
else
echo " Completion script is NOT enabled! "
@@ -417,7 +417,7 @@ function _use_enable_completion() {
if [ "$(grep -o "$AMCLI" 0<"$COMPLETIONPATH/$COMPLETIONFILE" | head -1)" = "$AMCLI" ]; then
echo " Completion script is already enabled!"
else
- $SUDOCMD mkdir -p "$COMPLETIONPATH"
+ $SUDOCOMMAND mkdir -p "$COMPLETIONPATH"
if [ "$AMCLI" = appman ]; then
if ! test -f "$COMPLETIONPATH/$COMPLETIONFILE"; then
echo '#!/usr/bin/env bash' >> "$COMPLETIONFILE"
@@ -427,7 +427,7 @@ function _use_enable_completion() {
fi
echo 'complete -W "$(cat '"$AMPATH"'/list 2>/dev/null)" '"$AMCLI"'' >> "$COMPLETIONFILE"
chmod a+x "$COMPLETIONFILE"
- $SUDOCMD mv "$COMPLETIONFILE" "$COMPLETIONPATH/" 2> /dev/null
+ $SUDOCOMMAND mv "$COMPLETIONFILE" "$COMPLETIONPATH/" 2> /dev/null
echo " Completion has been enabled!"
fi
if [ -f "$HOME/.zshrc" ] || [ -f "$ZDOTDIR/.zshrc" ]; then
From d405fa984aade6d154faf9e377c2b47b631afe18 Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 18:20:15 +0200
Subject: [PATCH 12/18] Prevent partial updates in modules
...just add SUDOCMD="$SUDOCOMMAND" on top
---
modules/install.am | 1 +
modules/management.am | 2 ++
modules/sandboxes.am | 2 ++
3 files changed, 5 insertions(+)
diff --git a/modules/install.am b/modules/install.am
index 6d9782208..6a4adf8bd 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -5,6 +5,7 @@
#############################################################################
BINDIR="${XDG_BIN_HOME:-$HOME/.local/bin}"
+SUDOCMD="$SUDOCOMMAND"
# If you use the --latest option, add the "latest" flag to scripts that point to a very common "release"
_if_latest() {
diff --git a/modules/management.am b/modules/management.am
index d71b8f267..8c0390261 100644
--- a/modules/management.am
+++ b/modules/management.am
@@ -4,6 +4,8 @@
# THIS MODULE INCLUDES ALL THE ACTIONS INTENDED TO MANAGE THE APPS INSTALLED FROM THE DATABASE
##############################################################################################
+SUDOCMD="$SUDOCOMMAND"
+
case $2 in
'') echo " USAGE: $AMCLI $1 [ARGUMENT]"; exit;;
esac
diff --git a/modules/sandboxes.am b/modules/sandboxes.am
index 96472e4cc..525fa6c49 100644
--- a/modules/sandboxes.am
+++ b/modules/sandboxes.am
@@ -4,6 +4,8 @@
# THIS MODULE INCLUDES ALL ACTIONS INTENDED TO ISOLATE DOTFILES OR CONTAINERIZE INSTALLED APPIMAGES
###################################################################################################
+SUDOCMD="$SUDOCOMMAND"
+
# Set a dedicated .home directory for a selected AppImage
_home() {
if [ ! -d "$APPSPATH"/"$arg" ]; then
From 3c519799369bfe63cb546d4dd7ab7de4a439e39a Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 18:24:51 +0200
Subject: [PATCH 13/18] Update README.md
---
README.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/README.md b/README.md
index 88e9e39b0..0cd42760b 100644
--- a/README.md
+++ b/README.md
@@ -3,12 +3,10 @@
-
| [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) |
| - | - | - |
| [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) | [
](https://github.com/ivan-hc/AM) |
-
"AM"/"AppMan" is a set of scripts and modules for installing, updating, and managing AppImage packages and other portable formats, in the same way that APT manages DEBs packages, DNF the RPMs, and so on... using a large database of Shell scripts inspired by the Arch User Repository, each dedicated to an app or set of applications.
From 70bbb3149c5b0686da65360df998f72e7c4fabad Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 19:40:54 +0200
Subject: [PATCH 14/18] Update install.am: add colors
---
modules/install.am | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/modules/install.am b/modules/install.am
index 6a4adf8bd..a60b4eef0 100644
--- a/modules/install.am
+++ b/modules/install.am
@@ -16,9 +16,10 @@ _if_latest() {
_spooky_check() {
if grep -i spooky ./"$arg" >/dev/null 2>&1; then
- echo " WARNING: \"$arg\" does not have a transparent build process"
+ printf "\n ${RED}WARNING: \"$arg\" does not have a transparent build process! \033[0m\n\n"
echo " We can't be sure as to what is inside the application"
echo " We highly recommend that you sandbox this application"
+ echo ""
read -p " Do you wish to continue? (N/y): " yn
if ! echo "$yn" | grep -i '^y' >/dev/null 2>&1; then
printf "\n INSTALLATION ABORTED!\n"
@@ -99,10 +100,10 @@ _ending_the_installation() {
APPSIZE=$(du -sm "${LASTDIRPATH}" | awk '{print $1}' )
if [ -n "$metascript" ]; then
METASCRIPT_NAME=$(echo "\"$metascript\"" | tr '[:lower:]' '[:upper:]')
- echo -ne " $METASCRIPT_NAME INSTALLED ($APPSIZE MB OF DISK SPACE)\n"
+ echo -ne " ${Green}$METASCRIPT_NAME INSTALLED\033[0m ($APPSIZE MB OF DISK SPACE)\n"
unset metascript
else
- echo -ne " $APPNAME INSTALLED ($APPSIZE MB OF DISK SPACE)\n"
+ echo -ne " ${Green}$APPNAME INSTALLED\033[0m ($APPSIZE MB OF DISK SPACE)\n"
fi
$SUDOCMD rm "$AMCACHEDIR"/"$arg"
_check_version
@@ -183,7 +184,7 @@ _install_arg() {
fi
fi
# Check if you are installing an app or a library
- echo "◆ $APPNAME: starting installation script"
+ echo " ◆ $APPNAME: starting installation script"
if grep -qi "^wget.*.sh.*chmod.*&&" ./"$arg"; then
printf "\n This script will create an AppImage on the fly, please wait...\n"
elif grep -q "/usr/local/lib" ./"$arg"; then
@@ -304,11 +305,11 @@ while [ -n "$1" ]; do
esac
[ "$AMCLI" = "am" ] && { $SUDOCMD echo -ne "\r" || exit 1; }
- echo "############################################################################"
- echo "## ##"
- echo "## START OF ALL INSTALLATION PROCESSES ##"
- echo "## ##"
- echo "############################################################################"
+ echo "============================================================================"
+ echo ""
+ echo -e " ${LightBlue}START OF ALL INSTALLATION PROCESSES\033[0m"
+ echo ""
+ echo "============================================================================"
_clean_amcachedir 2>/dev/null
echo "$@" | tr ' ' '\n' >> "$AMCACHEDIR"/install-args
ARGS=$(tail -n +2 "$AMCACHEDIR"/install-args | grep -v -- "--")
@@ -354,12 +355,12 @@ while [ -n "$1" ]; do
esac
done
if [ -f "$AMCACHEDIR"/installed ]; then
- echo "############################################################################"
- printf "\n END OF ALL INSTALLATION PROCESSES\n"
- printf " The following new programs have been installed:\n\n"
+ echo "============================================================================"
+ echo -e "\n ${LightBlue}END OF ALL INSTALLATION PROCESSES\n\033[0m"
+ echo -e " The following new programs have been installed:\n"
grep -w -v "◆ am" 0<"$AMCACHEDIR"/installed
echo ""
- echo "############################################################################"
+ echo "============================================================================"
exit 0
else
exit 1
From 0873dfe9e3f8af8f94771de4d21fa85aeeef29bc Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 19:41:34 +0200
Subject: [PATCH 15/18] Update APP-MANAGER
---
APP-MANAGER | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/APP-MANAGER b/APP-MANAGER
index 1ca1f4bc6..3f289f54a 100755
--- a/APP-MANAGER
+++ b/APP-MANAGER
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-AMVERSION="7.6.2"
+AMVERSION="7.7"
# Determine main repository and branch
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
From 32607243f42fec4642f73927f343369399c4be2d Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 20:02:01 +0200
Subject: [PATCH 16/18] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 0cd42760b..3d49825d0 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,8 @@
| [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) |
| - | - | - |
-| [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) |
+| [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) |
+| [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) | [](https://github.com/ivan-hc/AM) |
From 801ee9221bae4f3490cb0331d1c70a88fa72690c Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 20:29:52 +0200
Subject: [PATCH 17/18] Update README.md
---
README.md | 41 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 3d49825d0..12b654268 100644
--- a/README.md
+++ b/README.md
@@ -808,7 +808,10 @@ This section is committed to giving small demonstrations of each available optio
__________________________________________________________________________
### Install applications
-Option `-i` or `install`, usage:
+The option `-i` or `install` is the one responsible of the installation of apps or libraries.
+
+#### Install, normal behaviour
+This is the normal syntax:
```
am -i $PROGRAM
```
@@ -816,9 +819,39 @@ or
```
appman -i $PROGRAM
```
-in this video I'll install AnyDesk and LXtask:
+in this video I'll install AnyDesk:
+
+https://github.com/user-attachments/assets/62bc7444-8b1f-4db2-b23b-db7219eec15d
+
+#### Install, debug an installation script
+The "install.am" module contains some patches to disable long messages. You can see them with the suboption `--debug`:
+```
+am -i --debug $PROGRAM
+```
+or
+```
+appman -i --debug $PROGRAM
+```
+let test again the installation of AnyDesk using the `--debug` flag:
-https://github.com/ivan-hc/AM/assets/88724353/c2e8b654-29d3-4ded-8877-f77ef11d58fc
+https://github.com/user-attachments/assets/9dd73186-37e2-4742-887e-4f98192bd764
+
+#### Install the "latest" release instead of the more recent one
+By default, many installation scripts for apps hosted on github will point to the more recent generic release instead of "latest", which is normally used to indicate that the build is "stable". This is because upstream developers do not always guarantee a certain packaging format in "latest", sometimes they may only publish packages for Windows or macOS, so pointing to "latest" would not guarantee that any package for Linux will be installed.
+
+On the other hand, if you know that the upstream developer will always guarantee a Linux package in "latest" and "AM" instead points to a potentially unstable development version (Alpha, Beta, RC...), this is the syntax to adopt:
+```
+am -i --force-latest $PROGRAM
+```
+or
+```
+appman -i --force-latest $PROGRAM
+```
+in this video I'll install "SqliteBrowser" using the `--force-latest` flag:
+
+https://github.com/user-attachments/assets/ee29adfd-90e1-46f7-aed9-b9c410f68776
+
+See also "[The script points to "releases" instead of downloading the latest stable](#the-script-points-to-releases-instead-of-downloading-the-latest-stable)".
------------------------------------------------------------------------
@@ -1400,6 +1433,8 @@ sed -i 's#releases -O -#releases/latest -O -#g' /opt/$PROGRAM/AM-updater
am -u $PROGRAM
```
+See also "[Install the "latest" release instead of the more recent one](install-the-latest-release-instead-of-the-more-recent-one)".
+
------------------------------------------------------------------------
### Wrong download link
The reasons may be two:
From 1c9d56ceb5bf8e44a47e36f75980747b0c315294 Mon Sep 17 00:00:00 2001
From: iVAN <88724353+ivan-hc@users.noreply.github.com>
Date: Thu, 15 Aug 2024 20:36:25 +0200
Subject: [PATCH 18/18] Update README.md
---
README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 12b654268..c09cfefae 100644
--- a/README.md
+++ b/README.md
@@ -807,10 +807,10 @@ This section is committed to giving small demonstrations of each available optio
- [Third-party databases for applications (NeoDB)](#third-party-databases-for-applications-neodb)
__________________________________________________________________________
-### Install applications
+## Install applications
The option `-i` or `install` is the one responsible of the installation of apps or libraries.
-#### Install, normal behaviour
+### Install, normal behaviour
This is the normal syntax:
```
am -i $PROGRAM
@@ -823,7 +823,7 @@ in this video I'll install AnyDesk:
https://github.com/user-attachments/assets/62bc7444-8b1f-4db2-b23b-db7219eec15d
-#### Install, debug an installation script
+### Install, debug an installation script
The "install.am" module contains some patches to disable long messages. You can see them with the suboption `--debug`:
```
am -i --debug $PROGRAM
@@ -836,7 +836,7 @@ let test again the installation of AnyDesk using the `--debug` flag:
https://github.com/user-attachments/assets/9dd73186-37e2-4742-887e-4f98192bd764
-#### Install the "latest" release instead of the more recent one
+### Install the "latest" stable release instead of the latest "unstable"
By default, many installation scripts for apps hosted on github will point to the more recent generic release instead of "latest", which is normally used to indicate that the build is "stable". This is because upstream developers do not always guarantee a certain packaging format in "latest", sometimes they may only publish packages for Windows or macOS, so pointing to "latest" would not guarantee that any package for Linux will be installed.
On the other hand, if you know that the upstream developer will always guarantee a Linux package in "latest" and "AM" instead points to a potentially unstable development version (Alpha, Beta, RC...), this is the syntax to adopt:
@@ -1433,7 +1433,7 @@ sed -i 's#releases -O -#releases/latest -O -#g' /opt/$PROGRAM/AM-updater
am -u $PROGRAM
```
-See also "[Install the "latest" release instead of the more recent one](install-the-latest-release-instead-of-the-more-recent-one)".
+See also "[Install the "latest" stable release instead of the latest "unstable"](#install-the-latest-stable-release-instead-of-the-latest-unstable)".
------------------------------------------------------------------------
### Wrong download link