GitHub and AppImageHub support, fix environment variables

removes the apps/appimage script that did this. should function identically

replaces version numbering with dates because incrementing is a nightmare
This commit is contained in:
Phantop 2022-06-25 21:13:25 -04:00
parent fb2f691b21
commit 95be3a7d5d
6 changed files with 32 additions and 28 deletions

2
AppRun
View File

@ -1,4 +1,4 @@
#!/bin/sh
export PATH="${APPDIR}"/bin:"$PATH"
export LD_LIBRARY_PATH="${APPDIR}"/lib64:"${APPDIR}"/lib:"$LD_LIBRARY_PATH"
exec "$APPDIR/$ARGV0" "$@"
exec "$APPDIR/$(basename "$ARGV0")" "$@"

View File

@ -19,9 +19,11 @@ If you only wish to run an existing image, only `dwarfs` is needed in PATH.
## How to create an appdwarf
For your own programs, simply create an AppImage-style AppDir and run `appdwarf {directory}`.
You can also invoke `appdwarf -a {AppImage}` to convert an AppImage.
I suggest checking the help (listed via `appdwarf --help`) for other options.
`appdwarf` can take both AppImage files and extracted AppDirs as input. If a file
or folder is not found, `appdwarf` will also accept direct URLs to AppImages, links
or names to GitHub repos with AppImages in their releases page, or names of programs
that meet the GitHub criteria on AppImageHub. Any files that are found but are not
AppImages will be compressed using `zzexe`.
The apps folder contains other scripts for specific programs that will download all
necessary files and create a resulting appdwarf in the same folder.

View File

@ -1,11 +1,11 @@
#!/bin/sh
#shellcheck disable=SC2086
#shellcheck disable=SC2086,SC2155
set -e # exit on failure
IFS=$(printf '\n\t') # smarter ifs
header() {
ARGV0="$(basename "$0")"; APPDIR="/tmp/dwarf_$ARGV0$(echo "$0"|md5sum|head -c5)"
export APPIMAGE="$0" OWD="$PWD" ARGV0 APPDIR
APPDIR="/tmp/dwarf_$(basename "$0")$(echo "$0"|md5sum|head -c5)"
export APPDIR APPIMAGE="$(realpath "$0")" ARGV0="$0" OWD="$PWD"
args="-o offset=auto -o tidy_strategy=swap -o workers=4"
[ ! -d "$APPDIR" ] && mkdir "$APPDIR" && dwarfs $args "$0" "$APPDIR" 2>/dev/null
"$APPDIR/AppRun" "$@"
@ -40,11 +40,11 @@ case "$1" in
-d )
zzexe "$@" ;;
--version | -v )
tput setaf 2; echo appdwarf v3.6
tput setaf 2; echo appdwarf 2022.06.25
tput setaf 6; echo Built by July 🏳️‍🌈; exit ;;
-* | '' )
tput setaf 6
echo "Usage: $(basename "$0") [FILE/FOLDER/URL] [compression options]"
echo "Usage: $(basename "$0") [APP/FILE/FOLDER/URL] [compression options]"
tput setaf 3
echo " -d Decompress a zzexe'd file"
echo " -h, --help Print this help text"
@ -55,12 +55,30 @@ esac
if [ ! -d "$1" ]; then # directory doesn't exist, see if this is an appimage
if [ ! -f "$1" ]; then # file doesn't exist, see if this is a url
app=$(basename "$1")
if ! echo "$1" | grep / ; then # AppImageHub
echo "Checking AppImageHub for this program..."
app=https://github.com/AppImage/appimage.github.io/raw/master/apps/$1.md
shift
set -- "$(curl -L "$app" | grep -o https.\*releases | sed 's|/releases$||')" "$@"
elif ! echo "$1" | grep https ; then # GitHub in Author/Repo format
echo "Assuming this is a GitHub repo..."
app=$1
set -- "https://github.com/$1" "$@"
fi
if echo "$1" | grep 'https://github.com/[^/]*/[^/]*/*$'; then # GitHub url
echo "Assuming this is a GitHub repo..."
app="$(echo "${1%/}"/releases | sed 's|github.com|api.github.com/repos|')"
shift
set -- "$(curl "$app" | grep -v arm | grep -om1 https.\*AppImage)" "$@"
fi
app=$(basename "$1") # actually try to get the appimage
if aria2c -x16 -s16 "$1" -o "$app" || wget "$1" -O "$app"; then
shift
set -- "$app" "$@"
else
tput setaf 1; echo "$1" is not a valid file, folder, or url >&2
tput setaf 1; echo "Unable to find valid AppImage or AppDir" >&2
rm "$app" 2> /dev/null; exit 1
fi
fi

View File

@ -10,7 +10,6 @@ These scripts are all targeted for using on x86_64 Linux systems with GLIBC.
Script | Function | Source
--- | --- | ---
`appimage ` | Can fetch and convert AppImages by name from AppImageHub or from a given GitHub repo| <https://appimage.github.io>
`mkchrome ` | Latest official Chromium build | <https://download-chromium.appspot.com>
`mkgo ` | Latest official Go release | <https://go.dev>
`mkjava ` | Accepts an argument for Java version and obtains that build from Adoptium | <https://adoptium.net>

View File

@ -1,15 +0,0 @@
#!/bin/sh
if ! echo "$1" | grep / ; then
"$0" https://raw.githubusercontent.com/AppImage/appimage.github.io/master/apps/"$1".md
exit $?
fi
if ! echo "$1" | grep https ; then
set -- "https://github.com/$1"
fi
LINK2="$(echo "$1"/releases | sed 's|github.com|api.github.com/repos|')"
if ! echo "$1" | grep github.com; then
LINK2="$(curl "$1" | grep -o https.\*releases | sed 's|github.com|api.github.com/repos|')"
fi
LINK3="$(curl "$LINK2" | grep -v arm64 | grep -v armh | grep -om1 https.\*AppImage)"
shift
appdwarf "$LINK3" "$@"

View File

@ -7,7 +7,7 @@ mv $DIR/x86_64-linux-musl-native $DIR/musl
ln -s gcc $DIR/musl/bin/cc
cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/musl
sed -i '4s#"$APPDIR/$ARGV0" ##' $DIR/musl/AppRun
sed -i '4d;3a exec "$@"' $DIR/musl/AppRun
appdwarf $DIR/musl
mv $DIR/musl.sh musl