]>
Commit | Line | Data |
---|---|---|
50c5f5a3 ZJS |
1 | #!/usr/bin/env bash |
2 | # SPDX-License-Identifier: LGPL-2.1-or-later | |
3 | set -ex | |
4 | ||
5 | # Silence warning from running_in_chroot_or_offline() | |
6 | export SYSTEMD_IGNORE_CHROOT=1 | |
7 | ||
8 | systemctl=${1:-systemctl} | |
2a2d002f | 9 | systemd_id128=${2:-systemd-id128} |
50c5f5a3 ZJS |
10 | |
11 | unset root | |
12 | cleanup() { | |
13 | [ -n "$root" ] && rm -rf "$root" | |
14 | } | |
15 | trap cleanup exit | |
16 | root=$(mktemp -d --tmpdir systemctl-test.XXXXXX) | |
17 | ||
18 | islink() { | |
19 | test -h "$1" || return 1 | |
20 | test "$(readlink "$1")" = "$2" || return 2 | |
21 | } | |
22 | ||
25cbc42d | 23 | : '-------enable nonexistent--------------------------------------' |
d6c51c48 | 24 | ( ! "$systemctl" --root="$root" enable test1.service ) |
50c5f5a3 | 25 | |
25cbc42d | 26 | : '-------basic enablement----------------------------------------' |
50c5f5a3 ZJS |
27 | mkdir -p "$root/etc/systemd/system" |
28 | cat >"$root/etc/systemd/system/test1.service" <<EOF | |
29 | [Install] | |
30 | WantedBy=default.target | |
31 | RequiredBy=special.target | |
32 | EOF | |
33 | ||
34 | "$systemctl" --root="$root" enable test1.service | |
35 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" | |
36 | test -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
37 | ||
38 | "$systemctl" --root="$root" reenable test1.service | |
39 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" | |
40 | test -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
41 | ||
42 | "$systemctl" --root="$root" disable test1.service | |
3fc53351 ZJS |
43 | test ! -h "$root/etc/systemd/system/default.target.wants/test1.service" |
44 | test ! -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
45 | ||
25cbc42d | 46 | : '-------enable when link already exists-------------------------' |
3fc53351 ZJS |
47 | # We don't read the symlink target, so it's OK for the symlink to point |
48 | # to something else. We should just silently accept this. | |
49 | ||
50 | mkdir -p "$root/etc/systemd/system/default.target.wants" | |
51 | mkdir -p "$root/etc/systemd/system/special.target.requires" | |
52 | ln -s /usr/lib/systemd/system/test1.service "$root/etc/systemd/system/default.target.wants/test1.service" | |
53 | ln -s /usr/lib/systemd/system/test1.service "$root/etc/systemd/system/special.target.requires/test1.service" | |
54 | ||
55 | "$systemctl" --root="$root" enable test1.service | |
56 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" | |
57 | test -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
58 | ||
59 | "$systemctl" --root="$root" reenable test1.service | |
60 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" | |
61 | test -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
62 | ||
63 | "$systemctl" --root="$root" disable test1.service | |
64 | test ! -h "$root/etc/systemd/system/default.target.wants/test1.service" | |
65 | test ! -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
50c5f5a3 | 66 | |
25cbc42d | 67 | : '-------suffix guessing-----------------------------------------' |
50c5f5a3 ZJS |
68 | "$systemctl" --root="$root" enable test1 |
69 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" | |
70 | test -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
71 | ||
72 | "$systemctl" --root="$root" reenable test1 | |
73 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" | |
74 | test -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
75 | ||
76 | "$systemctl" --root="$root" disable test1 | |
77 | test ! -e "$root/etc/systemd/system/default.target.wants/test1.service" | |
78 | test ! -e "$root/etc/systemd/system/special.target.requires/test1.service" | |
79 | ||
25cbc42d | 80 | : '-------aliases-------------------------------------------------' |
50c5f5a3 ZJS |
81 | cat >>"$root/etc/systemd/system/test1.service" <<EOF |
82 | Alias=test1-goodalias.service | |
83 | Alias=test1@badalias.service | |
84 | Alias=test1-badalias.target | |
85 | Alias=test1-badalias.socket | |
0d11db59 ZJS |
86 | # we have a series of good, bad, and then good again |
87 | Alias=test1-goodalias2.service | |
50c5f5a3 ZJS |
88 | EOF |
89 | ||
d6c51c48 | 90 | ( ! "$systemctl" --root="$root" enable test1 ) |
0d11db59 ZJS |
91 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" |
92 | test -h "$root/etc/systemd/system/special.target.requires/test1.service" | |
9aa3d6b4 | 93 | test ! -e "$root/etc/systemd/system/test1-goodalias.service" |
0d11db59 | 94 | test -h "$root/etc/systemd/system/test1-goodalias.service" |
9aa3d6b4 ZJS |
95 | test ! -e "$root/etc/systemd/system/test1@badalias.service" |
96 | test ! -e "$root/etc/systemd/system/test1-badalias.target" | |
97 | test ! -e "$root/etc/systemd/system/test1-badalias.socket" | |
0d11db59 ZJS |
98 | test -h "$root/etc/systemd/system/test1-goodalias2.service" |
99 | ||
25cbc42d | 100 | : '-------aliases in reenable-------------------------------------' |
d6c51c48 | 101 | ( ! "$systemctl" --root="$root" reenable test1 ) |
9aa3d6b4 ZJS |
102 | test -h "$root/etc/systemd/system/default.target.wants/test1.service" |
103 | test ! -e "$root/etc/systemd/system/test1-goodalias.service" | |
104 | test -h "$root/etc/systemd/system/test1-goodalias.service" | |
50c5f5a3 | 105 | |
9aa3d6b4 ZJS |
106 | test ! -e "$root/etc/systemd/system/test1@badalias.service" |
107 | test ! -e "$root/etc/systemd/system/test1-badalias.target" | |
108 | test ! -e "$root/etc/systemd/system/test1-badalias.socket" | |
50c5f5a3 ZJS |
109 | |
110 | "$systemctl" --root="$root" disable test1 | |
9aa3d6b4 ZJS |
111 | test ! -e "$root/etc/systemd/system/default.target.wants/test1.service" |
112 | test ! -e "$root/etc/systemd/system/special.target.requires/test1.service" | |
113 | test ! -e "$root/etc/systemd/system/test1-goodalias.service" | |
50c5f5a3 | 114 | |
25cbc42d | 115 | : '-------aliases when link already exists------------------------' |
3fc53351 ZJS |
116 | cat >"$root/etc/systemd/system/test1a.service" <<EOF |
117 | [Install] | |
118 | Alias=test1a-alias.service | |
119 | EOF | |
120 | ||
121 | ln -s /usr/lib/systemd/system/test1a.service "$root/etc/systemd/system/test1a-alias.service" | |
122 | ||
123 | "$systemctl" --root="$root" enable test1a.service | |
124 | test -h "$root/etc/systemd/system/test1a-alias.service" | |
125 | ||
126 | "$systemctl" --root="$root" disable test1a.service | |
127 | test ! -h "$root/etc/systemd/system/test1a-alias.service" | |
128 | ||
25cbc42d | 129 | : '-------also units----------------------------------------------' |
50c5f5a3 ZJS |
130 | cat >"$root/etc/systemd/system/test2.socket" <<EOF |
131 | [Install] | |
132 | WantedBy=sockets.target | |
133 | Also=test2.service | |
134 | EOF | |
135 | ||
136 | cat >"$root/etc/systemd/system/test2.service" <<EOF | |
137 | [Install] | |
138 | WantedBy=default.target | |
139 | Also=test2.socket | |
140 | EOF | |
141 | ||
142 | "$systemctl" --root="$root" reenable test2.service | |
143 | test -h "$root/etc/systemd/system/default.target.wants/test2.service" | |
144 | test -h "$root/etc/systemd/system/sockets.target.wants/test2.socket" | |
145 | ||
146 | "$systemctl" --root="$root" reenable test2.socket | |
147 | test -h "$root/etc/systemd/system/default.target.wants/test2.service" | |
148 | test -h "$root/etc/systemd/system/sockets.target.wants/test2.socket" | |
149 | ||
150 | "$systemctl" --root="$root" disable test2.socket | |
151 | test ! -e "$root/etc/systemd/system/default.target.wants/test2.service" | |
152 | test ! -e "$root/etc/systemd/system/sockets.target.wants/test2.socket" | |
153 | ||
154 | ||
25cbc42d | 155 | : '-------link----------------------------------------------------' |
50c5f5a3 ZJS |
156 | # File doesn't exist yet |
157 | test ! -e "$root/link1.path" | |
d6c51c48 | 158 | ( ! "$systemctl" --root="$root" link '/link1.path' ) |
50c5f5a3 ZJS |
159 | test ! -e "$root/etc/systemd/system/link1.path" |
160 | ||
161 | cat >"$root/link1.path" <<EOF | |
162 | [Install] | |
163 | WantedBy=paths.target | |
164 | EOF | |
165 | ||
166 | "$systemctl" --root="$root" link '/link1.path' | |
167 | islink "$root/etc/systemd/system/link1.path" "/link1.path" | |
168 | ||
25cbc42d | 169 | : '-------link already linked same path---------------------------' |
50c5f5a3 ZJS |
170 | SYSTEMD_LOG_LEVEL=debug "$systemctl" --root="$root" link '/link1.path' # this passes |
171 | islink "$root/etc/systemd/system/link1.path" "/link1.path" | |
172 | ||
25cbc42d | 173 | : '-------link already linked different path----------------------' |
50c5f5a3 ZJS |
174 | mkdir "$root/subdir" |
175 | cp "$root/link1.path" "$root/subdir/" | |
d6c51c48 | 176 | ( ! "$systemctl" --root="$root" link '/subdir/link1.path' ) |
50c5f5a3 ZJS |
177 | islink "$root/etc/systemd/system/link1.path" "/link1.path" |
178 | ||
25cbc42d | 179 | : '-------link bad suffix-----------------------------------------' |
50c5f5a3 | 180 | cp "$root/link1.path" "$root/subdir/link1.suffix" |
d6c51c48 | 181 | ( ! "$systemctl" --root="$root" link '/subdir/link1.suffix' ) |
50c5f5a3 ZJS |
182 | test ! -e "$root/etc/systemd/system/link1.suffix" |
183 | ||
25cbc42d | 184 | : '-------unlink by unit name-------------------------------------' |
50c5f5a3 ZJS |
185 | "$systemctl" --root="$root" disable 'link1.path' |
186 | test ! -e "$root/etc/systemd/system/link1.path" | |
187 | ||
25cbc42d | 188 | : '-------unlink by path------------------------------------------' |
50c5f5a3 ZJS |
189 | "$systemctl" --root="$root" link '/link1.path' |
190 | test -h "$root/etc/systemd/system/link1.path" | |
191 | "$systemctl" --root="$root" disable '/link1.path' | |
192 | test ! -e "$root/etc/systemd/system/link1.path" | |
193 | ||
25cbc42d | 194 | : '-------unlink by wrong path------------------------------------' |
50c5f5a3 ZJS |
195 | "$systemctl" --root="$root" link '/link1.path' |
196 | test -h "$root/etc/systemd/system/link1.path" | |
197 | "$systemctl" --root="$root" disable '/subdir/link1.path' # we only care about the name | |
198 | test ! -e "$root/etc/systemd/system/link1.path" | |
199 | ||
200 | ||
25cbc42d | 201 | : '-------link and enable-----------------------------------------' |
50c5f5a3 ZJS |
202 | "$systemctl" --root="$root" enable '/link1.path' |
203 | islink "$root/etc/systemd/system/link1.path" "/link1.path" | |
9aa3d6b4 | 204 | islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path" |
50c5f5a3 | 205 | |
25cbc42d | 206 | : '-------enable already linked same path-------------------------' |
50c5f5a3 ZJS |
207 | "$systemctl" --root="$root" enable '/link1.path' |
208 | islink "$root/etc/systemd/system/link1.path" "/link1.path" | |
9aa3d6b4 | 209 | islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path" |
50c5f5a3 | 210 | |
25cbc42d | 211 | : '-------enable already linked different path--------------------' |
d6c51c48 | 212 | ( ! "$systemctl" --root="$root" enable '/subdir/link1.path' ) |
20d68b3a | 213 | islink "$root/etc/systemd/system/link1.path" "/link1.path" |
9aa3d6b4 | 214 | islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path" |
50c5f5a3 | 215 | |
25cbc42d | 216 | : '-------enable bad suffix---------------------------------------' |
50c5f5a3 | 217 | cp "$root/link1.path" "$root/subdir/link1.suffix" |
d6c51c48 | 218 | ( ! "$systemctl" --root="$root" enable '/subdir/link1.suffix' ) |
50c5f5a3 ZJS |
219 | test ! -e "$root/etc/systemd/system/link1.suffix" |
220 | test ! -e "$root/etc/systemd/system/paths.target.wants/link1.suffix" | |
221 | ||
25cbc42d | 222 | : '-------disable by unit name------------------------------------' |
50c5f5a3 ZJS |
223 | "$systemctl" --root="$root" disable 'link1.path' |
224 | test ! -e "$root/etc/systemd/system/link1.path" | |
225 | test ! -e "$root/etc/systemd/system/paths.target.wants/link1.path" | |
226 | ||
25cbc42d | 227 | : '-------disable by path-----------------------------------------' |
50c5f5a3 ZJS |
228 | "$systemctl" --root="$root" enable '/link1.path' |
229 | test -h "$root/etc/systemd/system/link1.path" | |
230 | test -h "$root/etc/systemd/system/paths.target.wants/link1.path" | |
231 | "$systemctl" --root="$root" disable '/link1.path' | |
232 | test ! -e "$root/etc/systemd/system/link1.path" | |
233 | test ! -e "$root/etc/systemd/system/paths.target.wants/link1.path" | |
234 | ||
235 | ||
25cbc42d | 236 | : '-------link and enable-----------------------------------------' |
50c5f5a3 ZJS |
237 | "$systemctl" --root="$root" link '/link1.path' |
238 | islink "$root/etc/systemd/system/link1.path" "/link1.path" | |
239 | test ! -h "$root/etc/systemd/system/paths.target.wants/link1.path" | |
240 | ||
241 | "$systemctl" --root="$root" enable 'link1.path' | |
242 | islink "$root/etc/systemd/system/link1.path" "/link1.path" | |
9aa3d6b4 | 243 | islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path" |
50c5f5a3 | 244 | |
29a7c59a ZJS |
245 | "$systemctl" --root="$root" reenable 'link1.path' |
246 | islink "$root/etc/systemd/system/link1.path" "/link1.path" | |
9aa3d6b4 | 247 | islink "$root/etc/systemd/system/paths.target.wants/link1.path" "/link1.path" |
50c5f5a3 | 248 | |
25cbc42d | 249 | : '-------link instance and enable--------------------------------' |
fe6e0cfa FS |
250 | cat >"$root/link-instance@.service" <<EOF |
251 | [Service] | |
252 | ExecStart=true | |
253 | [Install] | |
254 | WantedBy=services.target | |
255 | EOF | |
256 | ||
257 | "$systemctl" --root="$root" link '/link-instance@.service' | |
258 | islink "$root/etc/systemd/system/link-instance@.service" "/link-instance@.service" | |
259 | ||
260 | "$systemctl" --root="$root" enable 'link-instance@first.service' | |
261 | islink "$root/etc/systemd/system/link-instance@first.service" "/link-instance@.service" | |
262 | islink "$root/etc/systemd/system/services.target.wants/link-instance@first.service" "/link-instance@.service" | |
263 | ||
264 | SYSTEMD_LOG_LEVEL=debug "$systemctl" --root="$root" reenable 'link-instance@first.service' | |
265 | islink "$root/etc/systemd/system/link-instance@first.service" "/link-instance@.service" | |
266 | islink "$root/etc/systemd/system/services.target.wants/link-instance@first.service" "/link-instance@.service" | |
267 | ||
268 | "$systemctl" --root="$root" disable 'link-instance@first.service' | |
269 | test ! -h "$root/etc/systemd/system/link-instance@first.service" | |
270 | test ! -h "$root/etc/systemd/system/services.target.wants/link-instance@first.service" | |
271 | ||
25cbc42d | 272 | : '-------manual link---------------------------------------------' |
50c5f5a3 ZJS |
273 | cat >"$root/link3.suffix" <<EOF |
274 | [Install] | |
275 | WantedBy=services.target | |
276 | EOF | |
277 | ||
48eadb9d | 278 | # We wouldn't create such a link ourselves, but it should accept it when present. |
50c5f5a3 ZJS |
279 | ln -s "/link3.suffix" "$root/etc/systemd/system/link3.service" |
280 | ||
48eadb9d ZJS |
281 | SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" enable 'link3.service' |
282 | islink "$root/etc/systemd/system/link3.service" "/link3.suffix" | |
9aa3d6b4 | 283 | islink "$root/etc/systemd/system/services.target.wants/link3.service" "/link3.suffix" |
48eadb9d ZJS |
284 | |
285 | SYSTEMD_LOG_LEVEL=debug SYSTEMD_LOG_LOCATION=1 "$systemctl" --root="$root" disable 'link3.service' | |
286 | test ! -h "$root/etc/systemd/system/link3.service" | |
287 | test ! -h "$root/etc/systemd/system/services.target.wants/link3.service" | |
50c5f5a3 | 288 | |
25cbc42d | 289 | : '-------enable on masked----------------------------------------' |
50c5f5a3 | 290 | ln -s "/dev/null" "$root/etc/systemd/system/masked.service" |
d6c51c48 ZJS |
291 | ( ! "$systemctl" --root="$root" enable 'masked.service' ) |
292 | ( ! "$systemctl" --root="$root" enable '/etc/systemd/system/masked.service' ) | |
50c5f5a3 | 293 | |
25cbc42d | 294 | : '-------enable on masked alias----------------------------------' |
50c5f5a3 ZJS |
295 | test -h "$root/etc/systemd/system/masked.service" |
296 | ln -s "masked.service" "$root/etc/systemd/system/masked-alias.service" | |
d6c51c48 ZJS |
297 | ( ! "$systemctl" --root="$root" enable 'masked-alias.service' ) |
298 | ( ! "$systemctl" --root="$root" enable '/etc/systemd/system/masked-alias.service' ) | |
50c5f5a3 | 299 | |
25cbc42d | 300 | : '-------issue 22000: link in subdirectory-----------------------' |
50c5f5a3 ZJS |
301 | mkdir -p "$root/etc/systemd/system/myown.d" |
302 | cat >"$root/etc/systemd/system/link5-also.service" <<EOF | |
303 | [Install] | |
304 | WantedBy=services.target | |
305 | Also=link5.service | |
306 | EOF | |
307 | cat >"$root/etc/systemd/system/myown.d/link5.service" <<EOF | |
308 | [Install] | |
309 | WantedBy=services.target | |
310 | Also=link5-also.service | |
311 | EOF | |
312 | ||
d6c51c48 | 313 | ( ! "$systemctl" --root="$root" enable 'link5.service' ) |
50c5f5a3 ZJS |
314 | test ! -h "$root/etc/systemd/system/services.target.wants/link5.service" |
315 | test ! -h "$root/etc/systemd/system/services.target.wants/link5-also.service" | |
316 | ||
317 | "$systemctl" --root="$root" enable 'link5-also.service' | |
318 | test ! -h "$root/etc/systemd/system/services.target.wants/link5.service" | |
9aa3d6b4 | 319 | islink "$root/etc/systemd/system/services.target.wants/link5-also.service" "/etc/systemd/system/link5-also.service" |
50c5f5a3 | 320 | |
25cbc42d | 321 | : '-------template enablement-------------------------------------' |
50c5f5a3 ZJS |
322 | cat >"$root/etc/systemd/system/templ1@.service" <<EOF |
323 | [Install] | |
324 | WantedBy=services.target | |
325 | EOF | |
326 | ||
327 | # No instance here — this can't succeed. | |
d6c51c48 | 328 | ( ! "$systemctl" --root="$root" enable 'templ1@.service' ) |
50c5f5a3 ZJS |
329 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" |
330 | ||
331 | "$systemctl" --root="$root" enable 'templ1@one.service' | |
332 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
9aa3d6b4 | 333 | islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service" |
50c5f5a3 ZJS |
334 | |
335 | "$systemctl" --root="$root" enable 'templ1@two.service' | |
336 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
9aa3d6b4 ZJS |
337 | islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service" |
338 | islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service" | |
fe6e0cfa FS |
339 | |
340 | "$systemctl" --root="$root" reenable 'templ1@two.service' | |
341 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
342 | islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service" | |
343 | islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service" | |
50c5f5a3 ZJS |
344 | |
345 | "$systemctl" --root="$root" disable 'templ1@one.service' | |
346 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
347 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service" | |
9aa3d6b4 | 348 | islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service" |
50c5f5a3 ZJS |
349 | |
350 | "$systemctl" --root="$root" disable 'templ1@two.service' | |
351 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
352 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service" | |
353 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@two.service" | |
354 | ||
25cbc42d | 355 | : '-------template enablement w/ default instance-----------------' |
0c003e83 ZJS |
356 | cat >"$root/etc/systemd/system/templ1@.service" <<EOF |
357 | [Install] | |
358 | # check enablement with | |
359 | WantedBy=services.target services.target | |
360 | RequiredBy=other@templ1.target other@%p.target | |
50c5f5a3 ZJS |
361 | DefaultInstance=333 |
362 | EOF | |
50c5f5a3 ZJS |
363 | |
364 | "$systemctl" --root="$root" enable 'templ1@.service' | |
365 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
9aa3d6b4 ZJS |
366 | islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service" |
367 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service" | |
50c5f5a3 ZJS |
368 | |
369 | "$systemctl" --root="$root" enable 'templ1@one.service' | |
370 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
9aa3d6b4 ZJS |
371 | islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service" |
372 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service" | |
373 | islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service" | |
374 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "/etc/systemd/system/templ1@.service" | |
50c5f5a3 ZJS |
375 | |
376 | "$systemctl" --root="$root" enable 'templ1@two.service' | |
377 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
9aa3d6b4 ZJS |
378 | islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service" |
379 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service" | |
380 | islink "$root/etc/systemd/system/services.target.wants/templ1@one.service" "/etc/systemd/system/templ1@.service" | |
381 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" "/etc/systemd/system/templ1@.service" | |
382 | islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service" | |
383 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "/etc/systemd/system/templ1@.service" | |
50c5f5a3 ZJS |
384 | |
385 | "$systemctl" --root="$root" disable 'templ1@one.service' | |
386 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
9aa3d6b4 ZJS |
387 | islink "$root/etc/systemd/system/services.target.wants/templ1@333.service" "/etc/systemd/system/templ1@.service" |
388 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" "/etc/systemd/system/templ1@.service" | |
50c5f5a3 | 389 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service" |
0c003e83 | 390 | test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" |
9aa3d6b4 ZJS |
391 | islink "$root/etc/systemd/system/services.target.wants/templ1@two.service" "/etc/systemd/system/templ1@.service" |
392 | islink "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" "/etc/systemd/system/templ1@.service" | |
50c5f5a3 | 393 | |
0c003e83 | 394 | # disable remaining links here |
50c5f5a3 ZJS |
395 | "$systemctl" --root="$root" disable 'templ1@.service' |
396 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" | |
397 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@333.service" | |
0c003e83 | 398 | test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@333.service" |
50c5f5a3 | 399 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service" |
0c003e83 | 400 | test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@one.service" |
50c5f5a3 | 401 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@two.service" |
0c003e83 | 402 | test ! -h "$root/etc/systemd/system/other@templ1.target.requires/templ1@two.service" |
50c5f5a3 | 403 | |
25cbc42d | 404 | : '-------removal of relative enablement symlinks-----------------' |
9f61c9f7 ZJS |
405 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@.service" |
406 | ln -s '../templ1@one.service' "$root/etc/systemd/system/services.target.wants/templ1@one.service" | |
407 | ln -s 'templ1@two.service' "$root/etc/systemd/system/services.target.wants/templ1@two.service" | |
408 | ln -s '../templ1@.service' "$root/etc/systemd/system/services.target.wants/templ1@three.service" | |
409 | ln -s 'templ1@.service' "$root/etc/systemd/system/services.target.wants/templ1@four.service" | |
410 | ln -s '/usr/lib/systemd/system/templ1@.service' "$root/etc/systemd/system/services.target.wants/templ1@five.service" | |
411 | ln -s '/etc/systemd/system/templ1@.service' "$root/etc/systemd/system/services.target.wants/templ1@six.service" | |
412 | ln -s '/run/system/templ1@.service' "$root/etc/systemd/system/services.target.wants/templ1@seven.service" | |
413 | ||
414 | # this should remove all links | |
415 | "$systemctl" --root="$root" disable 'templ1@.service' | |
416 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@one.service" | |
417 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@two.service" | |
418 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@three.service" | |
419 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@four.service" | |
420 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@five.service" | |
421 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@six.service" | |
422 | test ! -h "$root/etc/systemd/system/services.target.wants/templ1@seven.service" | |
423 | ||
25cbc42d | 424 | : '-------template enablement for another template----------------' |
17a2679e ZJS |
425 | cat >"$root/etc/systemd/system/templ2@.service" <<EOF |
426 | [Install] | |
427 | RequiredBy=another-template@.target | |
428 | EOF | |
429 | ||
430 | "$systemctl" --root="$root" enable 'templ2@.service' | |
9aa3d6b4 | 431 | islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" |
17a2679e ZJS |
432 | |
433 | "$systemctl" --root="$root" enable 'templ2@two.service' | |
9aa3d6b4 ZJS |
434 | islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" |
435 | islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "/etc/systemd/system/templ2@.service" | |
17a2679e ZJS |
436 | |
437 | "$systemctl" --root="$root" disable 'templ2@other.service' | |
9aa3d6b4 ZJS |
438 | islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" |
439 | islink "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" "/etc/systemd/system/templ2@.service" | |
17a2679e ZJS |
440 | |
441 | "$systemctl" --root="$root" disable 'templ2@two.service' | |
9aa3d6b4 | 442 | islink "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" "/etc/systemd/system/templ2@.service" |
17a2679e ZJS |
443 | test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" |
444 | ||
445 | "$systemctl" --root="$root" disable 'templ2@.service' | |
446 | test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@.service" | |
447 | test ! -h "$root/etc/systemd/system/another-template@.target.requires/templ2@two.service" | |
448 | ||
25cbc42d | 449 | : '-------aliases w/ and w/o instance-----------------------------' |
50c5f5a3 ZJS |
450 | test ! -e "$root/etc/systemd/system/link4.service" |
451 | cat >"$root/etc/systemd/system/link4.service" <<EOF | |
452 | [Install] | |
f663e646 | 453 | Alias=link4.service |
50c5f5a3 ZJS |
454 | Alias=link4@.service |
455 | Alias=link4@inst.service | |
456 | Alias=link4alias.service | |
457 | Alias=link4alias2.service | |
458 | EOF | |
459 | ||
d6c51c48 | 460 | ( ! "$systemctl" --root="$root" enable 'link4.service' ) |
50c5f5a3 ZJS |
461 | test ! -h "$root/etc/systemd/system/link4.service" # this is our file |
462 | test ! -h "$root/etc/systemd/system/link4@.service" | |
463 | test ! -h "$root/etc/systemd/system/link4@inst.service" | |
9aa3d6b4 ZJS |
464 | islink "$root/etc/systemd/system/link4alias.service" "/etc/systemd/system/link4.service" |
465 | islink "$root/etc/systemd/system/link4alias2.service" "/etc/systemd/system/link4.service" | |
50c5f5a3 ZJS |
466 | |
467 | "$systemctl" --root="$root" disable 'link4.service' | |
468 | test ! -h "$root/etc/systemd/system/link4.service" | |
469 | test ! -h "$root/etc/systemd/system/link4@.service" | |
470 | test ! -h "$root/etc/systemd/system/link4@inst.service" | |
471 | test ! -h "$root/etc/systemd/system/link4alias.service" | |
472 | test ! -h "$root/etc/systemd/system/link4alias2.service" | |
473 | ||
25cbc42d | 474 | : '-------systemctl enable on path to unit file-------------------' |
0d11db59 ZJS |
475 | cat >"$root/etc/systemd/system/link4.service" <<EOF |
476 | [Install] | |
477 | Alias=link4alias.service | |
478 | Alias=link4alias2.service | |
479 | EOF | |
480 | ||
50c5f5a3 ZJS |
481 | # Apparently this works. I'm not sure what to think. |
482 | "$systemctl" --root="$root" enable '/etc/systemd/system/link4.service' | |
483 | test ! -h "$root/etc/systemd/system/link4.service" # this is our file | |
9aa3d6b4 ZJS |
484 | islink "$root/etc/systemd/system/link4alias.service" "/etc/systemd/system/link4.service" |
485 | islink "$root/etc/systemd/system/link4alias2.service" "/etc/systemd/system/link4.service" | |
50c5f5a3 ZJS |
486 | |
487 | "$systemctl" --root="$root" disable '/etc/systemd/system/link4.service' | |
488 | test ! -h "$root/etc/systemd/system/link4.service" | |
50c5f5a3 ZJS |
489 | test ! -h "$root/etc/systemd/system/link4alias.service" |
490 | test ! -h "$root/etc/systemd/system/link4alias2.service" | |
491 | ||
25cbc42d | 492 | : '-------issue 661: enable on unit file--------------------------' |
50c5f5a3 ZJS |
493 | test ! -e "$root/etc/systemd/system/link5.service" |
494 | cat >"$root/etc/systemd/system/link5.service" <<EOF | |
495 | [Install] | |
f663e646 | 496 | Alias=link5.service |
50c5f5a3 ZJS |
497 | Alias=link5alias.service |
498 | Alias=link5alias2.service | |
499 | EOF | |
500 | ||
501 | "$systemctl" --root="$root" enable 'link5.service' | |
502 | test ! -h "$root/etc/systemd/system/link5.service" # this is our file | |
9aa3d6b4 ZJS |
503 | islink "$root/etc/systemd/system/link5alias.service" "/etc/systemd/system/link5.service" |
504 | islink "$root/etc/systemd/system/link5alias2.service" "/etc/systemd/system/link5.service" | |
50c5f5a3 ZJS |
505 | |
506 | "$systemctl" --root="$root" disable 'link5.service' | |
50c5f5a3 ZJS |
507 | test ! -h "$root/etc/systemd/system/link5alias.service" |
508 | test ! -h "$root/etc/systemd/system/link5alias2.service" | |
509 | ||
25cbc42d | 510 | : '-------issue 661: link and enable on unit file-----------------' |
85516075 ZJS |
511 | test ! -e "$root/etc/systemd/system/link5copy.service" |
512 | cat >"$root/link5copy.service" <<EOF | |
513 | [Install] | |
514 | Alias=link5copy.service | |
515 | Alias=link5alias.service | |
516 | Alias=link5alias2.service | |
517 | EOF | |
518 | ||
519 | test ! -e "$root/etc/systemd/system/link5copy.service" | |
520 | ||
521 | "$systemctl" --root="$root" link '/link5copy.service' | |
522 | islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service' | |
523 | test ! -h "$root/etc/systemd/system/link5alias.service" | |
524 | test ! -h "$root/etc/systemd/system/link5alias2.service" | |
525 | ||
9aa3d6b4 ZJS |
526 | # FIXME: we must create link5alias2 and link5alias as relative links to link5.service |
527 | # When they are independent links to /link5.service, systemd doesn't know that | |
528 | # they are aliases, because we do not follow symlinks outside of the search paths. | |
529 | ||
85516075 ZJS |
530 | "$systemctl" --root="$root" disable 'link5copy.service' |
531 | test ! -h "$root/etc/systemd/system/link5copy.service" | |
532 | test ! -h "$root/etc/systemd/system/link5alias.service" | |
533 | test ! -h "$root/etc/systemd/system/link5alias2.service" | |
534 | ||
535 | "$systemctl" --root="$root" enable '/link5copy.service' | |
536 | islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service' | |
6fec0fed NR |
537 | islink "$root/etc/systemd/system/link5alias.service" '/etc/systemd/system/link5copy.service' |
538 | islink "$root/etc/systemd/system/link5alias2.service" '/etc/systemd/system/link5copy.service' | |
85516075 ZJS |
539 | |
540 | "$systemctl" --root="$root" disable 'link5copy.service' | |
541 | test ! -h "$root/etc/systemd/system/link5copy.service" | |
542 | test ! -h "$root/etc/systemd/system/link5alias.service" | |
543 | test ! -h "$root/etc/systemd/system/link5alias2.service" | |
544 | ||
25cbc42d | 545 | : '-------issue 19437: plain templates in .wants/ or .requires/---' |
50c5f5a3 ZJS |
546 | test ! -e "$root/etc/systemd/system/link5@.path" |
547 | cat >"$root/etc/systemd/system/link5@.path" <<EOF | |
548 | [Install] | |
549 | WantedBy=target5@.target | |
550 | RequiredBy=target5@.target | |
551 | WantedBy=target5@inst.target | |
552 | RequiredBy=target5@inst.target | |
553 | EOF | |
554 | ||
555 | "$systemctl" --root="$root" enable 'link5@.path' | |
556 | test ! -h "$root/etc/systemd/system/link5@.path" # this is our file | |
9aa3d6b4 ZJS |
557 | islink "$root/etc/systemd/system/target5@.target.wants/link5@.path" "/etc/systemd/system/link5@.path" |
558 | islink "$root/etc/systemd/system/target5@.target.requires/link5@.path" "/etc/systemd/system/link5@.path" | |
559 | islink "$root/etc/systemd/system/target5@inst.target.wants/link5@.path" "/etc/systemd/system/link5@.path" | |
560 | islink "$root/etc/systemd/system/target5@inst.target.requires/link5@.path" "/etc/systemd/system/link5@.path" | |
50c5f5a3 ZJS |
561 | |
562 | "$systemctl" --root="$root" disable 'link5@.path' | |
563 | test ! -h "$root/etc/systemd/system/link5@.path" # this is our file | |
564 | test ! -h "$root/etc/systemd/system/target5@.target.wants/link5@.path" | |
565 | test ! -h "$root/etc/systemd/system/target5@.target.requires/link5@.path" | |
566 | test ! -h "$root/etc/systemd/system/target5@inst.target.wants/link5@.path" | |
567 | test ! -h "$root/etc/systemd/system/target5@inst.target.requires/link5@.path" | |
568 | ||
25cbc42d | 569 | : '-------removal of symlinks not listed in [Install]-------------' |
50c5f5a3 ZJS |
570 | # c.f. 66a19d85a533b15ed32f4066ec880b5a8c06babd |
571 | test ! -e "$root/etc/systemd/system/multilink.mount" | |
572 | cat >"$root/etc/systemd/system/multilink.mount" <<EOF | |
573 | [Install] | |
574 | WantedBy=multilink.target | |
575 | EOF | |
576 | ||
577 | mkdir -p "$root/etc/systemd/system/default.target.wants" | |
578 | ln -s ../multilink.mount "$root/etc/systemd/system/default.target.wants/" | |
579 | ln -s ../multilink.mount "$root/etc/systemd/system/multilink-alias.mount" | |
580 | ln -s ../multilink.mount "$root/etc/systemd/system/multilink-badalias.service" | |
581 | ||
582 | "$systemctl" --root="$root" disable 'multilink.mount' | |
583 | test -e "$root/etc/systemd/system/multilink.mount" # this is our file | |
584 | test ! -h "$root/etc/systemd/system/default.target.wants/" | |
585 | test ! -h "$root/etc/systemd/system/multilink-alias.mount" | |
586 | test ! -h "$root/etc/systemd/system/multilink-badalias.service" | |
587 | ||
25cbc42d | 588 | : '-------merge 20017: specifiers in the unit file----------------' |
50c5f5a3 ZJS |
589 | test ! -e "$root/etc/systemd/system/some-some-link6@.socket" |
590 | # c.f. de61a04b188f81a85cdb5c64ddb4987dcd9d30d3 | |
591 | ||
592 | check_alias() { | |
84fdced6 | 593 | : "------------------ %$1 -------------------------------------" |
50c5f5a3 ZJS |
594 | cat >"$root/etc/systemd/system/some-some-link6@.socket" <<EOF |
595 | [Install] | |
596 | Alias=target@$1:%$1.socket | |
597 | EOF | |
598 | SYSTEMD_LOG_LEVEL=debug "$systemctl" --root="$root" enable 'some-some-link6@.socket' || return 1 | |
9aa3d6b4 | 599 | islink "$root/etc/systemd/system/target@$1:$2.socket" "/etc/systemd/system/some-some-link6@.socket" || return 2 |
50c5f5a3 ZJS |
600 | } |
601 | ||
5c29de29 ZJS |
602 | # TODO: our architecture names are different than what uname -m returns. |
603 | # Add something like 'systemd-detect-virt --print-architecture' and use it here. | |
604 | check_alias a "$(uname -m | tr '_' '-')" || : | |
50c5f5a3 | 605 | |
6ec4c852 ZJS |
606 | test ! -e "$root/etc/os-release" |
607 | test ! -e "$root/usr/lib/os-release" | |
608 | ||
d6c51c48 ZJS |
609 | ( ! check_alias A '' ) |
610 | ( ! check_alias B '' ) | |
611 | ( ! check_alias M '' ) | |
612 | ( ! check_alias o '' ) | |
613 | ( ! check_alias w '' ) | |
614 | ( ! check_alias W '' ) | |
6ec4c852 ZJS |
615 | |
616 | cat >"$root/etc/os-release" <<EOF | |
617 | # empty | |
618 | EOF | |
50c5f5a3 | 619 | |
6ec4c852 ZJS |
620 | check_alias A '' |
621 | check_alias B '' | |
622 | check_alias M '' | |
623 | check_alias o '' | |
624 | check_alias w '' | |
625 | check_alias W '' | |
626 | ||
627 | cat >"$root/etc/os-release" <<EOF | |
628 | ID='the-id' | |
629 | VERSION_ID=39a | |
630 | BUILD_ID=build-id | |
631 | VARIANT_ID=wrong | |
632 | VARIANT_ID=right | |
633 | IMAGE_ID="foobar" | |
634 | IMAGE_VERSION='1-2-3' | |
635 | EOF | |
50c5f5a3 | 636 | |
6ec4c852 ZJS |
637 | check_alias A '1-2-3' |
638 | check_alias B 'build-id' | |
639 | check_alias M 'foobar' | |
640 | check_alias o 'the-id' | |
641 | check_alias w '39a' | |
642 | check_alias W 'right' | |
643 | ||
2a2d002f | 644 | check_alias b "$("$systemd_id128" boot-id)" |
50c5f5a3 | 645 | |
19b9d5d0 | 646 | # Specifiers not available for [Install] |
d6c51c48 ZJS |
647 | ( ! check_alias C '' ) |
648 | ( ! check_alias E '' ) | |
649 | ( ! check_alias f '' ) | |
650 | ( ! check_alias h '' ) | |
651 | ( ! check_alias I '' ) | |
652 | ( ! check_alias J '' ) | |
653 | ( ! check_alias L '' ) | |
654 | ( ! check_alias P '' ) | |
655 | ( ! check_alias s '' ) | |
656 | ( ! check_alias S '' ) | |
657 | ( ! check_alias t '' ) | |
658 | ( ! check_alias T '' ) | |
659 | ( ! check_alias V '' ) | |
50c5f5a3 | 660 | |
172e9cc3 ZJS |
661 | check_alias g root |
662 | check_alias G 0 | |
663 | check_alias u root | |
664 | check_alias U 0 | |
50c5f5a3 | 665 | |
50c5f5a3 ZJS |
666 | check_alias i "" |
667 | ||
50c5f5a3 ZJS |
668 | check_alias j 'link6' |
669 | ||
50c5f5a3 ZJS |
670 | check_alias l "$(uname -n | sed 's/\..*//')" |
671 | ||
6ec4c852 | 672 | test ! -e "$root/etc/machine-id" |
d6c51c48 | 673 | ( ! check_alias m '' ) |
50c5f5a3 | 674 | |
2a2d002f | 675 | "$systemd_id128" new >"$root/etc/machine-id" |
6ec4c852 | 676 | check_alias m "$(cat "$root/etc/machine-id")" |
50c5f5a3 ZJS |
677 | |
678 | check_alias n 'some-some-link6@.socket' | |
679 | check_alias N 'some-some-link6@' | |
680 | ||
50c5f5a3 ZJS |
681 | check_alias p 'some-some-link6' |
682 | ||
c3a053c2 ZJS |
683 | uname -r | grep -q '[^a-zA-Z0-9_.\\-]' || \ |
684 | check_alias v "$(uname -r)" | |
50c5f5a3 | 685 | |
d6c51c48 ZJS |
686 | # % is not legal in unit name |
687 | ( ! check_alias % '%' ) | |
50c5f5a3 | 688 | |
d6c51c48 ZJS |
689 | # %z is not defined |
690 | ( ! check_alias z 'z' ) | |
50c5f5a3 | 691 | |
25cbc42d | 692 | : '-------specifiers in WantedBy----------------------------------' |
17a2679e ZJS |
693 | # We don't need to repeat all the tests. Let's do a basic check that specifier |
694 | # expansion is performed. | |
695 | ||
696 | cat >"$root/etc/systemd/system/some-some-link7.socket" <<EOF | |
697 | [Install] | |
698 | WantedBy=target@%p.target | |
699 | WantedBy=another-target@.target | |
700 | RequiredBy=target2@%p.target | |
701 | RequiredBy=another-target2@.target | |
702 | EOF | |
703 | ||
704 | "$systemctl" --root="$root" enable 'some-some-link7.socket' | |
9aa3d6b4 ZJS |
705 | islink "$root/etc/systemd/system/target@some-some-link7.target.wants/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" |
706 | islink "$root/etc/systemd/system/another-target@.target.wants/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" | |
707 | islink "$root/etc/systemd/system/target2@some-some-link7.target.requires/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" | |
708 | islink "$root/etc/systemd/system/another-target2@.target.requires/some-some-link7.socket" "/etc/systemd/system/some-some-link7.socket" | |
17a2679e ZJS |
709 | |
710 | "$systemctl" --root="$root" disable 'some-some-link7.socket' | |
711 | test ! -h "$root/etc/systemd/system/target@some-some-link7.target.wants/some-some-link7.socket" | |
712 | test ! -h "$root/etc/systemd/system/another-target@.target.wants/some-some-link7.socket" | |
713 | test ! -h "$root/etc/systemd/system/target2@some-some-link7.target.requires/some-some-link7.socket" | |
714 | test ! -h "$root/etc/systemd/system/another-target2@.target.requires/some-some-link7.socket" | |
715 | ||
50c5f5a3 | 716 | # TODO: repeat the tests above for presets |
df78419d | 717 | |
25cbc42d | 718 | : '-------SYSTEMD_OS_RELEASE relative to root---------------------' |
df78419d ZJS |
719 | # check that os-release overwriting works as expected with root |
720 | test -e "$root/etc/os-release" | |
721 | ||
722 | cat >"$root/etc/os-release2" <<EOF | |
723 | ID='the-id2' | |
724 | EOF | |
725 | ||
5cf69e70 | 726 | SYSTEMD_OS_RELEASE="/etc/os-release2" check_alias o 'the-id2' |