Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions resources/appimagelauncher-lite-AppRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path> Run removal helper to remove AppImage <path>"
echo " update <path> Run update helper to update AppImage <path>"
}

case "$firstarg" in
Expand All @@ -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
Expand Down Expand Up @@ -118,5 +116,3 @@ EOF
;;
esac



25 changes: 15 additions & 10 deletions src/shared/shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,7 @@ QString privateLibDirPath(const QString& srcSubdirName) {
}

// if there is no such directory like <prefix>/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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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";
Expand All @@ -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
Expand Down Expand Up @@ -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());
Expand Down
21 changes: 10 additions & 11 deletions src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,27 @@ 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
)


# 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
)
endif()