From c9f49704dfda9ad178651861bad8bea0a4dbed44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismael=20Barros=C2=B2?= Date: Sun, 16 Nov 2014 14:45:17 +0100 Subject: [PATCH] Hack to allow relative paths to be specified on the command line when calling an AppImage --- data/AppRun_java | 7 ++++++- data/AppRun_linker | 7 ++++++- data/AppRun_quick | 7 ++++++- data/AppRun_testing | 7 ++++++- data/AppRun_wine | 7 ++++++- data/util.sh | 13 +++++++++++++ 6 files changed, 43 insertions(+), 5 deletions(-) diff --git a/data/AppRun_java b/data/AppRun_java index f28e2d0..b3a3e95 100755 --- a/data/AppRun_java +++ b/data/AppRun_java @@ -9,8 +9,13 @@ LOGFILE=$(mktemp "/tmp/AppRun-log-${APPPKG}.XXXXXXXXXX") BINARY="java" BINARY_ARGS="-jar _BINARY_" +. "$APPDIR/util.sh" + +# Uncomment this if the app needs relative paths specified on the command line +#eval arguments="$(patch_relative_paths "$@")" +#set -- "${arguments[@]}" + cd "$APPDIR" -. ./util.sh export PATH="$PWD/jre1.7.0_17/bin:${PATH}" export LD_LIBRARY_PATH="$PWD/jre1.7.0_17/lib/i386:${LD_LIBRARY_PATH}" diff --git a/data/AppRun_linker b/data/AppRun_linker index 9ef34bd..62f14f7 100755 --- a/data/AppRun_linker +++ b/data/AppRun_linker @@ -9,8 +9,13 @@ LOGFILE=$(mktemp "/tmp/AppRun-log-${APPPKG}.XXXXXXXXXX") BINARY="./_BINARY_" BINARY_ARGS= +. "$APPDIR/util.sh" + +# Uncomment this if the app needs relative paths specified on the command line +#eval arguments="$(patch_relative_paths "$@")" +#set -- "${arguments[@]}" + cd "$APPDIR" -. ./util.sh export PATH="$PWD/usr/bin/:$PATH" diff --git a/data/AppRun_quick b/data/AppRun_quick index 80e4e7e..194b38b 100755 --- a/data/AppRun_quick +++ b/data/AppRun_quick @@ -9,8 +9,13 @@ LOGFILE=$(mktemp "/tmp/AppRun-log-${APPPKG}.XXXXXXXXXX") BINARY="./_BINARY_" BINARY_ARGS= +. "$APPDIR/util.sh" + +# Uncomment this if the app needs relative paths specified on the command line +#eval arguments="$(patch_relative_paths "$@")" +#set -- "${arguments[@]}" + cd "$APPDIR" -. ./util.sh export PATH="$PWD/usr/bin/:$PATH" diff --git a/data/AppRun_testing b/data/AppRun_testing index 36c042d..cb3b022 100755 --- a/data/AppRun_testing +++ b/data/AppRun_testing @@ -9,8 +9,13 @@ LOGFILE=$(mktemp "/tmp/AppRun-log-${APPPKG}.XXXXXXXXXX") BINARY="./_BINARY_" BINARY_ARGS= +. "$APPDIR/util.sh" + +# Uncomment this if the app needs relative paths specified on the command line +#eval arguments="$(patch_relative_paths "$@")" +#set -- "${arguments[@]}" + cd "$APPDIR" -. ./util.sh export PATH="$PWD/usr/bin/:$PATH" diff --git a/data/AppRun_wine b/data/AppRun_wine index 7abb8fe..91c6752 100755 --- a/data/AppRun_wine +++ b/data/AppRun_wine @@ -10,8 +10,13 @@ BINARY="_BINARY_" BINARY_ARGS= WINETRICKS= +. "$APPDIR/util.sh" + +# Uncomment this if the app needs relative paths specified on the command line +#eval arguments="$(patch_relative_paths "$@")" +#set -- "${arguments[@]}" + cd "$APPDIR" -. ./util.sh export PATH="$PWD/usr/bin/:${PATH}" diff --git a/data/util.sh b/data/util.sh index cb324a8..27ef4da 100755 --- a/data/util.sh +++ b/data/util.sh @@ -155,3 +155,16 @@ show_usage() [ -f "$usage_file" ] && cat "$usage_file" } +patch_relative_paths() +{ + local output=() + for i in "$@"; do + if [ -f "$i" ]; then + abs="$(readlink -f "$i")" + echo "[AppImage] Converting parameter '$i' into '$abs'" >&2 + i="$abs" + fi + output+=("\"$i\"") + done + echo "(${output[@]})" +}