-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppRun
executable file
·46 lines (36 loc) · 1.17 KB
/
AppRun
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# This is a sample AppRun that can be adapted for building your own
# AppDirs. It contains several interesting features, some of which may
# or may not be useful to you.
# Much of the code to build and run the application was taken from
# the AppRun script for ROX-Session, by Thomas Leonard.
# INSPIRED BY https://www.skepticats.com/rox/wrappers.html#template
FULL_PATH=`realpath $0`
APP_DIR=`dirname $0`
EXEC_NAME=`basename $FULL_PATH`
BINS_PATH="usr/bin"
# Try to determine executable from appimage name
if [ "$EXEC_NAME" != "AppRun" ]; then
EXEC_FILE_PATH="$APP_DIR/$BINS_PATH/$EXEC_NAME"
if [ -x "$EXEC_FILE_PATH" ] ; then
shift ; shift
exec "$EXEC_FILE_PATH" "$@"
else
echo "Unable to find '$EXEC_NAME' in binary directory."
echo "Use '$0' --lsexec to list the existing binaries."
exit 1
fi
fi
# Try to determine executable from first argument
EXEC_FILE_PATH="$APP_DIR/$BINS_PATH/$1"
if [ -n "$1" ] && [ -x "$EXEC_FILE_PATH" ] ; then
shift
exec "$EXEC_FILE_PATH" "$@"
fi
# Print possible executables if asked
if [ "$1" = "lsexec" ] || [ "$1" = "--lsexec" ]; then
ls "$APP_DIR/$BINS_PATH"
exit 0
fi
# Assume nmap by default
exec "$APP_DIR/$BINS_PATH/nmap" $@