change __start_on_boot to use systemd on archlinux
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								d5817a54c8
							
						
					
				
			
			
				commit
				
					
						2acce10497
					
				
			
		
					 3 changed files with 11 additions and 20 deletions
				
			
		|  | @ -1,6 +1,6 @@ | |||
| #!/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. | ||||
| # | ||||
|  | @ -29,19 +29,13 @@ name="$__object_id" | |||
| case "$os" in | ||||
|     archlinux) | ||||
|         # 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 | ||||
|         state="absent" | ||||
| 
 | ||||
|         # iterate, last one wins. | ||||
|         for daemon in $daemons; do | ||||
|             if [ "$daemon" = "$name" -o "$daemon" = "@${name}" ]; then | ||||
|                 state="present" | ||||
|             elif [ "$daemon" = "!${name}" ]; then | ||||
|                 state="absent" | ||||
|             fi | ||||
|         done | ||||
|         if [ "$ret" = 0 ]; then | ||||
|             state="present" | ||||
|         else | ||||
|             state="absent" | ||||
|         fi | ||||
|     ;; | ||||
| 
 | ||||
|     debian|ubuntu|openwrt) | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| #!/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. | ||||
| # | ||||
|  | @ -32,8 +32,7 @@ case "$state_should" in | |||
|     present) | ||||
|         case "$os" in | ||||
|             archlinux) | ||||
|                 echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf > /etc/rc.conf.cdist-tmp" | ||||
|                 echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf" | ||||
|                 echo "systemctl enable \"$name\"" | ||||
|             ;; | ||||
|             debian|ubuntu) | ||||
|                 echo "update-rc.d \"$name\" defaults >/dev/null" | ||||
|  | @ -65,10 +64,7 @@ case "$state_should" in | |||
|     absent) | ||||
|         case "$os" in | ||||
|             archlinux) | ||||
|                 # Replace a) at the beginning b) in the middle c) end d) only | ||||
|                 # 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" | ||||
|                 echo "systemctl disable \"$name\"" | ||||
|             ;; | ||||
|             debian|ubuntu) | ||||
|                 echo update-rc.d -f \"$name\" remove | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ next: | |||
| 	* Build: Change clean-dist target to "distclean" | ||||
| 	* Change execution order to run object as one unit | ||||
| 	* Type __apt_ppa: Fix comparison operator (Tyler Akins) | ||||
| 	* Type __start_on_boot: Archlinux changed to use systemd - adapt | ||||
| 
 | ||||
| 2.1.1: 2013-04-08 | ||||
| 	* Core: Use dynamic dependency resolver to allow indirect self dependencies | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue