From 20161303fc523d62bfef5568defb6b58a7cf4be8 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sun, 23 Jul 2017 18:39:24 +0100 Subject: [PATCH] appimage: Can now get a shell inside the AppImage. - The --self_test option is no longer needed. Instead do: - # APPIMAGE_ENTER=1 ./vigil.appimage # To enter the shell - # $APPDIR/test-all --- appimage/AppRun | 12 ++++++++++-- make-appimage.py | 2 +- vigil/__main__.py | 14 ++------------ 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/appimage/AppRun b/appimage/AppRun index ae3bb55..91474d0 100755 --- a/appimage/AppRun +++ b/appimage/AppRun @@ -14,5 +14,13 @@ export UNION_PRELOAD="${HERE}" export LD_PRELOAD="${HERE}/libunionpreload.so" export LD_LIBRARY_PATH="${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/usr/lib32/:"${HERE}"/usr/lib64/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${HERE}"/lib32/:"${HERE}"/lib64/:"${LD_LIBRARY_PATH}" export PYTHONPATH=/usr/local/lib/python3.5/dist-packages:"${PYTHONPATH}" -EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2- | sed -e 's|%.||g') -exec ${EXEC} $@ +if [ -z $APPIMAGE_ENTER ]; then + EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2- | sed -e 's|%.||g') + exec ${EXEC} $@ +else + if [ -z "$@" ]; then + exec /bin/bash + else + $@ + fi +fi diff --git a/make-appimage.py b/make-appimage.py index 0e8a97f..e282ca5 100755 --- a/make-appimage.py +++ b/make-appimage.py @@ -72,7 +72,7 @@ def make_app_dir(app_dir, new_paths): os.mkdir(app_dir) make_sub_container("ubuntu", app_dir, new_paths) cmd("cp -a %s/tests %s" % (VIGIL_PATH, app_dir)) - cmd("cp -a %s/test-all %s/tests" % (VIGIL_PATH, app_dir)) + cmd("cp -a %s/test-all %s" % (VIGIL_PATH, app_dir)) cmd("cp %s/appimage/* %s" % (VIGIL_PATH, app_dir)) # if not os.path.exists("libunionpreload.so"): # make_libunionpreload() diff --git a/vigil/__main__.py b/vigil/__main__.py index a11c79e..137a662 100755 --- a/vigil/__main__.py +++ b/vigil/__main__.py @@ -41,17 +41,11 @@ from vigil import tools from vigil import worker -if "APPDIR" in os.environ: - test_usage_line = " vigil --self_test\n" - test_option_line = (" --self_test " - "Test that vigil is working properly.\n") -else: - test_usage_line, test_option_line = "", "" USAGE = """ Usage: vigil [options] vigil -h | --help -%s + Example: # vigil my_project @@ -63,7 +57,7 @@ Options: the *edit command. It may contain options. -t THEME, --theme=THEME The pygment theme used for syntax highlighting. Defaults to "native". -%s""" % (test_usage_line, test_option_line) +""" KEYS_DOC = """Keys: @@ -1018,10 +1012,6 @@ def check_arguments(): if arguments["--help"]: print(cmdline_help) sys.exit(0) - if "APPDIR" in os.environ and arguments["--self_test"]: - test_dir = os.path.join(os.environ["APPDIR"], "tests") - sys.exit(subprocess.call([os.path.join(test_dir, "test-all")], - cwd=test_dir)) worker_count = None try: if arguments["--workers"] is not None: