include the date and module version in the generated init file

This commit is contained in:
Karen Etheridge 2012-06-15 13:08:23 -07:00
parent f5923e7327
commit db10ca03e9
4 changed files with 23 additions and 12 deletions

View file

@ -1,3 +1,6 @@
* include the date and module version in the generated init file
(Karen Etheridge)
0.0.9 2012-19-04 SymKat <symkat@symkat.com> 0.0.9 2012-19-04 SymKat <symkat@symkat.com>
* Stole Moo's MANIFEST.SKIP * Stole Moo's MANIFEST.SKIP

View file

@ -374,6 +374,8 @@ sub dump_init_script {
$self->data( $self->run_template( $self->data( $self->run_template(
$self->data, $self->data,
{ {
HEADER => 'Generated at ' . scalar(localtime)
. ' with Daemon::Control ' . ($self->VERSION || 'DEV'),
NAME => $self->name ? $self->name : "", NAME => $self->name ? $self->name : "",
REQUIRED_START => $self->lsb_start ? $self->lsb_start : "", REQUIRED_START => $self->lsb_start ? $self->lsb_start : "",
REQUIRED_STOP => $self->lsb_stop ? $self->lsb_stop : "", REQUIRED_STOP => $self->lsb_stop ? $self->lsb_stop : "",
@ -427,6 +429,8 @@ sub run {
__DATA__ __DATA__
#!/bin/sh #!/bin/sh
# [% HEADER %]
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: [% NAME %] # Provides: [% NAME %]
# Required-Start: [% REQUIRED_START %] # Required-Start: [% REQUIRED_START %]

View file

@ -24,17 +24,19 @@ close $lf;
my $content_expected = do { local $/; <DATA> }; my $content_expected = do { local $/; <DATA> };
is $content, $content_expected, "LSB File Generation Works."; like $content, qr/$content_expected/, "LSB File Generation Works.";
done_testing; done_testing;
__DATA__ __DATA__
#!/bin/sh #!/bin/sh
# Generated at [\w: ]+ with Daemon::Control (?:DEV|[\d.]+)
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: My Daemon # Provides: My Daemon
# Required-Start: $syslog $remote_fs # Required-Start: \$syslog \$remote_fs
# Required-Stop: $syslog # Required-Stop: \$syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: My Daemon Short # Short-Description: My Daemon Short
@ -43,9 +45,9 @@ __DATA__
if [ -x /usr/sbin/mydaemon/init.pl ]; if \[ -x /usr/sbin/mydaemon/init.pl \];
then then
/usr/sbin/mydaemon/init.pl $1 /usr/sbin/mydaemon/init.pl \$1
else else
echo "Required program /usr/sbin/mydaemon/init.pl not found!" echo "Required program /usr/sbin/mydaemon/init.pl not found!"
exit 1; exit 1;

View file

@ -24,28 +24,30 @@ close $lf;
my $content_expected = do { local $/; <DATA> }; my $content_expected = do { local $/; <DATA> };
is $content, $content_expected, "LSB File Generation Works."; like $content, qr/$content_expected/, "LSB File Generation Works.";
done_testing; done_testing;
__DATA__ __DATA__
#!/bin/sh #!/bin/sh
# Generated at [\w: ]+ with Daemon::Control (?:DEV|[\d.]+)
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: My Daemon # Provides: My Daemon
# Required-Start: $syslog $remote_fs # Required-Start: \$syslog \$remote_fs
# Required-Stop: $syslog # Required-Stop: \$syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: My Daemon Short # Short-Description: My Daemon Short
# Description: My Daemon controls the My Daemon daemon. # Description: My Daemon controls the My Daemon daemon.
### END INIT INFO` ### END INIT INFO`
[ -r /etc/default/my_program ] && . /etc/default/my_program \[ -r /etc/default/my_program \] && . /etc/default/my_program
if [ -x /usr/sbin/mydaemon/init.pl ]; if \[ -x /usr/sbin/mydaemon/init.pl \];
then then
/usr/sbin/mydaemon/init.pl $1 /usr/sbin/mydaemon/init.pl \$1
else else
echo "Required program /usr/sbin/mydaemon/init.pl not found!" echo "Required program /usr/sbin/mydaemon/init.pl not found!"
exit 1; exit 1;