Add ISU package 11/300011/1
authorAdam Michalski <a.michalski2@partner.samsung.com>
Tue, 13 Jun 2023 15:52:56 +0000 (17:52 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 13 Oct 2023 10:16:10 +0000 (19:16 +0900)
The following changes have been made for ISU:
* isu/isu.cfg - ISU configuration file.
    [isu] section:
        `name` and `version` have been filled by using the #NAME# and #VERSION#
        patterns that in turn will be replaced by the `%isu_package` RPM macro
        into the name and version of the RPM package.
        `system_service` is the systemd service name and must be the same as the
        original one.
    [files] section:
        contains a list of all files that should be added to the ISU package.
        Since we only want to replace the binary, there is only one file here.
* isu/deviced.service - modified ISU service file.
    Compared to the original 'deviced.service' the following changes have been
    made for ISU:
    - `EnvironmentFile=/etc/isu/service-common.inc` - to include ISU-specific
      variables
    - `ExecStart=` has been changed to launch sandbox application with default
      parameters (`ISU_SANDBOX_INVOCATION`), ISU-provided
      `#ISU_RUN_PATH#/deviced/rootfs/usr/bin/deviced` is visible as
      `/usr/bin/deviced` in the sandbox
    - `NotifyAccess=all` has been set as there is one intermediate process
      (`isu-sandbox`) between `systemd` and `/usr/bin/deviced`
* isu/CMakeLists.txt - CMake config file for the ISU.
    Added installing ISU config file and the service file to the appropriate
    locations (/etc/isu/*)
* CMakeLists.txt - main config file for CMake.
    We've added the `isu` subdirectory where we placed the isu configuration
    file and the modified service file that will run `dlog` in a sandboxed
    environment.
* packaging/deviced.spec - main `deviced` RPM spec file.
    We've made the following changes:
    - added `Requires: %{name}-isu = %{version}-%{release}` tag in the main
      spec section which will cause the ISU package to be installed when the
      original package is installed.
    - added the `%isu_package` macro invocation right before the `%prep` section
      which will cause the configuration to be placed in the correct location
      with all ISU-related files packaged into the `*-isu` RPM package.

Change-Id: I8c81d0df6d81afae50d1e703940d1889df0b68bf
Signed-off-by: Adam Michalski <a.michalski2@partner.samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
CMakeLists.txt
isu/CMakeLists.txt [new file with mode: 0644]
isu/deviced.service [new file with mode: 0644]
isu/isu.cfg [new file with mode: 0644]
packaging/deviced.spec

index 8aca3d1..bb423d4 100644 (file)
@@ -342,6 +342,7 @@ IF(BATTERY_MODULE STREQUAL on)
        ADD_SUBDIRECTORY(plugins/mobile/battery)
        ADD_SUBDIRECTORY(plugins/wearable/battery)
 ENDIF()
+ADD_SUBDIRECTORY(isu)
 
 INSTALL_CONF(conf display-profile-mobile)
 INSTALL_CONF(conf display-profile-wearable)
diff --git a/isu/CMakeLists.txt b/isu/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5b86da3
--- /dev/null
@@ -0,0 +1,5 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ISU C)
+
+INSTALL(FILES isu.cfg DESTINATION /etc/isu/deviced/ PERMISSIONS OWNER_WRITE OWNER_READ)
+INSTALL(FILES deviced.service DESTINATION /etc/isu/deviced/system-services/ PERMISSIONS OWNER_WRITE OWNER_READ)
diff --git a/isu/deviced.service b/isu/deviced.service
new file mode 100644 (file)
index 0000000..bbc6201
--- /dev/null
@@ -0,0 +1,25 @@
+[Unit]
+Description=System device daemon
+
+# Caution: never uncomment below "Wants=" and "After=" entries.
+# Just information, deviced internally wait for /run/.wm_ready
+# Wants=display-manager.service
+# After=display-manager.service
+
+[Service]
+Type=notify
+NotifyAccess=all
+SmackProcessLabel=System::Privileged
+Environment=XDG_RUNTIME_DIR=/run
+Environment=LD_LIBRARY_PATH=/run/isu/deviced/rootfs/usr/lib/
+EnvironmentFile=/etc/isu/service-common.inc
+ExecStart=/bin/isu-sandbox $ISU_SANDBOX_INVOCATION \
+                     --bind #ISU_RUN_PATH#/deviced/rootfs #ISU_RUN_PATH#/deviced/rootfs/ \
+                     --bind #ISU_RUN_PATH#/deviced/rootfs/usr/bin/deviced /usr/bin/deviced \
+                     /usr/bin/deviced
+Restart=on-failure
+RestartSec=0
+KillSignal=SIGUSR1
+
+[Install]
+WantedBy=multi-user.target
diff --git a/isu/isu.cfg b/isu/isu.cfg
new file mode 100644 (file)
index 0000000..0da0ce7
--- /dev/null
@@ -0,0 +1,8 @@
+[isu]
+name=#NAME#
+version=#VERSION#
+system_service=deviced.service
+
+[files]
+/usr/bin/deviced
+
index a963293..b741a7e 100644 (file)
@@ -44,6 +44,7 @@ BuildRequires:  pkgconfig(argos_watchdog)
 BuildRequires:  pkgconfig(cmocka)
 
 Requires: %{name}-tools = %{version}-%{release}
+Requires: %{name}-isu = %{version}-%{release}
 %{?systemd_requires}
 Requires(post): /usr/bin/vconftool
 Requires(post): %{_sbindir}/update-alternatives
@@ -130,6 +131,8 @@ Requires:   %{name} = %{version}-%{release}
 %description plugin-profile-iot-headless
 Plugin libraries for IoT headless devices
 
+%isu_package
+
 %prep
 %setup -q