gluez 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,8 +3,8 @@ require 'base64'
3
3
  resource :upstart do
4
4
  optional :start_on, :default => "runlevel [2]"
5
5
  optional :stop_on, :default => "runlevel [016]"
6
- optional :fork, :default => false
7
- mandatory :code
6
+
7
+ mandatory :script
8
8
 
9
9
  ready!
10
10
 
@@ -18,10 +18,11 @@ resource :upstart do
18
18
 
19
19
  console owner
20
20
 
21
- #{self.fork ? 'expect fork' : ''}
22
21
  respawn
23
22
 
24
- exec #{self.code}
23
+ script
24
+ #{self.script}
25
+ end script
25
26
  EOF
26
27
 
27
28
  script64 = Base64.encode64(script.multiline_strip)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gluez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -29,7 +29,6 @@ files:
29
29
  - lib/gluez/resources/enable.rb
30
30
  - lib/gluez/resources/file.rb
31
31
  - lib/gluez/resources/gem.rb
32
- - lib/gluez/resources/initd.rb
33
32
  - lib/gluez/resources/link.rb
34
33
  - lib/gluez/resources/mount.rb
35
34
  - lib/gluez/resources/package.rb
@@ -1,95 +0,0 @@
1
- require 'base64'
2
-
3
- resource :initd do
4
- optional :daemon_opts, :default => ""
5
- optional :path, :default => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
6
- mandatory :daemon
7
-
8
- ready!
9
-
10
- self.as_user "root"
11
-
12
- script = <<-EOF
13
- #!/bin/sh
14
-
15
- ### BEGIN INIT INFO
16
- # Provides: #{self.name}
17
- # Required-Start: $local_fs $remote_fs $network $syslog
18
- # Required-Stop: $local_fs $remote_fs $network $syslog
19
- # Default-Start: 2 3 4 5
20
- # Default-Stop: 0 1 6
21
- # Short-Description: starts #{self.name}
22
- # Description: starts #{self.name}
23
- ### END INIT INFO
24
-
25
- PATH=#{self.path}
26
- DAEMON=#{self.daemon}
27
- DAEMON_OPTS="#{self.daemon_opts}"
28
- NAME=#{self.name}
29
- DESC=$NAME
30
-
31
- # Include defaults if available
32
- if [ -f /etc/default/#{self.name} ]; then
33
- . /etc/default/#{self.name}
34
- fi
35
-
36
- test -x $DAEMON || exit 0
37
-
38
- set -e
39
-
40
- . /lib/lsb/init-functions
41
-
42
- case "$1" in
43
- start)
44
- echo -n "Starting $DESC: "
45
- start-stop-daemon --start --chuid #{self.user} --quiet --pidfile /var/run/$NAME.pid --exec su -l #{self.user} -c '$DAEMON' -- $DAEMON_OPTS || true
46
- echo "$NAME."
47
- ;;
48
-
49
- stop)
50
- echo -n "Stopping $DESC: "
51
- start-stop-daemon --stop --chuid #{self.user} --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON || true
52
- echo "$NAME."
53
- ;;
54
-
55
- restart|force-reload)
56
- echo -n "Restarting $DESC: "
57
- start-stop-daemon --stop --chuid #{self.user} --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON || true
58
- sleep 1
59
- start-stop-daemon --start --chuid #{self.user} --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
60
- echo "$NAME."
61
- ;;
62
- reload)
63
- echo -n "Reloading $DESC configuration: "
64
- start-stop-daemon --stop --chuid #{self.user} --signal HUP --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON || true
65
- echo "$NAME."
66
- ;;
67
-
68
- status)
69
- status_of_proc -p /var/run/$NAME.pid "$DAEMON" $NAME && exit 0 || exit $?
70
- ;;
71
- *)
72
- echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2
73
- exit 1
74
- ;;
75
- esac
76
-
77
- exit 0
78
- EOF
79
-
80
- script64 = Base64.encode64(script.multiline_strip)
81
-
82
- setup "cat >~/.gluez_transfer <<\\DATA
83
- #{script64.strip}
84
- DATA"
85
-
86
- steps do |step|
87
- step.checks << "-f /etc/init.d/#{self.name}"
88
- step.code = "touch /etc/init.d/#{self.name}"
89
- end
90
- steps do |step|
91
- step.checks << %Q("\\$(cat ~/.gluez_transfer | base64 -i -d - | md5sum - | awk '{print \\$1}')" = "\\$(md5sum /etc/init.d/#{self.name} | awk '{print \\$1}')")
92
- step.code = "chmod +x /etc/init.d/#{self.name} && cat ~/.gluez_transfer | base64 -i -d - > /etc/init.d/#{self.name}"
93
- end
94
-
95
- end