Use dib helper script to determine init system
diskimage-builder provides a helper script + env variable to determine, which init system is used. We should use them in elements instead of manual checks after update of raring cloud images broke "if [ -d /etc/systemd/system ]" test. Related-Bug: #1251610 Change-Id: I6d27491302ff0c4c6de82d6d60fc80e83fec519e
This commit is contained in:
parent
c89380c16f
commit
ac0d6607ec
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
if [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
|
||||
systemctl enable httpd.service
|
||||
fi
|
||||
|
|
|
@ -64,8 +64,8 @@ eof
|
|||
|
||||
}
|
||||
|
||||
if [ -d /etc/init ]; then
|
||||
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
||||
install_dnsmasq_upstart
|
||||
elif [ -d /lib/systemd/system ]; then
|
||||
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
|
||||
install_dnsmasq_systemd
|
||||
fi
|
||||
|
|
|
@ -11,8 +11,7 @@ cat > /etc/os-collect-config.conf <<eof
|
|||
command=os-refresh-config
|
||||
eof
|
||||
|
||||
# Upstart
|
||||
if [ -d /etc/init ] ; then
|
||||
if [ "$DIB_INIT_SYSTEM" == "upstart" ] ; then
|
||||
cat > /etc/init/os-collect-config.conf <<eof
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
@ -20,8 +19,7 @@ respawn
|
|||
exec os-collect-config
|
||||
eof
|
||||
|
||||
# Systemd
|
||||
elif [ -d /lib/systemd/system ] ; then
|
||||
elif [ "$DIB_INIT_SYSTEM" == "systemd" ] ; then
|
||||
cat > /lib/systemd/system/os-collect-config.service <<eof
|
||||
[Unit]
|
||||
Description=Collect metadata and run hook commands.
|
||||
|
|
|
@ -151,9 +151,10 @@ EOF
|
|||
}
|
||||
|
||||
# TODO: SysV init fallback support
|
||||
if [ -d /etc/init ]; then
|
||||
DIB_INIT_SYSTEM=$(dib-init-system)
|
||||
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
||||
install_upstart $SERVICENAME $RUNAS $RUNCMD $*
|
||||
elif [ -d /etc/systemd/system ]; then
|
||||
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
|
||||
if [ "$POSTSTART" != "$DEFAULT_POSTSTART" ] ; then
|
||||
echo "WARNING: post start is ignored with systemd." >&2
|
||||
fi
|
||||
|
|
|
@ -27,8 +27,8 @@ eof
|
|||
}
|
||||
|
||||
|
||||
if [ -d /etc/init ]; then
|
||||
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
||||
install_qpidd_upstart
|
||||
elif [ -d /lib/systemd/system ]; then
|
||||
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
|
||||
install_qpidd_systemd
|
||||
fi
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
# Upstart
|
||||
if [ -d /etc/init ] ; then
|
||||
if [ "$DIB_INIT_SYSTEM" == "upstart" ] ; then
|
||||
cat > /etc/init/tripleo-cd.conf <<eof
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
|
@ -10,8 +9,7 @@ respawn
|
|||
exec tripleo-cd.sh
|
||||
eof
|
||||
|
||||
# Systemd
|
||||
elif [ -d /lib/systemd/system ] ; then
|
||||
elif [ "$DIB_INIT_SYSTEM" == "systemd" ] ; then
|
||||
cat > /lib/systemd/system/os-collect-config.service <<eof
|
||||
[Unit]
|
||||
Description=Deploy an overcloud forever.
|
||||
|
|
Loading…
Reference in New Issue