aboutsummaryrefslogtreecommitdiffstats
path: root/initify.pl
diff options
context:
space:
mode:
Diffstat (limited to 'initify.pl')
-rwxr-xr-x[-rw-r--r--]initify.pl39
1 files changed, 39 insertions, 0 deletions
diff --git a/initify.pl b/initify.pl
index 0d84d3a..7cec3d2 100644..100755
--- a/initify.pl
+++ b/initify.pl
@@ -6,6 +6,9 @@ use warnings;
#use strict;
use v5.10.1;
use feature "switch";
+use Getopt::Long;
+use Pod::Usage;
+
my $type = "simple";
my @cmds_start = ();
my @cmds_stop = ();
@@ -13,6 +16,15 @@ my $pidfile = "";
my $desc = "";
(my $service=$ARGV[0])=~s/\.service//;
+my %opt;
+GetOptions(\%opt,
+ "name=s",
+ "help|?") || pod2usage(2);
+
+pod2usage() if ($opt{help});
+
+$service = $opt{name} if (length $opt{name});
+
while(<>) {
#s/\s*|\s*$//g; # Trim whitespace
if (m/^Type\s*=\s*(.*)/) {
@@ -70,3 +82,30 @@ description="$desc"
EOF
close FH;
+
+
+__END__
+
+=head1 NAME
+
+initify - Convert systemd units to OpenRC init-files
+
+=head1 SYNOPSIS
+
+ initify [options] file
+
+=head2 Options
+
+=over 12
+
+=item -h, --help
+
+Print this message
+
+=item -n <name>, --name=<name>
+
+Set the name of the unit created
+
+=back
+
+=cut