Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: AppImage release workflow

on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g. 10.5.1)'
required: true
type: string
push:
tags:
- '[0-9]*'

jobs:
build:
name: "Build AppImage (${{ matrix.arch }})"
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runs-on: ubuntu-latest
image: ghcr.io/pkgforge-dev/archlinux:x86_64
platform: linux/amd64
qemu: false
- arch: aarch64
runs-on: ubuntu-24.04-arm
image: ghcr.io/pkgforge-dev/archlinux:aarch64
platform: linux/arm64
qemu: false
# The remaining arches are built inside their Arch Linux container
# images, emulated with QEMU on an x86_64 runner (the build tools -
# appimagetool, sharun, mkdwarfs - must run on the target arch).
#
# DISABLED for now: AM's database does not ship installation
# scripts for these architectures yet (see the `programs/`
# directory). Uncomment the entries below to enable them again
# once app repos for those architectures are introduced.
# - arch: riscv64
# runs-on: ubuntu-latest
# image: ghcr.io/pkgforge-dev/archlinux:riscv64
# platform: linux/riscv64
# qemu: true
# - arch: loongarch64
# runs-on: ubuntu-latest
# image: ghcr.io/pkgforge-dev/archlinux:loongarch64
# platform: linux/loong64
# qemu: true
# - arch: ppc64le
# runs-on: ubuntu-latest
# image: ghcr.io/pkgforge-dev/archlinux:ppc64le
# platform: linux/ppc64le
# qemu: true
# NOTE: big-endian `powerpc64` is not supported - tonistiigi/binfmt
# does not register a qemu-ppc64 handler, so it cannot be emulated.
# QEMU builds are skipped on pull requests to keep PR CI fast.
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Register QEMU binfmt
if: ${{ matrix.qemu && github.event_name != 'pull_request' }}
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4.3.0
- name: Build AppImage
if: ${{ !matrix.qemu || github.event_name != 'pull_request' }}
run: |
docker run --rm \
--platform ${{ matrix.platform }} \
-v "$PWD:/build" -w /build \
-e GITHUB_REPOSITORY="${{ github.repository }}" \
${{ matrix.image }} \
/bin/sh -c "sh appimage/get-dependencies.sh && sh appimage/make-appimage.sh ${{ matrix.arch }} ${{ github.event.inputs.tag }}"
- name: Upload artifact
if: ${{ !matrix.qemu || github.event_name != 'pull_request' }}
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: AppImage-${{ matrix.arch }}
path: dist

release:
# Triggered by a manually published GitHub release (ivan-hc pushes a new
# version, writing the release notes himself): build from that tag and
# attach the AppImages to that very release.
needs: [build]
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
pattern: AppImage-*
merge-multiple: true
- name: Attach AppImages to the release
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
with:
tag_name: ${{ github.event.inputs.tag }}
name: "\"AM\" ${{ github.event.inputs.tag }}"
body: Latest development build with continuous improvements. See [recent commits](https://github.com/${{ github.repository }}/commits/main) for details.
files: |
*.AppImage
*.AppImage.zsync

27 changes: 18 additions & 9 deletions AM-INSTALLER
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ _install_am() {
SCRIPT="$CACHEDIR/INSTALL-AM.sh"
mkdir -p "$CACHEDIR" || true
rm -f "$CACHEDIR"/INSTALL-AM.sh || true
_script_downloader && chmod a+x "$CACHEDIR"/INSTALL-AM.sh
#cp ./INSTALL "$CACHEDIR"/INSTALL-AM.sh && chmod a+x "$CACHEDIR"/INSTALL-AM.sh # for developers
if command -v sudo >/dev/null 2>&1; then
SUDOCMD="sudo"
Expand All @@ -82,7 +81,13 @@ _install_am() {
echo "ERROR: No sudo or doas found"
exit 1
fi
$SUDOCMD "$CACHEDIR"/INSTALL-AM.sh && rm -f "$CACHEDIR"/INSTALL-AM.sh
if [ -n "$APPIMAGE" ]; then
\cp -f "$APPDIR"/bin/INSTALL-AM-APPIMAGE.sh "$CACHEDIR"/
$SUDOCMD "$CACHEDIR"/INSTALL-AM-APPIMAGE.sh "$APPIMAGE" && rm -f "$CACHEDIR"/INSTALL-AM-APPIMAGE.sh
else
_script_downloader && chmod a+x "$CACHEDIR"/INSTALL-AM.sh
$SUDOCMD "$CACHEDIR"/INSTALL-AM.sh && rm -f "$CACHEDIR"/INSTALL-AM.sh
fi
}

# INSTALL "AM" LOCALLY, AS "APPMAN"
Expand All @@ -109,13 +114,17 @@ _install_appman() {
SCRIPT="$BINDIR/appman"
echo '--------------------------------------------------------------------------'
printf " %bInstalling \"AppMan\" in %b\033[0m\n" "${Green}" "$BINDIR"
_script_downloader && chmod a+x "$BINDIR"/appman
echo '--------------------------------------------------------------------------'
printf " %bThe following modules will be installed gradually, as you use AppMan\033[0m\n" "${Green}"
MODULES=$(sort "$SCRIPT" | tr '"' '\n' | grep "[a-z]\.am$")
for module_name in $MODULES; do
echo " ◆ https://raw.githubusercontent.com/ivan-hc/AM/$AM_BRANCH/modules/$module_name"
done
if [ -n "$APPIMAGE" ]; then
\mv -f "$APPIMAGE" "$SCRIPT"
else
_script_downloader && chmod a+x "$SCRIPT"
echo '--------------------------------------------------------------------------'
printf " %bThe following modules will be installed gradually, as you use AppMan\033[0m\n" "${Green}"
MODULES=$(sort "$SCRIPT" | tr '"' '\n' | grep "[a-z]\.am$")
for module_name in $MODULES; do
echo " ◆ https://raw.githubusercontent.com/ivan-hc/AM/$AM_BRANCH/modules/$module_name"
done
fi
echo '--------------------------------------------------------------------------'
printf " %b\"AppMan\" has been successfully installed! \033[0m\n\n" "${Green}"
printf " To use 'appman' in your current terminal, please run\n" "${LightBlue}"
Expand Down
64 changes: 54 additions & 10 deletions APP-MANAGER
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@ AMVERSION="10.5"
# Determine main repository and branch
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"

# Determine if AM is an AppImage
IS_APPIMAGE=$([[ -n "$APPIMAGE" && -f "$APPIMAGE" ]] && [[ -n "$APPDIR" && -d "$APPDIR" && -f "$APPDIR/AppRun" ]] && echo 1) || unset IS_APPIMAGE

# Determine the name of this script and its working directory
export REALDIR="$PWD"
DIR="$(cd "${0%/*}" && echo "$PWD")"
CLI="${0##*/}"
CLI_PATH="$(readlink -f "$0")"
if [ -n "$IS_APPIMAGE" ]; then
DIR="$(cd "${APPIMAGE%/*}" && echo "$PWD")"
CLI=$([ "${APPIMAGE##*/}" == "APP-MANAGER" ] && echo "am" || echo "appman")
CLI_PATH="$(readlink -f "$APPIMAGE")"
else
DIR="$(cd "${0%/*}" && echo "$PWD")"
CLI="${0##*/}"
CLI_PATH="$(readlink -f "$0")"
fi

# Determine system architecture and current user
ARCH="$(uname -m)"
Expand Down Expand Up @@ -435,7 +444,9 @@ _appman() {
printf $"%b ⚠️ WARNING\033[0m: \"%b%b\033[0m\" is not in PATH, local apps may not run.\n" "${RED}" "${LightBlue}" "$BINDIR"
fi
MODULES_PATH="$AMPATH/modules"
if [ "$CLI" = am ] && [ -f "$APPMANCONFIG"/appman-mode ] && [ -d /usr/lib/am/modules ]; then
if [ -n "$IS_APPIMAGE" ]; then
MODULES_PATH="$APPDIR"/share/modules
elif [ "$CLI" = am ] && [ -f "$APPMANCONFIG"/appman-mode ] && [ -d /usr/lib/am/modules ]; then
MODULES_PATH="/usr/lib/am/modules"
elif [ "$CLI" = am ] && [ -f "$APPMANCONFIG"/appman-mode ] && [ -d "$(readlink -f /opt)/am/modules" ]; then
MODULES_PATH="$(readlink -f /opt)/am/modules"
Expand All @@ -459,7 +470,13 @@ _am() {
APPSPATH="$(readlink -f /opt)"
AMPATH="$APPSPATH/$AMCLI"
_create_cache_dir
MODULES_PATH="$AMPATH/modules"
if [ -n "$IS_APPIMAGE" ]; then
# If AppImage, use built in modules and export PATH for bundled binaries in $APPDIR/bin
MODULES_PATH="$APPDIR"/share/modules
SUDOCMD="$SUDOCMD PATH=$APPDIR/bin/:$PATH"
else
MODULES_PATH="$AMPATH/modules"
fi
}

# DETERMINE WHEN TO USE "AM" OR "APPMAN"
Expand Down Expand Up @@ -571,7 +588,9 @@ AMDATADIR="$DATADIR/AM"
mkdir -p "$AMDATADIR"

_betatester_message_on() {
if [ -f "$AMDATADIR"/betatester ]; then
if [ -n "$IS_APPIMAGE" ]; then
rm -f "$AMDATADIR"/betatester
elif [ -f "$AMDATADIR"/betatester ]; then
echo "$DIVIDING_LINE"; echo $"\"$AMCLIUPPER\" $AMVERSION: DEVELOPER MODE"; echo "$DIVIDING_LINE"
fi
}
Expand Down Expand Up @@ -892,7 +911,11 @@ _am_newrepo_check() {
AMBRANCH=$(basename "$AMREPO")
export APPSDB="$AMREPO/programs/$ARCH"
export APPSLISTDB="$AMREPO/programs/$ARCH-apps"
export MODULES_PATH="$AMPATH/modules"
if [ -n "$IS_APPIMAGE" ]; then
export MODULES_PATH="$APPDIR/share/modules"
else
export MODULES_PATH="$AMPATH/modules"
fi
if [ "$1" != "newrepo" ] && [ "$1" != "neodb" ]; then
echo "$DIVIDING_LINE"; echo $" Source: $AMREPO"; echo "$DIVIDING_LINE"
fi
Expand Down Expand Up @@ -1834,6 +1857,7 @@ _sync_locale() {
}

_sync_modules() {
[ -n "$IS_APPIMAGE" ] && return 0; # Skip module update for AppImages
printf $"%b\n Check for updates in modules...\n" "$DIVIDING_LINE"
MODULES=$(echo "$AMCLI_ONLINE_CONTENT" | tr '"' '\n' | grep "[a-z]\.am$")
for module_name in $MODULES; do
Expand Down Expand Up @@ -1862,9 +1886,27 @@ _sync_amcli() {
echo -ne $"\n ◆ SYNCHRONIZING \"$AMCLIUPPER\" VERSION \"$CURRENT_AM_VERSION\"...\r" && sleep 0.25
_clean_amcachedir 1>/dev/null
cd "$AMCACHEDIR" || return 1
echo "$AMCLI_ONLINE_CONTENT" > ./APP-MANAGER && chmod a+x ./APP-MANAGER
echo y | mv ./APP-MANAGER "$CLI_PATH"
NEW_AM_VERSION=$(echo "$AMCLI_ONLINE_CONTENT" | grep "^AMVERSION=" | tr '"' '\n' | grep "^[0-9]")
if [ -z "$IS_APPIMAGE" ]; then
echo "$AMCLI_ONLINE_CONTENT" > ./APP-MANAGER && chmod a+x ./APP-MANAGER
echo y | mv ./APP-MANAGER "$CLI_PATH"
else
checksum_sha1=$(sha1sum "$CLI_PATH" | awk '{print $1}')
download_url="https://github.com/ivan-hc/AM/releases/download/$NEW_AM_VERSION/APP-MANAGER-$ARCH.AppImage"
digest=$(curl -Lsf "$download_url.zsync" | grep -a "SHA\|MD5" | tr -d '\0')
results=$(echo "$digest" | grep -a "$checksum_sha1")
if [ -z "$results" ]; then
_use_online_downloader "$download_url" APP-MANAGER && chmod a+x ./APP-MANAGER
checksum_sha1=$(sha1sum APP-MANAGER | awk '{print $1}')
results_new=$(echo "$digest" | grep -a "$checksum_sha1")
if [ -z "$results_new" ]; then
printf $" ◆ Update failed, please try again later.\n\n" && return 0
else
\mv -f "$CLI_PATH" APP-MANAGER.old
\mv -f APP-MANAGER "$CLI_PATH"
fi
fi
fi
if [ ! "$CURRENT_AM_VERSION" = "$NEW_AM_VERSION" ]; then
echo -ne $" A new release of \"$AMCLIUPPER\" is available, please wait...\r"
echo $" ◆ \"$AMCLIUPPER\" IS NOW UPDATED TO THE BRAND NEW \"$NEW_AM_VERSION\" VERSION!"
Expand All @@ -1887,7 +1929,7 @@ _use_sync() {
AMCLI_ONLINE_CONTENT=$(_use_online_reading_tool "$AMREPO"/APP-MANAGER)
if echo "$AMCLI_ONLINE_CONTENT" | grep -q AMCLI; then
if [ "$CLI" = am ]; then
if [ -f "$APPMANCONFIG"/appman-mode ]; then
if [ -f "$APPMANCONFIG"/appman-mode ] && [ -z "$IS_APPIMAGE" ]; then
if [ -d "$(readlink -f /opt)/am/modules" ]; then
MODULES_PATH="$(readlink -f /opt)/am/modules"
if [ -w "$(readlink -f /opt)/am" ]; then
Expand Down Expand Up @@ -2389,6 +2431,8 @@ case "$1" in
'devmode-disable'|'devmode-enable'|'--devmode-disable'|'--devmode-enable')
if [ "$CLI_PATH" = "/usr/bin/am" ]; then
echo $"This feature is disabled by your organization" | _fit
elif [ -n "$IS_APPIMAGE" ]; then
echo $"This feature is not available for AM in AppImage mode" | _fit
else
if [ "$1" = "--devmode-disable" ]; then
rm -f "$AMDATADIR"/betatester
Expand Down
27 changes: 17 additions & 10 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ RED='\033[0;31m'; LightBlue='\033[1;34m'; Green='\033[0;32m'
# For developers
[ -z "$AM_BRANCH" ] && AM_BRANCH="main"

# Determine if it is AppImage installation flow, get $APPIMAGE from parent script via $1
[ "${0##*/}" = "INSTALL-AM-APPIMAGE.sh" ] && APPIMAGE=$1 || unset APPIMAGE

# Function to check online connections (uses github.com by default, as the database and CLI itself are stored/hosted there)
_online_check_tool() {
if command -v wget >/dev/null 2>&1; then
Expand Down Expand Up @@ -61,7 +64,7 @@ fi
# INSTALL "AM"
_prepare_am_directory() {
# CREATE AND ENTER THE MAIN DIRECTORY FOR "AM"
mkdir -p /opt/am/modules /usr/local/bin && cd /opt/am || exit 1
mkdir -p /opt/am /usr/local/bin && cd /opt/am || exit 1

# CREATE THE SCRIPT NEEDED TO UNINSTALL "AM"
printf '#!/bin/sh\n\nset -e\n' > /opt/am/remove
Expand All @@ -70,10 +73,12 @@ _prepare_am_directory() {
printf '%s\n' 'rm -R -f /opt/am' >> /opt/am/remove
chmod a+x /opt/am/remove || exit 1

# DOWNLOAD THE MAIN SCRIPT
# DOWNLOAD THE MAIN SCRIPT OR MOVE APPIMAGE INTO /OPT/AM
URL="https://raw.githubusercontent.com/ivan-hc/AM/$AM_BRANCH/APP-MANAGER"
SCRIPT="APP-MANAGER"
if ! _script_downloader; then
if [ -n "$APPIMAGE" ]; then
\mv -f "$APPIMAGE" "$SCRIPT"
elif ! _script_downloader; then
echo "💀 ERROR: Cannot download am"
exit 1
fi
Expand All @@ -90,7 +95,7 @@ _prepare_am_directory() {

_download_am_modules() {
# DOWNLOAD MODULES
cd /opt/am/modules || exit
mkdir -p /opt/am/modules && cd /opt/am/modules || exit
if [ -z "$MODULES" ]; then
echo "💀 ERROR: Cannot download am modules"
exit 1
Expand All @@ -104,17 +109,19 @@ _download_am_modules() {
fi
done
cd ..

# ENABLE NON-ROOT PERMISSIONS TO THE MAIN DIRECTORY FOR THE CURRENT USER
chown -R "${SUDO_USER:-$DOAS_USER}" /opt/am
}

echo '--------------------------------------------------------------------------'
printf " %bInstalling \"AM\" in /opt/am\033[0m\n" "${Green}"
_prepare_am_directory
echo '--------------------------------------------------------------------------'
printf " %bInstalling modules\033[0m\n" "${Green}"
_download_am_modules
# ONLY DOWNLOAD MODULES FOR NON-APPIMAGE INSTALL
if [ -z "$APPIMAGE" ]; then
echo '--------------------------------------------------------------------------'
printf " %bInstalling modules\033[0m\n" "${Green}"
_download_am_modules
fi
# ENABLE NON-ROOT PERMISSIONS TO THE MAIN DIRECTORY FOR THE CURRENT USER
chown -R "${SUDO_USER:-$DOAS_USER}" /opt/am
echo '--------------------------------------------------------------------------'
printf " %b\"AM\" has been successfully installed! \033[0m\n\n" "${Green}"
printf " Please, run \"%bam -h\033[0m\" to see the list of the options.\n" "${LightBlue}"
Expand Down
12 changes: 12 additions & 0 deletions appimage/APP-MANAGER.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Desktop Entry]
Name=APP-MANAGER
Comment=AppImage Package Manager: Manage AppImages like never before!
Exec=APP-MANAGER
Icon=APP-MANAGER
Type=Application
Categories=System;Settings;
Terminal=false
StartupNotify=false
Keywords=package;manager;appman;am;terminal;
#StartupWMClass=APP-MANAGER

23 changes: 23 additions & 0 deletions appimage/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

if [ -z "$1" ] && [ ! -t 1 ]; then
if command -v am >/dev/null 2>&1 && [ -e /opt/am/APP-MANAGER ]; then
AM_EXEC_CMD="am -h"
elif command -v appman >/dev/null 2>&1; then
AM_EXEC_CMD="appman -h"
else
AM_EXEC_CMD="$APPDIR/bin/AM-INSTALLER"
fi
for TERM_CMD in x-terminal-emulator\ -e gnome-terminal\ -- konsole\ -e xfce4-terminal\ -e mate-terminal\ -e lxterminal\ -e terminator\ -e urxvt\ -e xterm\ -e; do
if command -v "$(echo "$TERM_CMD" | cut -d' ' -f1)" >/dev/null 2>&1; then
exec $TERM_CMD sh -c "$AM_EXEC_CMD; printf '\nPress CTRL+C to close this window...\n'; sleep 1h"
fi
done
else
if [ "$1" = "setup" ] && ! command -v am >/dev/null 2>&1 && ! command -v appman >/dev/null 2>&1 && [ ! -e /opt/am/APP-MANAGER ]; then
exec "$APPDIR/bin/AM-INSTALLER"
else
exec "$APPDIR/bin/APP-MANAGER" "$@"
fi
fi

Loading