Check services in ISU directories 42/295542/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:24:42 +0000 (14:24 +0000)
This patch adds verification of service files provided under the ISU
(Individual Service Upgrade) mechanism.

Change-Id: I86afe2cc5c99169c79976298498377a51b3182d6
(cherry picked from commit fb0d6f178adf203296cb2d71c7caec8efdb05c20)

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

index b0f1ea3..32c18df 100755 (executable)
@@ -49,7 +49,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 1123370..877fe08 100644 (file)
@@ -68,13 +68,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 f6b91ad..e040c70 100644 (file)
@@ -11,6 +11,10 @@ systemd_service_list_csv="$cur_dir/systemd_service.csv"
 systemd_socket_list_csv="$cur_dir/systemd_socket.csv"
 systemd_service_list="$cur_dir/systemd_service.list"
 systemd_socket_list="$cur_dir/systemd_socket.list"
+# 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