Permalink
Browse files

arch-daemons: clean up generator

- fix GH issue #22
- don't write empty After= or initial blank lines
  • Loading branch information...
falconindy committed Apr 12, 2012
1 parent 82d7ec6 commit 724461a04a8d963434a2ab992927a1989a6a7418
Showing with 7 additions and 7 deletions.
  1. +7 −7 arch-daemons
View
@@ -15,20 +15,20 @@ deps=()
# Make service file
create_unit() {
- local daemon=${1%.service}; shift
- local deps=$*
+ local deps= daemon=${1%.service}
- printf "
-[Unit]
-Description=Legacy unit for %s
-After=%s
+ (( $# > 1 )) && printf -v deps 'After=%s\n' "${*:2}"
+ printf \
+'[Unit]
+Description=Legacy unit for %s
+%s
[Service]
ExecStart=/etc/rc.d/%s start
ExecStop=/etc/rc.d/%s stop
RemainAfterExit=yes
Type=forking
-" "$1" "$deps" "$daemon" "$daemon" > "$dest/arch-daemons.target.wants/$1"
+' "$daemon" "$deps" "$daemon" "$daemon" > "$dest/arch-daemons.target.wants/$1"
}

0 comments on commit 724461a

Please sign in to comment.