From 9827a83a4a013152ff234309a2ae63947f411e3b Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 01:31:56 +0200 Subject: [PATCH 01/15] Fix more variable mess --- travis/travis-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/travis-build.sh b/travis/travis-build.sh index b5a3470e..f97bb815 100755 --- a/travis/travis-build.sh +++ b/travis/travis-build.sh @@ -42,7 +42,7 @@ fi if [ "$ARCH" == "i386" ]; then EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT/cmake/toolchains/i386-linux-gnu.cmake -DUSE_SYSTEM_XZ=ON -DUSE_SYSTEM_LIBARCHIVE=ON" - if [ "$BIONIC" == "" ] && [ "$COSMIC" == "" ]; then + if [ "$DEBIAN_DIST" != "bionic" ] && [ "$DEBIAN_DIST" != "cosmic" ]; then export QT_SELECT=qt5-i386-linux-gnu else export QT_SELECT=qt5 From 9ecb5b51dd11abe1fb17efdaba1835c4bf98f326 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 01:32:07 +0200 Subject: [PATCH 02/15] Build in parallel --- travis/travis-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/travis-build.sh b/travis/travis-build.sh index f97bb815..937f1821 100755 --- a/travis/travis-build.sh +++ b/travis/travis-build.sh @@ -52,7 +52,7 @@ fi cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo $EXTRA_CMAKE_FLAGS -DTRAVIS_BUILD=ON -DBUILD_TESTING=OFF # now, compile -make +make -j $(nproc) # re-run cmake to find built shared objects with the globs, and update the CPack files cmake . From de01bb8366722da4a7d615cddd27836f9bce74ef Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 01:34:14 +0200 Subject: [PATCH 03/15] AppImageLauncher Lite build infrastructure, mk. 1 --- resources/appimagelauncher-lite-AppRun.sh | 165 ++++++++++++++++++++++ resources/appimagelauncher-lite.desktop | 8 ++ src/CMakeLists.txt | 4 +- src/ui/CMakeLists.txt | 28 ++-- travis/build-lite.sh | 79 +++++++++++ 5 files changed, 270 insertions(+), 14 deletions(-) create mode 100755 resources/appimagelauncher-lite-AppRun.sh create mode 100644 resources/appimagelauncher-lite.desktop create mode 100644 travis/build-lite.sh diff --git a/resources/appimagelauncher-lite-AppRun.sh b/resources/appimagelauncher-lite-AppRun.sh new file mode 100755 index 00000000..6639d16b --- /dev/null +++ b/resources/appimagelauncher-lite-AppRun.sh @@ -0,0 +1,165 @@ +#! /bin/bash + +set -e + +if [[ "$VERBOSE" != "" ]]; then + set -x +fi + +# shift does not work if no arguments have been passed, therefore we just handle that situation right now +if [[ "$1" == "" ]]; then + echo "Usage: ${APPIMAGE:-$0} [...]" 1>&2 + exit 2 +fi + +firstarg="$1" +shift + + +prefix="appimagelauncher-lite" +install_dir=~/.local/lib/appimagelauncher-lite +installed_appimage_path="$install_dir"/appimagelauncher-lite.AppImage +settings_desktop_file_path=~/.local/share/applications/"$prefix"-AppImageLauncherSettings.desktop +systemd_user_units_dir=~/.config/systemd/user/ +appimagelauncherd_systemd_service_name=appimagelauncherd.service +integrated_icon_path=~/.local/share/icons/hicolor/scalable/apps/AppImageLauncher-Lite.svg + +test_globally_installed() { + which AppImageLauncher &>/dev/null && return 0 + type AppImageLauncher &>/dev/null && return 0 + [[ -d /usr/lib/*/appimagelauncher ]] && return 0 + + return 1 +} + +test_installed_already() { + [[ -d "$install_dir" ]] && return 0 + + return 1 +} + +ail_lite_notify_desktop_integration() { + update-desktop-database ~/.local/share/applications + gtk-update-icon-cache +} + +ail_lite_install() { + if [[ "$APPIMAGE" == "" ]]; then + echo "Error: not running from AppImage, aborting" + return 2 + fi + + # create default Applications directory + mkdir -p ~/Applications + + # prepare install dir + mkdir -p "$install_dir" + mkdir -p "$install_dir"/systemd + + # copy ourselves to install dir + cp "$APPIMAGE" "$installed_appimage_path" + + # set up appimagelauncherd + cat > "$install_dir"/systemd/"$appimagelauncherd_systemd_service_name" < ~/.local/share/applications/appimagelauncher-lite-AppImageLauncherSettings.desktop <&2 + exit 2 + fi + + if test_installed_already; then + echo "Error: AppImageLauncher Lite is installed already, please uninstall before trying to reinstall" 1>&2 + exit 2 + fi + + echo "Installing AppImageLauncher Lite" + ail_lite_install + ;; + uninstall) + if ! test_installed_already; then + echo "Error: AppImageLauncher Lite does not seem to be installed" 1>&2 + exit 2 + fi + + echo "Uninstalling AppImageLauncher Lite" + ail_lite_uninstall + ;; + *) + echo "Unknown operation: $firstarg"; + exit 2 + ;; +esac + + + diff --git a/resources/appimagelauncher-lite.desktop b/resources/appimagelauncher-lite.desktop new file mode 100644 index 00000000..3f8b2f0a --- /dev/null +++ b/resources/appimagelauncher-lite.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=appimagelauncher-lite +Exec=appimagelauncher-lite +Icon=AppImageLauncher +Type=Application +X-AppImage-Integrate=false +NoDisplay=true +Categories=Utility; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e42a188..fe0b0d60 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,7 +48,9 @@ add_subdirectory(daemon) add_subdirectory(ui) # FUSE filesystem AppImageLauncherFS -add_subdirectory(fusefs) +if(NOT BUILD_LITE) + add_subdirectory(fusefs) +endif() # CLI helper allowing other tools to utilize AppImageLauncher's code for e.g., integrating AppImages add_subdirectory(cli) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index bfc2a06d..6c2a9db2 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,18 +1,20 @@ -# main AppImageLauncher application -add_executable(AppImageLauncher main.cpp resources.qrc first-run.cpp first-run.h first-run.ui) -target_link_libraries(AppImageLauncher shared PkgConfig::glib libappimage shared) +if(NOT BUILD_LITE) + # main AppImageLauncher application + add_executable(AppImageLauncher main.cpp resources.qrc first-run.cpp first-run.h first-run.ui) + target_link_libraries(AppImageLauncher shared PkgConfig::glib libappimage shared) -# set binary runtime rpath to make sure the libappimage.so built and installed by this project is going to be used -# by the installed binaries (be it the .deb, the AppImage, or whatever) -# in order to make the whole install tree relocatable, a relative path is used -set_target_properties(AppImageLauncher PROPERTIES INSTALL_RPATH ${_rpath}) + # set binary runtime rpath to make sure the libappimage.so built and installed by this project is going to be used + # by the installed binaries (be it the .deb, the AppImage, or whatever) + # in order to make the whole install tree relocatable, a relative path is used + set_target_properties(AppImageLauncher PROPERTIES INSTALL_RPATH ${_rpath}) -install( - TARGETS - AppImageLauncher - RUNTIME DESTINATION ${_bindir} COMPONENT APPIMAGELAUNCHER - LIBRARY DESTINATION ${_libdir} COMPONENT APPIMAGELAUNCHER -) + install( + TARGETS + AppImageLauncher + RUNTIME DESTINATION ${_bindir} COMPONENT APPIMAGELAUNCHER + LIBRARY DESTINATION ${_libdir} COMPONENT APPIMAGELAUNCHER + ) +endif() # AppImageLauncherSettings application add_executable(AppImageLauncherSettings settings_main.cpp settings_dialog.ui settings_dialog.cpp) diff --git a/travis/build-lite.sh b/travis/build-lite.sh new file mode 100644 index 00000000..31913be2 --- /dev/null +++ b/travis/build-lite.sh @@ -0,0 +1,79 @@ +#! /bin/bash + +if [ "$ARCH" == "" ]; then + echo "Error: you must set \$ARCH" + exit 2 +fi + +set -x +set -e + +# use RAM disk if possible +if [ "$CI" == "" ] && [ -d /dev/shm ]; then + TEMP_BASE=/dev/shm +else + TEMP_BASE=/tmp +fi + +BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" AppImageLauncher-build-XXXXXX) + +cleanup () { + if [ -d "$BUILD_DIR" ]; then + rm -rf "$BUILD_DIR" + fi +} + +trap cleanup EXIT + +# store repo root as variable +REPO_ROOT=$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..) +OLD_CWD=$(readlink -f .) + +pushd "$BUILD_DIR" + +# install more recent CMake version which fixes some linking issue in CMake < 3.10 +# Fixes https://github.com/TheAssassin/AppImageLauncher/issues/106 +# Upstream bug: https://gitlab.kitware.com/cmake/cmake/issues/17389 +wget https://cmake.org/files/v3.13/cmake-3.13.2-Linux-x86_64.tar.gz -qO- | tar xz --strip-components=1 +export PATH=$(readlink -f bin/):"$PATH" +which cmake +cmake --version + +EXTRA_CMAKE_FLAGS= + +if [ "$ARCH" == "i386" ]; then + EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT/cmake/toolchains/i386-linux-gnu.cmake -DUSE_SYSTEM_XZ=ON -DUSE_SYSTEM_LIBARCHIVE=ON" + # TODO check if this can be removed + if [ "$DEBIAN_DIST" != "bionic" ] && [ "$DEBIAN_DIST" != "cosmic" ]; then + export QT_SELECT=qt5-i386-linux-gnu + else + export QT_SELECT=qt5 + fi +fi + +cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo $EXTRA_CMAKE_FLAGS -DTRAVIS_BUILD=ON -DBUILD_TESTING=OFF -DBUILD_LITE=ON + +# compile dependencies +make -j $(nproc) libappimage libappimageupdate libappimageupdate-qt + +# re-run cmake to update paths to dependencies +cmake . + +# build rest +make -j $(nproc) + +# prepare AppDir +make install DESTDIR=AppDir + +# build AppImage +wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage +wget https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-"$ARCH".AppImage +wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-"$ARCH".AppImage +chmod -v +x linuxdeploy*-"$ARCH".AppImage + +export OUTPUT=appimagelauncher-lite-"$VERSION"-"$ARCH".AppImage +export VERSION=$(src/cli/ail-cli --version) + +./linuxdeploy-x86_64.AppImage --plugin qt --appdir $(readlink -f AppDir) --custom-apprun "$REPO_ROOT"/resources/appimagelauncher-lite-AppRun.sh --output appimage -d "$REPO_ROOT"/resources/appimagelauncher-lite.desktop + +mv "$OUTPUT" "$OLD_CWD" From 952f6f7546d44375000f3b73b79e8dc502bb8f54 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 02:39:40 +0200 Subject: [PATCH 04/15] Use right paths for AppImageLauncher Lite --- src/CMakeLists.txt | 4 ++++ src/shared/shared.cpp | 29 +++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fe0b0d60..04bf1be7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,6 +35,10 @@ endif() add_compile_options(-Wall -Wpedantic) +if(BUILD_LITE) + add_definitions(-DBUILD_LITE) +endif() + # utility libraries add_subdirectory(fswatcher) add_subdirectory(i18n) diff --git a/src/shared/shared.cpp b/src/shared/shared.cpp index fc92e232..247a7bb3 100644 --- a/src/shared/shared.cpp +++ b/src/shared/shared.cpp @@ -493,6 +493,7 @@ bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveColli } #endif +#ifndef BUILD_LITE // PRIVATE_LIBDIR will be a relative path most likely // therefore, we need to detect the install prefix based on our own binary path, and then calculate the path to // the helper tools based on that @@ -508,15 +509,28 @@ bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveColli privateLibDirPath = ownBinaryDirPath + "/../ui"; } + const char helperIconName[] = "AppImageLauncher"; +#else + const char helperIconName[] = "AppImageLauncher-Lite"; +#endif + // add Remove action { const auto removeSectionName = "Desktop Action Remove"; g_key_file_set_string(desktopFile.get(), removeSectionName, "Name", "Remove AppImage from system"); - g_key_file_set_string(desktopFile.get(), removeSectionName, "Icon", "AppImageLauncher"); + g_key_file_set_string(desktopFile.get(), removeSectionName, "Icon", helperIconName); std::ostringstream removeExecPath; - removeExecPath << privateLibDirPath.toStdString() << "/remove" << " \"" << pathToAppImage.toStdString() << "\""; + +#ifndef BUILD_LITE + removeExecPath << privateLibDirPath.toStdString() << "/remove"; +#else + removeExecPath << getenv("HOME") << "/.local/lib/appimagelauncher-lite/appimagelauncher-lite.AppImage remove"; +#endif + + removeExecPath << " \"" << pathToAppImage.toStdString() << "\""; + g_key_file_set_string(desktopFile.get(), removeSectionName, "Exec", removeExecPath.str().c_str()); // install translations @@ -540,10 +554,17 @@ bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveColli const auto updateSectionName = "Desktop Action Update"; g_key_file_set_string(desktopFile.get(), updateSectionName, "Name", "Update AppImage"); - g_key_file_set_string(desktopFile.get(), updateSectionName, "Icon", "AppImageLauncher"); + g_key_file_set_string(desktopFile.get(), updateSectionName, "Icon", helperIconName); std::ostringstream updateExecPath; - updateExecPath << privateLibDirPath.toStdString() << "/update" << " \"" << pathToAppImage.toStdString() << "\"";; + +#ifndef BUILD_LITE + updateExecPath << privateLibDirPath.toStdString() << "/update"; +#else + updateExecPath << getenv("HOME") << "/.local/lib/appimagelauncher-lite/appimagelauncher-lite.AppImage update"; +#endif + updateExecPath << " \"" << pathToAppImage.toStdString() << "\""; + g_key_file_set_string(desktopFile.get(), updateSectionName, "Exec", updateExecPath.str().c_str()); // install translations From e3d6506a576ddc1c8b0c48b87d14f6c65384c55e Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 02:46:45 +0200 Subject: [PATCH 05/15] Build AIL Lite AppImages on Travis --- .travis.yml | 8 +++++++- travis/travis-docker.sh | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c608cc91..927599bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,10 @@ matrix: - env: DIST=bionic ARCH=i386 - env: DIST=xenial ARCH=x86_64 - env: DIST=xenial ARCH=i386 + - env: DIST=xenial ARCH=x86_64 BUILD_LITE=1 + name: AppImageLauncher Lite AppImage x86_64 + - env: DIST=xenial ARCH=i386 BUILD_LITE=1 + name: AppImageLauncher Lite AppImage i386 script: - bash -ex travis/travis-docker.sh "$DIST" @@ -20,7 +24,9 @@ after_success: - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_TAG" == "" ]; then export TRAVIS_EVENT_TYPE=pull_request; fi - |2 - if [ "$DIST" == "xenial" ]; then + if [[ "$BUILD_LITE" != "" ]]; then + bash upload.sh appimagelauncher-lite-*.AppImage* + elif [[ "$DIST" == "xenial" ]]; then bash upload.sh appimagelauncher*.{deb,rpm}* appimagelauncher*.tar* else bash upload.sh appimagelauncher*.deb* diff --git a/travis/travis-docker.sh b/travis/travis-docker.sh index 64233346..13b10a9f 100755 --- a/travis/travis-docker.sh +++ b/travis/travis-docker.sh @@ -27,5 +27,11 @@ fi docker build -t "$IMAGE" -f "$DOCKERFILE" . +if [[ "$BUILD_LITE" == "" ]]; then + build_script=travis-build.sh +else + build_script=build-lite.sh +fi + docker run -e ARCH -e TRAVIS_BUILD_NUMBER --rm -it -v $(readlink -f ..):/ws "$IMAGE" \ - bash -xc "export CI=1 && export DEBIAN_DIST=\"$DOCKER_DIST\" && cd /ws && source travis/travis-build.sh" + bash -xc "export CI=1 && export DEBIAN_DIST=\"$DOCKER_DIST\" && cd /ws && source travis/$build_script" From 52ab31a5380a46b30f50925b7d19ace203c7e4b5 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 03:02:02 +0200 Subject: [PATCH 06/15] Fix running in Docker container --- travis/build-lite.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/travis/build-lite.sh b/travis/build-lite.sh index 31913be2..9fe67716 100644 --- a/travis/build-lite.sh +++ b/travis/build-lite.sh @@ -73,6 +73,7 @@ chmod -v +x linuxdeploy*-"$ARCH".AppImage export OUTPUT=appimagelauncher-lite-"$VERSION"-"$ARCH".AppImage export VERSION=$(src/cli/ail-cli --version) +export APPIMAGE_EXTRACT_AND_RUN=1 ./linuxdeploy-x86_64.AppImage --plugin qt --appdir $(readlink -f AppDir) --custom-apprun "$REPO_ROOT"/resources/appimagelauncher-lite-AppRun.sh --output appimage -d "$REPO_ROOT"/resources/appimagelauncher-lite.desktop From db98aca03fd1f5c3ff075d78c9953bdaf14dc7a5 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 03:16:16 +0200 Subject: [PATCH 07/15] Fix linuxdeploy AppImage filename --- travis/build-lite.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/build-lite.sh b/travis/build-lite.sh index 9fe67716..0553fe5d 100644 --- a/travis/build-lite.sh +++ b/travis/build-lite.sh @@ -75,6 +75,6 @@ export OUTPUT=appimagelauncher-lite-"$VERSION"-"$ARCH".AppImage export VERSION=$(src/cli/ail-cli --version) export APPIMAGE_EXTRACT_AND_RUN=1 -./linuxdeploy-x86_64.AppImage --plugin qt --appdir $(readlink -f AppDir) --custom-apprun "$REPO_ROOT"/resources/appimagelauncher-lite-AppRun.sh --output appimage -d "$REPO_ROOT"/resources/appimagelauncher-lite.desktop +./linuxdeploy-"$ARCH".AppImage --plugin qt --appdir $(readlink -f AppDir) --custom-apprun "$REPO_ROOT"/resources/appimagelauncher-lite-AppRun.sh --output appimage -d "$REPO_ROOT"/resources/appimagelauncher-lite.desktop mv "$OUTPUT" "$OLD_CWD" From c168300d12a91865100b9b779d97ffffadfc92ec Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 03:26:28 +0200 Subject: [PATCH 08/15] Fix and improve settings dialog layout --- src/ui/settings_dialog.ui | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/ui/settings_dialog.ui b/src/ui/settings_dialog.ui index bcf9e259..fddfc148 100644 --- a/src/ui/settings_dialog.ui +++ b/src/ui/settings_dialog.ui @@ -76,6 +76,12 @@ + + + 0 + 0 + + @@ -88,9 +94,21 @@ 10 30 431 - 41 + 430 + + + 0 + 0 + + + + + 0 + 430 + + Qt::LeftToRight @@ -100,6 +118,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + true + From e7eb0e00ab1924935061985d24ddca1c020a0cf8 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 03:26:52 +0200 Subject: [PATCH 09/15] Adjust settings dialog for lite version --- src/ui/settings_dialog.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ui/settings_dialog.cpp b/src/ui/settings_dialog.cpp index 7a086503..7274a450 100644 --- a/src/ui/settings_dialog.cpp +++ b/src/ui/settings_dialog.cpp @@ -13,6 +13,15 @@ SettingsDialog::SettingsDialog(QWidget* parent) : loadSettings(); +// cosmetic changes in lite mode +#ifndef BUILD_LITE + ui->checkBoxEnableDaemon->setChecked(true); + ui->checkBoxEnableDaemon->setEnabled(false); + + ui->checkBoxAskMove->setChecked(false); + ui->checkBoxAskMove->setEnabled(false); +#endif + connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::onDialogAccepted); connect(ui->toolButtonChooseAppsDir, &QToolButton::released, this, &SettingsDialog::onChooseAppsDirClicked); @@ -24,6 +33,12 @@ SettingsDialog::SettingsDialog(QWidget* parent) : availableFeatures << "🞬 " + tr("updater unavailable"); #endif +#ifndef BUILD_LITE + availableFeatures << "

" + << tr("Note: this is an AppImageLauncher Lite build, only supports a limited set of features
" + "Please install the full version via the provided native packages to enjoy the full AppImageLauncher experience"); +#endif + ui->featuresLabel->setText(availableFeatures.join('\n')); } From 32340a32fa2527a78173a0ae14d2e3f613d248d9 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 03:28:58 +0200 Subject: [PATCH 10/15] Add missing version parameter to CLI --- src/cli/cli_main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cli/cli_main.cpp b/src/cli/cli_main.cpp index f810f7a5..d4e7d3c5 100644 --- a/src/cli/cli_main.cpp +++ b/src/cli/cli_main.cpp @@ -1,3 +1,6 @@ +// system headers +#include + // library headers #include #include @@ -16,11 +19,18 @@ int main(int argc, char** argv) { QCoreApplication app(argc, argv); + std::ostringstream version; + version << "version " << APPIMAGELAUNCHER_VERSION << " " + << "(git commit " << APPIMAGELAUNCHER_GIT_COMMIT << "), built on " + << APPIMAGELAUNCHER_BUILD_DATE; + QCoreApplication::setApplicationVersion(QString::fromStdString(version.str())); + QCommandLineParser parser; parser.addPositionalArgument("", "Command to run (see help for more information"); parser.addPositionalArgument("[...]", "command-specific additional arguments"); parser.addHelpOption(); + parser.addVersionOption(); parser.process(app); From 4f5cedf448c10f09b345addd7a67619128b9324c Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 03:31:45 +0200 Subject: [PATCH 11/15] Properly guess version from ail-cli --- travis/build-lite.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/build-lite.sh b/travis/build-lite.sh index 0553fe5d..0768ddbd 100644 --- a/travis/build-lite.sh +++ b/travis/build-lite.sh @@ -72,7 +72,7 @@ wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/cont chmod -v +x linuxdeploy*-"$ARCH".AppImage export OUTPUT=appimagelauncher-lite-"$VERSION"-"$ARCH".AppImage -export VERSION=$(src/cli/ail-cli --version) +export VERSION=$(src/cli/ail-cli --version | awk '{print $3}') export APPIMAGE_EXTRACT_AND_RUN=1 ./linuxdeploy-"$ARCH".AppImage --plugin qt --appdir $(readlink -f AppDir) --custom-apprun "$REPO_ROOT"/resources/appimagelauncher-lite-AppRun.sh --output appimage -d "$REPO_ROOT"/resources/appimagelauncher-lite.desktop From c30ba936ac56e44f31825cb52f045b00ed9edca2 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 13:53:01 +0200 Subject: [PATCH 12/15] Properly guess version from ail-cli, mk. 2 --- travis/build-lite.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/build-lite.sh b/travis/build-lite.sh index 0768ddbd..a613c9d1 100644 --- a/travis/build-lite.sh +++ b/travis/build-lite.sh @@ -71,8 +71,8 @@ wget https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/downloa wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-"$ARCH".AppImage chmod -v +x linuxdeploy*-"$ARCH".AppImage -export OUTPUT=appimagelauncher-lite-"$VERSION"-"$ARCH".AppImage export VERSION=$(src/cli/ail-cli --version | awk '{print $3}') +export OUTPUT=appimagelauncher-lite-"$VERSION"-"$ARCH".AppImage export APPIMAGE_EXTRACT_AND_RUN=1 ./linuxdeploy-"$ARCH".AppImage --plugin qt --appdir $(readlink -f AppDir) --custom-apprun "$REPO_ROOT"/resources/appimagelauncher-lite-AppRun.sh --output appimage -d "$REPO_ROOT"/resources/appimagelauncher-lite.desktop From 7158a8221a377c621cd418d7d27d0cd21b14fc77 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 13:57:01 +0200 Subject: [PATCH 13/15] Need zlib for linuxdeploy-plugin-qt --- travis/Dockerfile.build-bionic-i386-cross | 3 ++- travis/Dockerfile.build-cosmic-i386-cross | 3 ++- travis/Dockerfile.build-xenial-i386-cross | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/travis/Dockerfile.build-bionic-i386-cross b/travis/Dockerfile.build-bionic-i386-cross index 1bdbdc7c..9751b5f1 100644 --- a/travis/Dockerfile.build-bionic-i386-cross +++ b/travis/Dockerfile.build-bionic-i386-cross @@ -45,4 +45,5 @@ RUN dpkg --add-architecture i386 && \ qttools5-dev-tools:i386 \ qt5-qmake-bin:i386 \ libarchive-dev:i386 \ - libboost-filesystem-dev:i386 + libboost-filesystem-dev:i386 \ + zlib1g:i386 diff --git a/travis/Dockerfile.build-cosmic-i386-cross b/travis/Dockerfile.build-cosmic-i386-cross index 569c335e..44d1c238 100644 --- a/travis/Dockerfile.build-cosmic-i386-cross +++ b/travis/Dockerfile.build-cosmic-i386-cross @@ -45,4 +45,5 @@ RUN dpkg --add-architecture i386 && \ qttools5-dev-tools:i386 \ qt5-qmake-bin:i386 \ libarchive-dev:i386 \ - libboost-filesystem-dev:i386 + libboost-filesystem-dev:i386 \ + zlib1g:i386 diff --git a/travis/Dockerfile.build-xenial-i386-cross b/travis/Dockerfile.build-xenial-i386-cross index cf76930e..ff3b2a2b 100644 --- a/travis/Dockerfile.build-xenial-i386-cross +++ b/travis/Dockerfile.build-xenial-i386-cross @@ -46,4 +46,5 @@ RUN dpkg --add-architecture i386 && \ libfontconfig1-dev:i386 \ libfreetype6-dev:i386 \ libarchive-dev:i386 \ - libboost-filesystem-dev:i386 + libboost-filesystem-dev:i386 \ + zlib1g:i386 From dc389a13f2efb685c2fee0f5066dec5dbeeaa3b3 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sat, 29 Jun 2019 21:48:03 +0200 Subject: [PATCH 14/15] Add some useful help text --- resources/appimagelauncher-lite-AppRun.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/resources/appimagelauncher-lite-AppRun.sh b/resources/appimagelauncher-lite-AppRun.sh index 6639d16b..3aa8eb7f 100755 --- a/resources/appimagelauncher-lite-AppRun.sh +++ b/resources/appimagelauncher-lite-AppRun.sh @@ -8,7 +8,7 @@ fi # shift does not work if no arguments have been passed, therefore we just handle that situation right now if [[ "$1" == "" ]]; then - echo "Usage: ${APPIMAGE:-$0} [...]" 1>&2 + echo "Error: no option passed, use --help for more information" exit 2 fi @@ -118,11 +118,31 @@ ail_lite_uninstall() { return 0 } +print_help() { + echo "Usage: $0