|
39 | 39 | # systemd, upstart, sysvinit, openrc, ??? |
40 | 40 | # Devuan: |
41 | 41 | # sysvinit, sysvinit+openrc |
| 42 | +# DSM: |
| 43 | +# busybox-init+syno, upstart-syno, systemd |
42 | 44 | # Gentoo: |
43 | 45 | # sysvinit+openrc, openrc-init, systemd |
44 | 46 | # Haiku: |
@@ -155,11 +157,15 @@ check_busybox_init() ( |
155 | 157 | test -x "${busybox_path}" || return 1 |
156 | 158 | grep -q 'BusyBox v[0-9]' "${busybox_path}" || return 1 |
157 | 159 |
|
158 | | - # It is quite common to use Busybox init to stack other init systemd |
| 160 | + # It is quite common to use BusyBox’s init to stack other service managers |
159 | 161 | # (like OpenRC) on top of it. So we check for that, too. |
160 | 162 | if stacked=$(check_openrc) |
161 | 163 | then |
162 | 164 | echo "busybox-init+${stacked}" |
| 165 | + elif stacked=$(check_synoinit) |
| 166 | + then |
| 167 | + # Synology DSM < 5.0 uses BusyBox + synoservice(8) |
| 168 | + echo "busybox-init+${stacked}" |
163 | 169 | else |
164 | 170 | echo busybox-init |
165 | 171 | fi |
@@ -229,6 +235,13 @@ check_smf() { |
229 | 235 | echo smf |
230 | 236 | } |
231 | 237 |
|
| 238 | +check_synoinit() { |
| 239 | + # synoservice(8) |
| 240 | + test -x /usr/syno/sbin/synoservice || return 1 |
| 241 | + |
| 242 | + echo syno |
| 243 | +} |
| 244 | + |
232 | 245 | check_systemd() { |
233 | 246 | # NOTE: sd_booted(3) |
234 | 247 | test -d /run/systemd/system/ || return 1 |
@@ -263,7 +276,12 @@ check_upstart() { |
263 | 276 | case $(initctl version) |
264 | 277 | in |
265 | 278 | (*'(upstart '*')') |
266 | | - if test -d /etc/init |
| 279 | + if test -x /usr/syno/sbin/synoservice \ |
| 280 | + && test -x /usr/syno/sbin/synoservicectl |
| 281 | + then |
| 282 | + # upstart-based Synology init system |
| 283 | + echo upstart-syno |
| 284 | + elif test -d /etc/init |
267 | 285 | then |
268 | 286 | # modern (DBus-based?) upstart >= 0.5 |
269 | 287 | echo upstart |
@@ -300,11 +318,11 @@ find_init_procfs() ( |
300 | 318 | # /sbin/init (deleted) |
301 | 319 | # [root@fedora-12 ~]# ls -l /proc/1/exe |
302 | 320 | # lrwxrwxrwx. 1 root root 0 2020-01-30 23:00 /proc/1/exe -> /sbin/init (deleted) |
303 | | - |
304 | 321 | init_exe=${init_exe% (deleted)} |
305 | | - test -x "${init_exe}" || return 1 |
306 | 322 | fi |
307 | 323 |
|
| 324 | + test -x "${init_exe}" || return 1 |
| 325 | + |
308 | 326 | echo "${init_exe}" |
309 | 327 | ) |
310 | 328 |
|
@@ -400,10 +418,11 @@ check_list() ( |
400 | 418 | ) |
401 | 419 |
|
402 | 420 |
|
403 | | -# BusyBox's versions of ps and pgrep do not support some options |
| 421 | +# BusyBox’s versions of ps and pgrep do not support some options |
404 | 422 | # depending on which compile-time options have been used. |
405 | 423 |
|
406 | 424 | find_init_pgrep() { |
| 425 | + command -v pgrep >/dev/null 2>&1 || return 1 |
407 | 426 | pgrep -P0 -fl 2>/dev/null | awk -F '[[:blank:]]' '$1 == 1 { print $2 }' |
408 | 427 | } |
409 | 428 |
|
|
0 commit comments