richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
8d419f
From 71a8029607b54259f28ac1fc0627c7f1e6db586a Mon Sep 17 00:00:00 2001
8d419f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
8d419f
Date: Thu, 24 Mar 2022 11:52:35 +0100
8d419f
Subject: [PATCH] test-systemctl-enable: make shellcheck happy
8d419f
8d419f
Quoting is not necessary in many places, but I think it's nicer
8d419f
to use it consistently.
8d419f
8d419f
(cherry picked from commit 84fdced62c740a3b07656e84747dd721ad6a30c5)
8d419f
8d419f
Related: #2082131
8d419f
---
8d419f
 test/test-systemctl-enable.sh | 76 +++++++++++++++++------------------
8d419f
 1 file changed, 38 insertions(+), 38 deletions(-)
8d419f
8d419f
diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh
8d419f
index 45f3513de3..3b30f090a5 100644
8d419f
--- a/test/test-systemctl-enable.sh
8d419f
+++ b/test/test-systemctl-enable.sh
8d419f
@@ -19,10 +19,10 @@ islink() {
8d419f
     test "$(readlink "$1")" = "$2" || return 2
8d419f
 }
8d419f
 
8d419f
-: ------enablement nonexistent--------------------------------
8d419f
+: '------enable nonexistent------------------------------------'
8d419f
 "$systemctl" --root="$root" enable test1.service && { echo "Expected failure" >&2; exit 1; }
8d419f
 
8d419f
-: ------basic enablement--------------------------------------
8d419f
+: '------basic enablement--------------------------------------'
8d419f
 mkdir -p "$root/etc/systemd/system"
8d419f
 cat >"$root/etc/systemd/system/test1.service" <
8d419f
 [Install]
8d419f
@@ -42,7 +42,7 @@ test -h "$root/etc/systemd/system/special.target.requires/test1.service"
8d419f
 test ! -e "$root/etc/systemd/system/default.target.wants/test1.service"
8d419f
 test ! -e "$root/etc/systemd/system/special.target.requires/test1.service"
8d419f
 
8d419f
-: ------suffix guessing---------------------------------------
8d419f
+: '------suffix guessing---------------------------------------'
8d419f
 "$systemctl" --root="$root" enable test1
8d419f
 test -h "$root/etc/systemd/system/default.target.wants/test1.service"
8d419f
 test -h "$root/etc/systemd/system/special.target.requires/test1.service"
8d419f
@@ -55,7 +55,7 @@ test -h "$root/etc/systemd/system/special.target.requires/test1.service"
8d419f
 test ! -e "$root/etc/systemd/system/default.target.wants/test1.service"
8d419f
 test ! -e "$root/etc/systemd/system/special.target.requires/test1.service"
8d419f
 
8d419f
-: -------aliases----------------------------------------------
8d419f
+: '-------aliases----------------------------------------------'
8d419f
 cat >>"$root/etc/systemd/system/test1.service" <
8d419f
 Alias=test1-goodalias.service
8d419f
 Alias=test1@badalias.service
8d419f
@@ -76,7 +76,7 @@ test ! -h "$root/etc/systemd/system/test1-badalias.socket"
8d419f
 test -e "$root/etc/systemd/system/test1-goodalias2.service"
8d419f
 test -h "$root/etc/systemd/system/test1-goodalias2.service"
8d419f
 
8d419f
-: -------aliases in reeanble----------------------------------
8d419f
+: '-------aliases in reeanble----------------------------------'
8d419f
 "$systemctl" --root="$root" reenable test1 && { echo "Expected failure" >&2; exit 1; }
8d419f
 islink "$root/etc/systemd/system/default.target.wants/test1.service" "../test1.service"
8d419f
 islink "$root/etc/systemd/system/test1-goodalias.service" "test1.service"
8d419f
@@ -90,7 +90,7 @@ test ! -h "$root/etc/systemd/system/default.target.wants/test1.service"
8d419f
 test ! -h "$root/etc/systemd/system/special.target.requires/test1.service"
8d419f
 test ! -h "$root/etc/systemd/system/test1-goodalias.service"
8d419f
 
8d419f
-: -------also units-------------------------------------------
8d419f
+: '-------also units-------------------------------------------'
8d419f
 cat >"$root/etc/systemd/system/test2.socket" <
8d419f
 [Install]
8d419f
 WantedBy=sockets.target
8d419f
@@ -116,7 +116,7 @@ test ! -e "$root/etc/systemd/system/default.target.wants/test2.service"
8d419f
 test ! -e "$root/etc/systemd/system/sockets.target.wants/test2.socket"
8d419f
 
8d419f
 
8d419f
-: -------link-------------------------------------------------
8d419f
+: '-------link-------------------------------------------------'
8d419f
 # File doesn't exist yet
8d419f
 test ! -e "$root/link1.path"
8d419f
 "$systemctl" --root="$root" link '/link1.path' && { echo "Expected failure" >&2; exit 1; }
8d419f
@@ -130,65 +130,65 @@ EOF
8d419f
 "$systemctl" --root="$root" link '/link1.path'
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 
8d419f
-: -------link already linked same path------------------------
8d419f
+: '-------link already linked same path------------------------'
8d419f
 SYSTEMD_LOG_LEVEL=debug "$systemctl" --root="$root" link '/link1.path'  # this passes
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 
8d419f
-: -------link already linked different path-------------------
8d419f
+: '-------link already linked different path-------------------'
8d419f
 mkdir "$root/subdir"
8d419f
 cp "$root/link1.path" "$root/subdir/"
8d419f
 "$systemctl" --root="$root" link '/subdir/link1.path' && { echo "Expected failure" >&2; exit 1; }
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 
8d419f
-: -------link bad suffix--------------------------------------
8d419f
+: '-------link bad suffix--------------------------------------'
8d419f
 cp "$root/link1.path" "$root/subdir/link1.suffix"
8d419f
 "$systemctl" --root="$root" link '/subdir/link1.suffix' && { echo "Expected failure" >&2; exit 1; }
8d419f
 test ! -e "$root/etc/systemd/system/link1.suffix"
8d419f
 
8d419f
-: -------unlink by unit name----------------------------------
8d419f
+: '-------unlink by unit name----------------------------------'
8d419f
 "$systemctl" --root="$root" disable 'link1.path'
8d419f
 test ! -e "$root/etc/systemd/system/link1.path"
8d419f
 
8d419f
-: -------unlink by path---------------------------------------
8d419f
+: '-------unlink by path---------------------------------------'
8d419f
 "$systemctl" --root="$root" link '/link1.path'
8d419f
 test -h "$root/etc/systemd/system/link1.path"
8d419f
 "$systemctl" --root="$root" disable '/link1.path'
8d419f
 test ! -e "$root/etc/systemd/system/link1.path"
8d419f
 
8d419f
-: -------unlink by wrong path---------------------------------
8d419f
+: '-------unlink by wrong path---------------------------------'
8d419f
 "$systemctl" --root="$root" link '/link1.path'
8d419f
 test -h "$root/etc/systemd/system/link1.path"
8d419f
 "$systemctl" --root="$root" disable '/subdir/link1.path'  # we only care about the name
8d419f
 test ! -e "$root/etc/systemd/system/link1.path"
8d419f
 
8d419f
 
8d419f
-: -------link and enable--------------------------------------
8d419f
+: '-------link and enable--------------------------------------'
8d419f
 "$systemctl" --root="$root" enable '/link1.path'
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
8d419f
 
8d419f
-: -------enable already linked same path----------------------
8d419f
+: '-------enable already linked same path----------------------'
8d419f
 "$systemctl" --root="$root" enable '/link1.path'
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
8d419f
 
8d419f
-: -------enable already linked different path-----------------
8d419f
+: '-------enable already linked different path-----------------'
8d419f
 "$systemctl" --root="$root" enable '/subdir/link1.path' && { echo "Expected failure" >&2; exit 1; }
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
8d419f
 
8d419f
-: -------enable bad suffix------------------------------------
8d419f
+: '-------enable bad suffix------------------------------------'
8d419f
 cp "$root/link1.path" "$root/subdir/link1.suffix"
8d419f
 "$systemctl" --root="$root" enable '/subdir/link1.suffix' && { echo "Expected failure" >&2; exit 1; }
8d419f
 test ! -e "$root/etc/systemd/system/link1.suffix"
8d419f
 test ! -e "$root/etc/systemd/system/paths.target.wants/link1.suffix"
8d419f
 
8d419f
-: -------disable by unit name---------------------------------
8d419f
+: '-------disable by unit name---------------------------------'
8d419f
 "$systemctl" --root="$root" disable 'link1.path'
8d419f
 test ! -e "$root/etc/systemd/system/link1.path"
8d419f
 test ! -e "$root/etc/systemd/system/paths.target.wants/link1.path"
8d419f
 
8d419f
-: -------disable by path--------------------------------------
8d419f
+: '-------disable by path--------------------------------------'
8d419f
 "$systemctl" --root="$root" enable '/link1.path'
8d419f
 test -h "$root/etc/systemd/system/link1.path"
8d419f
 test -h "$root/etc/systemd/system/paths.target.wants/link1.path"
8d419f
@@ -197,7 +197,7 @@ test ! -e "$root/etc/systemd/system/link1.path"
8d419f
 test ! -e "$root/etc/systemd/system/paths.target.wants/link1.path"
8d419f
 
8d419f
 
8d419f
-: -------link then enable-------------------------------------
8d419f
+: '-------link and enable-------------------------------------'
8d419f
 "$systemctl" --root="$root" link '/link1.path'
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 test ! -h "$root/etc/systemd/system/paths.target.wants/link1.path"
8d419f
@@ -210,7 +210,7 @@ islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
8d419f
 islink "$root/etc/systemd/system/link1.path" "/link1.path"
8d419f
 islink "$root/etc/systemd/system/paths.target.wants/link1.path" "../link1.path"
8d419f
 
8d419f
-: -------manual link------------------------------------------
8d419f
+: '-------manual link------------------------------------------'
8d419f
 cat >"$root/link3.suffix" <
8d419f
 [Install]
8d419f
 WantedBy=services.target
8d419f
@@ -227,18 +227,18 @@ SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" disab
8d419f
 test ! -h "$root/etc/systemd/system/link3.service"
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/link3.service"
8d419f
 
8d419f
-: -------enable on masked-------------------------------------
8d419f
+: '-------enable on masked-------------------------------------'
8d419f
 ln -s "/dev/null" "$root/etc/systemd/system/masked.service"
8d419f
 "$systemctl" --root="$root" enable 'masked.service' && { echo "Expected failure" >&2; exit 1; }
8d419f
 "$systemctl" --root="$root" enable '/etc/systemd/system/masked.service' && { echo "Expected failure" >&2; exit 1; }
8d419f
 
8d419f
-: -------enable on masked alias-------------------------------
8d419f
+: '-------enable on masked alias-------------------------------'
8d419f
 test -h "$root/etc/systemd/system/masked.service"
8d419f
 ln -s "masked.service" "$root/etc/systemd/system/masked-alias.service"
8d419f
 "$systemctl" --root="$root" enable 'masked-alias.service' && { echo "Expected failure" >&2; exit 1; }
8d419f
 "$systemctl" --root="$root" enable '/etc/systemd/system/masked-alias.service' && { echo "Expected failure" >&2; exit 1; }
8d419f
 
8d419f
-: -------issue 22000: link in subdirectory--------------------
8d419f
+: '-------issue 22000: link in subdirectory--------------------'
8d419f
 mkdir -p "$root/etc/systemd/system/myown.d"
8d419f
 cat >"$root/etc/systemd/system/link5-also.service" <
8d419f
 [Install]
8d419f
@@ -259,7 +259,7 @@ test ! -h "$root/etc/systemd/system/services.target.wants/link5-also.service"
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/link5.service"
8d419f
 islink "$root/etc/systemd/system/services.target.wants/link5-also.service" "../link5-also.service"
8d419f
 
8d419f
-: -------template enablement----------------------------------
8d419f
+: '-------template enablement----------------------------------'
8d419f
 cat >"$root/etc/systemd/system/templ1@.service" <
8d419f
 [Install]
8d419f
 WantedBy=services.target
8d419f
@@ -288,7 +288,7 @@ test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service"
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/templ1@two.service"
8d419f
 
8d419f
-: -------template enablement w/ default instance--------------
8d419f
+: '-------template enablement w/ default instance--------------'
8d419f
 cat >"$root/etc/systemd/system/templ1@.service" <
8d419f
 [Install]
8d419f
 # check enablement with
8d419f
@@ -337,7 +337,7 @@ test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.serv
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/templ1@two.service"
8d419f
 test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service"
8d419f
 
8d419f
-: -------removal of relative enablement symlinks--------------
8d419f
+: '-------removal of relative enablement symlinks--------------'
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service"
8d419f
 ln -s '../templ1@one.service' "$root/etc/systemd/system/services.target.wants/templ1@one.service"
8d419f
 ln -s 'templ1@two.service' "$root/etc/systemd/system/services.target.wants/templ1@two.service"
8d419f
@@ -357,7 +357,7 @@ test ! -h "$root/etc/systemd/system/services.target.wants/templ1@five.service"
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/templ1@six.service"
8d419f
 test ! -h "$root/etc/systemd/system/services.target.wants/templ1@seven.service"
8d419f
 
8d419f
-: -------template enablement for another template-------------
8d419f
+: '-------template enablement for another template-------------'
8d419f
 cat >"$root/etc/systemd/system/templ2@.service" <
8d419f
 [Install]
8d419f
 RequiredBy=another-template@.target
8d419f
@@ -382,7 +382,7 @@ test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@two
8d419f
 test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@.service"
8d419f
 test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service"
8d419f
 
8d419f
-: -------aliases w/ and w/o instance--------------------------
8d419f
+: '-------aliases w/ and w/o instance--------------------------'
8d419f
 test ! -e "$root/etc/systemd/system/link4.service"
8d419f
 cat >"$root/etc/systemd/system/link4.service" <
8d419f
 [Install]
8d419f
@@ -407,7 +407,7 @@ test ! -h "$root/etc/systemd/system/link4@inst.service"
8d419f
 test ! -h "$root/etc/systemd/system/link4alias.service"
8d419f
 test ! -h "$root/etc/systemd/system/link4alias2.service"
8d419f
 
8d419f
-: -------systemctl enable on path to unit file----------------
8d419f
+: '-------systemctl enable on path to unit file----------------'
8d419f
 cat >"$root/etc/systemd/system/link4.service" <
8d419f
 [Install]
8d419f
 Alias=link4alias.service
8d419f
@@ -425,7 +425,7 @@ test ! -h "$root/etc/systemd/system/link4.service"
8d419f
 test ! -h "$root/etc/systemd/system/link4alias.service"
8d419f
 test ! -h "$root/etc/systemd/system/link4alias2.service"
8d419f
 
8d419f
-: -------issue 661: enable on unit file--------------
8d419f
+: '-------issue 661: enable on unit file--------------'
8d419f
 test ! -e "$root/etc/systemd/system/link5.service"
8d419f
 cat >"$root/etc/systemd/system/link5.service" <
8d419f
 [Install]
8d419f
@@ -443,7 +443,7 @@ islink "$root/etc/systemd/system/link5alias2.service" "link5.service"
8d419f
 test ! -h "$root/etc/systemd/system/link5alias.service"
8d419f
 test ! -h "$root/etc/systemd/system/link5alias2.service"
8d419f
 
8d419f
-: -------issue 661: link and enable on unit file--------------
8d419f
+: '-------issue 661: link and enable on unit file--------------'
8d419f
 test ! -e "$root/etc/systemd/system/link5copy.service"
8d419f
 cat >"$root/link5copy.service" <
8d419f
 [Install]
8d419f
@@ -474,7 +474,7 @@ test ! -h "$root/etc/systemd/system/link5copy.service"
8d419f
 test ! -h "$root/etc/systemd/system/link5alias.service"
8d419f
 test ! -h "$root/etc/systemd/system/link5alias2.service"
8d419f
 
8d419f
-: ----issue 19437: plain templates in .wants/ or .requires/---
8d419f
+: '----issue 19437: plain templates in .wants/ or .requires/---'
8d419f
 test ! -e "$root/etc/systemd/system/link5@.path"
8d419f
 cat >"$root/etc/systemd/system/link5@.path" <
8d419f
 [Install]
8d419f
@@ -498,7 +498,7 @@ test ! -h "$root/etc/systemd/system/target5@.target.requires/link5@.path"
8d419f
 test ! -h "$root/etc/systemd/system/target5@inst.target.wants/link5@.path"
8d419f
 test ! -h "$root/etc/systemd/system/target5@inst.target.requires/link5@.path"
8d419f
 
8d419f
-: -------removal of symlinks not listed in [Install]----------
8d419f
+: '-------removal of symlinks not listed in [Install]----------'
8d419f
 # c.f. 66a19d85a533b15ed32f4066ec880b5a8c06babd
8d419f
 test ! -e "$root/etc/systemd/system/multilink.mount"
8d419f
 cat >"$root/etc/systemd/system/multilink.mount" <
8d419f
@@ -517,12 +517,12 @@ test ! -h "$root/etc/systemd/system/default.target.wants/"
8d419f
 test ! -h "$root/etc/systemd/system/multilink-alias.mount"
8d419f
 test ! -h "$root/etc/systemd/system/multilink-badalias.service"
8d419f
 
8d419f
-: -------merge 20017: specifiers in the unit file-------------
8d419f
+: '-------merge 20017: specifiers in the unit file-------------'
8d419f
 test ! -e "$root/etc/systemd/system/some-some-link6@.socket"
8d419f
 # c.f. de61a04b188f81a85cdb5c64ddb4987dcd9d30d3
8d419f
 
8d419f
 check_alias() {
8d419f
-    : ------------------ %$1 -------------------------------------
8d419f
+    : "------------------ %$1 -------------------------------------"
8d419f
     cat >"$root/etc/systemd/system/some-some-link6@.socket" <
8d419f
 [Install]
8d419f
 Alias=target@$1:%$1.socket
8d419f
@@ -616,7 +616,7 @@ check_alias % '%' && { echo "Expected failure because % is not legal in unit nam
8d419f
 
8d419f
 check_alias z 'z' && { echo "Expected failure because %z is not known" >&2; exit 1; }
8d419f
 
8d419f
-: -------specifiers in WantedBy-------------------------------
8d419f
+: '-------specifiers in WantedBy-------------------------------'
8d419f
 # We don't need to repeat all the tests. Let's do a basic check that specifier
8d419f
 # expansion is performed.
8d419f
 
8d419f
@@ -642,7 +642,7 @@ test ! -h "$root/etc/systemd/system/another-target2@.target.requires/some-some-l
8d419f
 
8d419f
 # TODO: repeat the tests above for presets
8d419f
 
8d419f
-: -------SYSTEMD_OS_RELEASE relative to root------------------
8d419f
+: '-------SYSTEMD_OS_RELEASE relative to root-------------------'
8d419f
 # check that os-release overwriting works as expected with root
8d419f
 test -e "$root/etc/os-release"
8d419f