From ac70461680fe77c009529d48ea9eb368dd42bcd2 Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 19:52:05 -0600 Subject: [PATCH 01/10] Add OpenRC service --- resources/appimagelauncherd.in | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 resources/appimagelauncherd.in diff --git a/resources/appimagelauncherd.in b/resources/appimagelauncherd.in new file mode 100755 index 00000000..db698989 --- /dev/null +++ b/resources/appimagelauncherd.in @@ -0,0 +1,7 @@ +#!/sbin/openrc-run + +#OpenRC user service + +description="AppImageLauncher daemon" +supervisor="supervise-daemon" +command="@CMAKE_INSTALL_PREFIX@/bin/appimagelauncherd" From 3579e747401a75cd92f06300368142f847531f24 Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 21:05:53 -0600 Subject: [PATCH 02/10] Rename OpenRC service input file for clarity --- CMakeLists.txt | 7 +++- cmake/install.cmake | 40 ++++++++++++++----- ...uncherd.in => appimagelauncherd_openrc.in} | 0 3 files changed, 35 insertions(+), 12 deletions(-) rename resources/{appimagelauncherd.in => appimagelauncherd_openrc.in} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fa21c65..75f4ac7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ 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 "" ON) if(ENABLE_UPDATE_HELPER) # instruct AppImageUpdate to build the Qt UI set(BUILD_QT_UI ON CACHE BOOL "" FORCE) @@ -57,6 +57,11 @@ endif() # note: for the time being, we require AppImageUpdate to be fetched during build, even if only to make libappimage available FetchContent_MakeAvailable(AppImageUpdate) +# choose what init system to target (for daemon user service) +# set by adding -DSERVICE_TYPE="" when calling cmake +# options: systemd, openrc +set(SERVICE_TYPE "systemd" CACHE STRING "init service provider to target") + # install resources, bundle libraries privately, etc. # initializes important installation destination variables, therefore must be included before adding subdirectories include(cmake/install.cmake) diff --git a/cmake/install.cmake b/cmake/install.cmake index ee3de23e..521038fb 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -89,14 +89,32 @@ if(NOT BUILD_LITE) ) endif() -# install systemd service configuration for appimagelauncherd -configure_file( - ${PROJECT_SOURCE_DIR}/resources/appimagelauncherd.service.in - ${PROJECT_BINARY_DIR}/resources/appimagelauncherd.service - @ONLY -) -# caution: don't use ${CMAKE_INSTALL_LIBDIR} here, it's really just lib/systemd/user -install( - FILES ${PROJECT_BINARY_DIR}/resources/appimagelauncherd.service - DESTINATION lib/systemd/user/ COMPONENT APPIMAGELAUNCHER -) +if (SERVICE_TYPE STREQUAL "systemd") + # install systemd service configuration for appimagelauncherd + configure_file( + ${PROJECT_SOURCE_DIR}/resources/appimagelauncherd.service.in + ${PROJECT_BINARY_DIR}/resources/appimagelauncherd.service + @ONLY + ) + # caution: don't use ${CMAKE_INSTALL_LIBDIR} here, it's really just lib/systemd/user + install( + FILES ${PROJECT_BINARY_DIR}/resources/appimagelauncherd.service + DESTINATION lib/systemd/user/ COMPONENT APPIMAGELAUNCHER + ) + message("Using SystemD service") +elseif (SERVICE_TYPE STREQUAL "openrc") + # install openrc service configuration for appimagelauncherd + # + # the output file name will be the name of the service + # so it must be "appimagelauncherd" + configure_file( + ${PROJECT_SOURCE_DIR}/resources/appimagelauncherd_openrc.in + ${PROJECT_BINARY_DIR}/resources/appimagelauncherd + @ONLY + ) + install( + FILES ${PROJECT_BINARY_DIR}/resources/appimagelauncherd + DESTINATION /etc/user/init.d COMPONENT APPIMAGELAUNCHER + ) + message("Using OpenRC service") +endif() diff --git a/resources/appimagelauncherd.in b/resources/appimagelauncherd_openrc.in similarity index 100% rename from resources/appimagelauncherd.in rename to resources/appimagelauncherd_openrc.in From 21b2caa69c7d42056a9c23ccc5bf34ed25a896da Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 21:31:49 -0600 Subject: [PATCH 03/10] Fix OpenRC service install path --- cmake/install.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/install.cmake b/cmake/install.cmake index 521038fb..f4000afb 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -114,7 +114,7 @@ elseif (SERVICE_TYPE STREQUAL "openrc") ) install( FILES ${PROJECT_BINARY_DIR}/resources/appimagelauncherd - DESTINATION /etc/user/init.d COMPONENT APPIMAGELAUNCHER + DESTINATION etc/user/init.d COMPONENT APPIMAGELAUNCHER ) message("Using OpenRC service") endif() From c76e381da4547bedbf0b090b6cc5600df1ac779e Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 21:48:27 -0600 Subject: [PATCH 04/10] Fix OpenRC service file permissions --- cmake/install.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/install.cmake b/cmake/install.cmake index f4000afb..3138efb1 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -114,6 +114,9 @@ elseif (SERVICE_TYPE STREQUAL "openrc") ) install( FILES ${PROJECT_BINARY_DIR}/resources/appimagelauncherd + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE DESTINATION etc/user/init.d COMPONENT APPIMAGELAUNCHER ) message("Using OpenRC service") From aef5c9876180194bf3f3935b6c49f9a04ece644c Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 21:49:50 -0600 Subject: [PATCH 05/10] Add support for managing OpenRC service daemon --- CMakeLists.txt | 7 ++++++- src/ui/settings_dialog.cpp | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75f4ac7f..b08942e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,10 +57,15 @@ endif() # note: for the time being, we require AppImageUpdate to be fetched during build, even if only to make libappimage available FetchContent_MakeAvailable(AppImageUpdate) -# choose what init system to target (for daemon user service) +# choose what init service system to target (for daemon user service) # set by adding -DSERVICE_TYPE="" when calling cmake # options: systemd, openrc set(SERVICE_TYPE "systemd" CACHE STRING "init service provider to target") +if (SERVICE_TYPE STREQUAL "systemd") + add_definitions(-DSERVICE_TYPE_SYSTEMD) +elseif (SERVICE_TYPE STREQUAL "openrc") + add_definitions(-DSERVICE_TYPE_OPENRC) +endif() # install resources, bundle libraries privately, etc. # initializes important installation destination variables, therefore must be included before adding subdirectories diff --git a/src/ui/settings_dialog.cpp b/src/ui/settings_dialog.cpp index c2b451de..23e99533 100644 --- a/src/ui/settings_dialog.cpp +++ b/src/ui/settings_dialog.cpp @@ -157,6 +157,7 @@ void SettingsDialog::saveSettings() { void SettingsDialog::toggleDaemon() { // assumes defaults if config doesn't exist or lacks the related key(s) if (settingsFile) { +#ifdef SERVICE_TYPE_SYSTEMD if (settingsFile->value("AppImageLauncher/enable_daemon", "true").toBool()) { system("systemctl --user enable appimagelauncherd.service"); // we want to actually restart the service to apply the new configuration @@ -165,6 +166,17 @@ void SettingsDialog::toggleDaemon() { system("systemctl --user disable appimagelauncherd.service"); system("systemctl --user stop appimagelauncherd.service"); } +#elif SERVICE_TYPE_OPENRC + if (settingsFile->value("AppImageLauncher/enable_daemon", "true").toBool()) { + // enable service and restart + system("rc-update add --user appimagelauncherd default"); + system("rc-service --user appimagelauncherd restart"); + } else { + // disable service and stop it + system("rc-update del --user appimagelauncherd default"); + system("rc-service --user appimagelauncherd stop"); + } +#endif } } From 12f1df50c39db6b7b22652140fe6d7a1abc19f3d Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 21:55:24 -0600 Subject: [PATCH 06/10] Undo unrelated change --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b08942e7..764bcb0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ 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 ON) if(ENABLE_UPDATE_HELPER) # instruct AppImageUpdate to build the Qt UI set(BUILD_QT_UI ON CACHE BOOL "" FORCE) From bfb2bd4f17649ef946e6b590aefc8c35b10622df Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 22:02:01 -0600 Subject: [PATCH 07/10] Add OpenRC respawn delay to copy SystemD service behavior --- resources/appimagelauncherd_openrc.in | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/appimagelauncherd_openrc.in b/resources/appimagelauncherd_openrc.in index db698989..f68f32fd 100755 --- a/resources/appimagelauncherd_openrc.in +++ b/resources/appimagelauncherd_openrc.in @@ -4,4 +4,5 @@ description="AppImageLauncher daemon" supervisor="supervise-daemon" +respawn_delay=10 command="@CMAKE_INSTALL_PREFIX@/bin/appimagelauncherd" From 9e45ffc3715c43f0d03d792f049b0dd5b49b7f51 Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Mon, 22 Dec 2025 22:17:16 -0600 Subject: [PATCH 08/10] Add default log location --- resources/appimagelauncherd_openrc.in | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/appimagelauncherd_openrc.in b/resources/appimagelauncherd_openrc.in index f68f32fd..b9583b7f 100755 --- a/resources/appimagelauncherd_openrc.in +++ b/resources/appimagelauncherd_openrc.in @@ -6,3 +6,4 @@ description="AppImageLauncher daemon" supervisor="supervise-daemon" respawn_delay=10 command="@CMAKE_INSTALL_PREFIX@/bin/appimagelauncherd" +output_log="${XDG_STATE_HOME}/appimagelauncherd.log" From 15d8477e8f179ec8db8953ce4af4f3a9f2038bda Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Tue, 23 Dec 2025 17:40:42 -0600 Subject: [PATCH 09/10] Use conventional log name for OpenRC service --- resources/appimagelauncherd_openrc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/appimagelauncherd_openrc.in b/resources/appimagelauncherd_openrc.in index b9583b7f..2ffa6273 100755 --- a/resources/appimagelauncherd_openrc.in +++ b/resources/appimagelauncherd_openrc.in @@ -6,4 +6,4 @@ description="AppImageLauncher daemon" supervisor="supervise-daemon" respawn_delay=10 command="@CMAKE_INSTALL_PREFIX@/bin/appimagelauncherd" -output_log="${XDG_STATE_HOME}/appimagelauncherd.log" +output_log="${XDG_STATE_HOME}/appimagelauncherd" From 1ff92617a504bb01937abc91d165f3bb143e4505 Mon Sep 17 00:00:00 2001 From: Ahmed A Date: Tue, 23 Dec 2025 18:08:07 -0600 Subject: [PATCH 10/10] Update build instructions with OpenRC option --- BUILD.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BUILD.md b/BUILD.md index 8e881385..8515528d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -42,6 +42,10 @@ For Ubuntu/Debian systems, this might look like: sudo apt install make cmake libglib2.0-dev libcairo2-dev librsvg2-dev libfuse-dev libarchive-dev libxpm-dev libcurl4-openssl-dev libboost-all-dev qtbase5-dev qtdeclarative5-dev qttools5-dev-tools patchelf libc6-dev libc6-dev gcc-multilib g++-multilib ``` +## Options +By default, AppImageLauncher is built for System-D based systems. +OpenRC can be targeted instead by adding `-DSERVICE_TYPE="openrc"`. + ## Build Please update the `PREFIX` if you want. The prefix is the location the final application will be installed to. Usual locations may be `/usr/local` (default), `/usr`, `~/.local` or `/opt`.