summaryrefslogtreecommitdiff
path: root/pcr/initify/trim_path_from_service_name.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/initify/trim_path_from_service_name.patch')
-rw-r--r--pcr/initify/trim_path_from_service_name.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/pcr/initify/trim_path_from_service_name.patch b/pcr/initify/trim_path_from_service_name.patch
new file mode 100644
index 000000000..f1aef74bd
--- /dev/null
+++ b/pcr/initify/trim_path_from_service_name.patch
@@ -0,0 +1,32 @@
+diff --git a/initify.pl b/initify.pl
+index 7cec3d2..3d8b1bd 100755
+--- a/initify.pl
++++ b/initify.pl
+@@ -14,7 +14,8 @@ my @cmds_start = ();
+ my @cmds_stop = ();
+ my $pidfile = "";
+ my $desc = "";
+-(my $service=$ARGV[0])=~s/\.service//;
++(my $service = $ARGV[0]) =~ s/\.service//;
++(my $svc_name = $ARGV[0]) =~ s|(.*/)?([^/.]*)\.service|$2|;
+
+ my %opt;
+ GetOptions(\%opt,
+@@ -23,7 +24,7 @@ GetOptions(\%opt,
+
+ pod2usage() if ($opt{help});
+
+-$service = $opt{name} if (length $opt{name});
++$svc_name = $opt{name} if (length $opt{name});
+
+ while(<>) {
+ #s/\s*|\s*$//g; # Trim whitespace
+@@ -77,7 +78,7 @@ command=$cmd_path[0]
+ command_args="$cmd_argl[0]"
+ pidfile=$pidfile
+
+-name="$service"
++name="$svc_name"
+ description="$desc"
+ EOF
+