Merge pull request #26 from karenetheridge/topic/init.d_version_logging

include the date and module version in the generated init file
This commit is contained in:
SymKat 2012-09-03 12:14:02 -07:00
commit 04516f445e
4 changed files with 22 additions and 11 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>
* Stole Moo's MANIFEST.SKIP

View file

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

View file

@ -24,17 +24,19 @@ close $lf;
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;
__DATA__
#!/bin/sh
# Generated at [\w: ]+ with Daemon::Control (?:DEV|[\d.]+)
### BEGIN INIT INFO
# Provides: My Daemon
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog
# Required-Start: \$syslog \$remote_fs
# Required-Stop: \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# 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
/usr/sbin/mydaemon/init.pl $1
/usr/sbin/mydaemon/init.pl \$1
else
echo "Required program /usr/sbin/mydaemon/init.pl not found!"
exit 1;

View file

@ -24,28 +24,30 @@ close $lf;
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;
__DATA__
#!/bin/sh
# Generated at [\w: ]+ with Daemon::Control (?:DEV|[\d.]+)
### BEGIN INIT INFO
# Provides: My Daemon
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog
# Required-Start: \$syslog \$remote_fs
# Required-Stop: \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: My Daemon Short
# Description: My Daemon controls the My Daemon daemon.
### 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
/usr/sbin/mydaemon/init.pl $1
/usr/sbin/mydaemon/init.pl \$1
else
echo "Required program /usr/sbin/mydaemon/init.pl not found!"
exit 1;