change __start_on_boot to use systemd on archlinux

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-06-09 23:45:22 +02:00
parent d5817a54c8
commit 2acce10497
3 changed files with 11 additions and 20 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2012 Nico Schottelius (nico-cdist at schottelius.org) # 2012-2013 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -29,19 +29,13 @@ name="$__object_id"
case "$os" in case "$os" in
archlinux) archlinux)
# convert bash array to shell # convert bash array to shell
daemons=$(grep ^DAEMONS /etc/rc.conf | sed -e 's/^.*=(//' -e 's/)$//') systemctl is-enabled "$name" >/dev/null 2>&1; ret=$?
# absent, as long as not found if [ "$ret" = 0 ]; then
state="absent" state="present"
else
# iterate, last one wins. state="absent"
for daemon in $daemons; do fi
if [ "$daemon" = "$name" -o "$daemon" = "@${name}" ]; then
state="present"
elif [ "$daemon" = "!${name}" ]; then
state="absent"
fi
done
;; ;;
debian|ubuntu|openwrt) debian|ubuntu|openwrt)

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2012 Nico Schottelius (nico-cdist at schottelius.org) # 2012-2013 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -32,8 +32,7 @@ case "$state_should" in
present) present)
case "$os" in case "$os" in
archlinux) archlinux)
echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf > /etc/rc.conf.cdist-tmp" echo "systemctl enable \"$name\""
echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf"
;; ;;
debian|ubuntu) debian|ubuntu)
echo "update-rc.d \"$name\" defaults >/dev/null" echo "update-rc.d \"$name\" defaults >/dev/null"
@ -65,10 +64,7 @@ case "$state_should" in
absent) absent)
case "$os" in case "$os" in
archlinux) archlinux)
# Replace a) at the beginning b) in the middle c) end d) only echo "systemctl disable \"$name\""
# Support @name as well...makes it more ugly, but well...
echo "sed /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/' > /etc/rc.conf.cdist-tmp"
echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf"
;; ;;
debian|ubuntu) debian|ubuntu)
echo update-rc.d -f \"$name\" remove echo update-rc.d -f \"$name\" remove

View file

@ -9,6 +9,7 @@ next:
* Build: Change clean-dist target to "distclean" * Build: Change clean-dist target to "distclean"
* Change execution order to run object as one unit * Change execution order to run object as one unit
* Type __apt_ppa: Fix comparison operator (Tyler Akins) * Type __apt_ppa: Fix comparison operator (Tyler Akins)
* Type __start_on_boot: Archlinux changed to use systemd - adapt
2.1.1: 2013-04-08 2.1.1: 2013-04-08
* Core: Use dynamic dependency resolver to allow indirect self dependencies * Core: Use dynamic dependency resolver to allow indirect self dependencies