From 479a9f2e679c1d696c081f7bc231b1a4283eb860 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Thu, 29 Mar 2018 14:12:51 +0200 Subject: [PATCH] scripts/update-systemd-from-27-to-238: Do nothing if systemd 238 is running As a safety measure, check if systemd 238 already runs, and abort if it is. ``` @ryan:~> systemd --version systemd: unrecognized option '--version' Unknown option code ? ``` ``` $ systemd --version systemd 238 +PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid ``` ``` $ scripts/update-systemd-from-27-to-238.sh + hostconfig mx64 + systemd --version + echo 'systemd 238 is already running. Nothing to do.' systemd 238 is already running. Nothing to do. + exit 0 ``` From the manual page bash(1): > { list; } > list is simply executed in the current shell environment. list > must be terminated with a newline or semicolon. This is known > as a group command. The return status is the exit status of > list. Note that unlike the metacharacters ( and ), { and } are > reserved words and must occur where a reserved word is permitted > to be recognized. Since they do not cause a word break, they > must be separated from list by whitespace or another shell > metacharacter. --- scripts/update-systemd-from-27-to-238.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/update-systemd-from-27-to-238.sh b/scripts/update-systemd-from-27-to-238.sh index e2165df39..5e6c16ee9 100755 --- a/scripts/update-systemd-from-27-to-238.sh +++ b/scripts/update-systemd-from-27-to-238.sh @@ -9,6 +9,11 @@ if ! { hostconfig mx64; }; then exit 1 fi +if { systemd --version 2>&1 1>/dev/null; }; then + echo "systemd 238 is already running. Nothing to do." + exit 0 +fi + bee remove sysvinit-2.88dsf-2.x86_64 udev-164-2.x86_64 bee install -f systemd-238-0 bee update -f dbus-1.12.4-0