From 5d7cb872eb3721792efbfb2e33bb9a245f8a58ee Mon Sep 17 00:00:00 2001 From: Aldo Barreras Date: Wed, 30 Sep 2026 08:21:49 -0400 Subject: [PATCH 1/3] Fix appimage update/remove helpers. --- CMakeLists.txt | 6 +++++- ci/build.sh | 6 +++--- cmake/install.cmake | 3 +++ resources/appimagelauncher-lite-AppRun.sh | 8 ++------ src/shared/shared.cpp | 25 ++++++++++++++--------- 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fa21c65..3c5ee063 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,11 @@ FetchContent_Declare(AppImageUpdate # work around Wimplicit-function-declaration in ancient squashfuse code set(DEPENDENCIES_CFLAGS "-Wno-implicit-function-declaration" CACHE STRING "" FORCE) -option(ENABLE_UPDATE_HELPER ON) +option(ENABLE_UPDATE_HELPER "Build the AppImage update helper" OFF) +if(BUILD_LITE) + set(ENABLE_UPDATE_HELPER OFF CACHE BOOL "Build the AppImage update helper" FORCE) +endif() + if(ENABLE_UPDATE_HELPER) # instruct AppImageUpdate to build the Qt UI set(BUILD_QT_UI ON CACHE BOOL "" FORCE) diff --git a/ci/build.sh b/ci/build.sh index 33898391..ffbf7ae5 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -52,7 +52,7 @@ cmake_args=( if [[ "${BUILD_LITE:-}" == "" ]]; then cmake_args+=("-DENABLE_UPDATE_HELPER=ON") else - cmake_args+=("-DBUILD_LITE=ON") + cmake_args+=("-DBUILD_LITE=ON" "-DENABLE_UPDATE_HELPER=OFF") fi export QT_SELECT=qt5 @@ -161,7 +161,7 @@ if [[ "${BUILD_LITE:-}" == "" ]]; then # updater is not available for the lite build linuxdeploy_extra_args+=( - -e "$(find AppDir/usr/lib/*/appimagelauncher/update | head -n1)" + -e AppDir/usr/bin/appimagelauncher-update --output native_packages ) @@ -202,7 +202,7 @@ ldd AppDir/usr/bin/AppImageLauncherSettings --appdir "$(readlink -f AppDir)" \ --plugin qt \ -d AppDir/usr/share/applications/appimagelauncher.desktop \ - -e "$(find AppDir/usr/lib/*/appimagelauncher/remove | head -n1)" \ + -e AppDir/usr/bin/appimagelauncher-remove \ "${linuxdeploy_extra_args[@]}" if [[ "${BUILD_LITE:-}" == "" ]]; then diff --git a/cmake/install.cmake b/cmake/install.cmake index ee3de23e..df60a217 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -29,6 +29,9 @@ set(_abs_private_libdir ${CMAKE_INSTALL_PREFIX}/${_private_libdir}) file(RELATIVE_PATH _rpath ${_abs_bindir} ${_abs_private_libdir}) set(_rpath "\$ORIGIN/${_rpath}") +# compatibility symlinks for helpers formerly installed in the private library directory +file(RELATIVE_PATH _bindir_from_private_libdir ${_abs_private_libdir} ${_abs_bindir}) + # install libappimage.so into lib/appimagekit to avoid overwriting a libappimage potentially installed into /usr/lib # or /usr/lib/x86_64-... or wherever the OS puts its libraries install( diff --git a/resources/appimagelauncher-lite-AppRun.sh b/resources/appimagelauncher-lite-AppRun.sh index 5f217a6a..42aa408a 100755 --- a/resources/appimagelauncher-lite-AppRun.sh +++ b/resources/appimagelauncher-lite-AppRun.sh @@ -35,7 +35,6 @@ print_help() { echo " AppImageLauncherSettings Display AppImageLauncher Lite configuration utility" echo " cli [or ali-cli] Run AppImageLauncher cli (use \"cli --help\" for more information)" echo " remove Run removal helper to remove AppImage " - echo " update Run update helper to update AppImage " } case "$firstarg" in @@ -49,9 +48,8 @@ case "$firstarg" in cli|ail-cli) exec "$APPDIR"/usr/bin/ail-cli "$@" ;; - remove|update) - #exec "$APPDIR"/usr/lib/**/appimagelauncher/"$firstarg" "$@" - exec "$APPDIR"/usr/bin/"$firstarg" "$@" + remove) + exec "$APPDIR"/usr/bin/appimagelauncher-remove "$@" ;; install) if test_globally_installed; then @@ -118,5 +116,3 @@ EOF ;; esac - - diff --git a/src/shared/shared.cpp b/src/shared/shared.cpp index 7432e8f6..5094b261 100644 --- a/src/shared/shared.cpp +++ b/src/shared/shared.cpp @@ -598,8 +598,7 @@ QString privateLibDirPath(const QString& srcSubdirName) { } // if there is no such directory like /bin/../lib/... or the binary is not found there, there is a chance - // the binary is just next to this one (this is the case in the update/remove helpers) - // therefore we compare the binary directory path with PRIVATE_LIBDIR + // the private libraries are next to this binary, so compare the binary directory path with PRIVATE_LIBDIR if (!QDir(privateLibDirPath).exists()) { if (privateLibDirPath.contains(PRIVATE_LIBDIR)) { privateLibDirPath = ownBinaryDirPath; @@ -608,6 +607,18 @@ QString privateLibDirPath(const QString& srcSubdirName) { return privateLibDirPath; } + +static QString helperExecutablePath(const QString& executableName) { + const QDir ownBinaryDir(QFileInfo(getOwnBinaryPath().get()).dir()); + + // Installed helpers and helpers launched from the UI build directory live next to the calling executable. + const auto adjacentHelperPath = ownBinaryDir.absoluteFilePath(executableName); + if (QFileInfo(adjacentHelperPath).isExecutable()) + return adjacentHelperPath; + + // During development, callers such as appimagelauncherd and ail-cli live in sibling build directories. + return QDir(ownBinaryDir.absoluteFilePath("../ui")).absoluteFilePath(executableName); +} #endif bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveCollisions) { @@ -798,8 +809,6 @@ bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveColli #endif #ifndef BUILD_LITE - auto privateLibDir = privateLibDirPath("ui"); - const char helperIconName[] = "AppImageLauncher"; #else const char helperIconName[] = "AppImageLauncher-Lite"; @@ -815,7 +824,7 @@ bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveColli std::ostringstream removeExecPath; #ifndef BUILD_LITE - removeExecPath << privateLibDir.toStdString() << "/remove"; + removeExecPath << helperExecutablePath("appimagelauncher-remove").toStdString(); #else removeExecPath << getenv("HOME") << "/.local/lib/appimagelauncher-lite/appimagelauncher-lite.AppImage remove"; #endif @@ -849,11 +858,7 @@ bool installDesktopFileAndIcons(const QString& pathToAppImage, bool resolveColli std::ostringstream updateExecPath; -#ifndef BUILD_LITE - updateExecPath << privateLibDir.toStdString() << "/update"; -#else - updateExecPath << getenv("HOME") << "/.local/lib/appimagelauncher-lite/appimagelauncher-lite.AppImage update"; -#endif + updateExecPath << helperExecutablePath("appimagelauncher-update").toStdString(); updateExecPath << " \"" << pathToAppImage.toStdString() << "\""; g_key_file_set_string(desktopFile.get(), updateSectionName.c_str(), "Exec", updateExecPath.str().c_str()); From 445ae5eeaa6fdbb4fdea4c5f7a85ba54678b8dbf Mon Sep 17 00:00:00 2001 From: Aldo Barreras Date: Wed, 30 Sep 2026 08:22:08 -0400 Subject: [PATCH 2/3] Install symlink for old path to new path. --- src/ui/CMakeLists.txt | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 785a7c81..76733f3e 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,3 +1,17 @@ +function(install_legacy_helper_symlink legacy_name target_name) + if(NOT BUILD_LITE) + set(legacy_helper_path "\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${_private_libdir}/${legacy_name}") + install(CODE " + file(REMOVE \"${legacy_helper_path}\") + file(CREATE_LINK + \"${_bindir_from_private_libdir}/${target_name}\" + \"${legacy_helper_path}\" + SYMBOLIC + ) + " COMPONENT APPIMAGELAUNCHER) + endif() +endfunction() + if(NOT BUILD_LITE) # main AppImageLauncher application add_executable(AppImageLauncher main.cpp resources.qrc first-run.cpp first-run.h first-run.ui integration_dialog.cpp integration_dialog.h integration_dialog.ui) @@ -33,28 +47,32 @@ install( ) # AppImage removal helper -add_executable(remove remove_main.cpp remove.ui resources.qrc) -target_link_libraries(remove shared translationmanager libappimage) +add_executable(appimagelauncher-remove remove_main.cpp remove.ui resources.qrc) +target_link_libraries(appimagelauncher-remove shared translationmanager libappimage) # see AppImageLauncher for a description -set_target_properties(remove PROPERTIES INSTALL_RPATH "\$ORIGIN") +set_target_properties(appimagelauncher-remove PROPERTIES INSTALL_RPATH ${_rpath}) install( TARGETS - remove - RUNTIME DESTINATION ${_private_libdir} COMPONENT APPIMAGELAUNCHER + appimagelauncher-remove + RUNTIME DESTINATION ${_bindir} COMPONENT APPIMAGELAUNCHER ) +install_legacy_helper_symlink(remove appimagelauncher-remove) + # AppImage update helper if(ENABLE_UPDATE_HELPER) - add_executable(update update.ui update_main.cpp resources.qrc) - target_link_libraries(update shared translationmanager libappimage libappimageupdate-qt Qt5::Quick Qt5::QuickWidgets Qt5::Qml) + add_executable(appimagelauncher-update update.ui update_main.cpp resources.qrc) + target_link_libraries(appimagelauncher-update shared translationmanager libappimage libappimageupdate-qt Qt5::Quick Qt5::QuickWidgets Qt5::Qml) # see AppImageLauncher for a description - set_target_properties(update PROPERTIES INSTALL_RPATH "\$ORIGIN") + set_target_properties(appimagelauncher-update PROPERTIES INSTALL_RPATH ${_rpath}) install( TARGETS - update - RUNTIME DESTINATION ${_private_libdir} COMPONENT APPIMAGELAUNCHER + appimagelauncher-update + RUNTIME DESTINATION ${_bindir} COMPONENT APPIMAGELAUNCHER ) + + install_legacy_helper_symlink(update appimagelauncher-update) endif() From 73421a0d3a9e0f85802bb8c4c6d71405cb8c3399 Mon Sep 17 00:00:00 2001 From: Aldo Barreras Date: Wed, 30 Sep 2026 08:43:35 -0400 Subject: [PATCH 3/3] Remove symlink thing. --- cmake/install.cmake | 3 --- src/ui/CMakeLists.txt | 19 ------------------- 2 files changed, 22 deletions(-) diff --git a/cmake/install.cmake b/cmake/install.cmake index df60a217..ee3de23e 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -29,9 +29,6 @@ set(_abs_private_libdir ${CMAKE_INSTALL_PREFIX}/${_private_libdir}) file(RELATIVE_PATH _rpath ${_abs_bindir} ${_abs_private_libdir}) set(_rpath "\$ORIGIN/${_rpath}") -# compatibility symlinks for helpers formerly installed in the private library directory -file(RELATIVE_PATH _bindir_from_private_libdir ${_abs_private_libdir} ${_abs_bindir}) - # install libappimage.so into lib/appimagekit to avoid overwriting a libappimage potentially installed into /usr/lib # or /usr/lib/x86_64-... or wherever the OS puts its libraries install( diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 76733f3e..f7553a74 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,17 +1,3 @@ -function(install_legacy_helper_symlink legacy_name target_name) - if(NOT BUILD_LITE) - set(legacy_helper_path "\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${_private_libdir}/${legacy_name}") - install(CODE " - file(REMOVE \"${legacy_helper_path}\") - file(CREATE_LINK - \"${_bindir_from_private_libdir}/${target_name}\" - \"${legacy_helper_path}\" - SYMBOLIC - ) - " COMPONENT APPIMAGELAUNCHER) - endif() -endfunction() - if(NOT BUILD_LITE) # main AppImageLauncher application add_executable(AppImageLauncher main.cpp resources.qrc first-run.cpp first-run.h first-run.ui integration_dialog.cpp integration_dialog.h integration_dialog.ui) @@ -58,9 +44,6 @@ install( RUNTIME DESTINATION ${_bindir} COMPONENT APPIMAGELAUNCHER ) -install_legacy_helper_symlink(remove appimagelauncher-remove) - - # AppImage update helper if(ENABLE_UPDATE_HELPER) add_executable(appimagelauncher-update update.ui update_main.cpp resources.qrc) @@ -73,6 +56,4 @@ if(ENABLE_UPDATE_HELPER) appimagelauncher-update RUNTIME DESTINATION ${_bindir} COMPONENT APPIMAGELAUNCHER ) - - install_legacy_helper_symlink(update appimagelauncher-update) endif()