Check services in ISU directories 43/295543/1
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Thu, 27 Apr 2023 11:14:41 +0000 (13:14 +0200)
committerAdam Michalski <a.michalski2@partner.samsung.com>
Mon, 10 Jul 2023 14:40:06 +0000 (16:40 +0200)
This patch adds verification of service files provided under the ISU
(Individual Service Upgrade) mechanism.

Change-Id: I86afe2cc5c99169c79976298498377a51b3182d6

test/new_service_test/check_systemd_service.sh
test/new_service_test/check_systemd_socket.sh
test/new_service_test/systemd_test_util

index 3e81edcc155569efa87f175a805f087ba8f6f3a0..ab19ed91d4127906a9353ad2e9f1117ef5f1053e 100755 (executable)
@@ -50,7 +50,7 @@ function check_prefix_in_exec
 # function to find and check service file in systemd directory (system session)
 function find_system_service
 {
-       for line in `find "$system_unit_dir" -type f -name "*service" 2> /dev/null`
+       for line in `find "$system_unit_dir" $isu_system_unit_dir -type f -name "*service" 2> /dev/null`
        do
                uid="$(cat $line | grep "User=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')"
                gid="$(cat $line | grep "Group=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')"
index c074a61f7f1cda73c8b200ab4572a4122b38a9c0..f37ddc09843fd21e967e5922534b239ff57d1a9d 100644 (file)
@@ -69,13 +69,13 @@ function check_multi_socket_case
 # function to find and check service file in systemd directory
 function find_system_socket
 {
-       for line in `find "$system_unit_dir" -type f -name "*.socket" 2> /dev/null`
+       for line in `find "$system_unit_dir" $isu_system_unit_dir -type f -name "*.socket" 2> /dev/null`
        do
                # check # of [Socket]
                if [ "$(cat $line | grep '\[Socket\]' | wc -l)" != "1" ]
                then
                        check_multi_socket_case $line
-               else 
+               else
                        SocketUser="$(cat $line | grep "SocketUser=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')"
                        SocketGroup="$(cat $line | grep "SocketGroup=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')"
                        SocketMode="$(cat $line | grep "SocketMode=" | grep -v "#" | cut -d "=" -f2 | tr -d '\015')"
index 0856fa7228b5eb92104b3564ea36b87a010c9bb6..69cc3b8b3b3c2e5d2e97b223570818763d10f4b0 100644 (file)
@@ -7,6 +7,10 @@ cur_dir="/usr/share/security-config/test/new_service_test"
 not_permitted_unit_path="/opt/share/security-config/not_permitted_service/"
 system_unit_dir="/usr/lib/systemd/system/"
 dbus_service_dir="/usr/share/dbus-1/system-services/"
+# asterisk represents configuration subdirectories for ISU packages
+# their names must directly correspond to the package names
+# (e.g., dlog for the dlog package, deviced for the deviced package etc.)
+isu_system_unit_dir="/etc/isu/*/system-services/"
 
 # function to move service file to another directory. This socket cannot be used.
 # $1 : file path, $2 : file name