From b5f43f9edaa9284dab0a2a602328423eab72ac4e Mon Sep 17 00:00:00 2001 From: goose121 Date: Wed, 6 Dec 2017 13:50:17 -0700 Subject: Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1f49021 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 goose121 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. -- cgit v1.2.3 From a0fd8d493a9750195f1c8b660746f7744ebd6471 Mon Sep 17 00:00:00 2001 From: goose121 Date: Wed, 6 Dec 2017 13:51:14 -0700 Subject: Update initify.pl --- initify.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/initify.pl b/initify.pl index 104d252..3aa6960 100644 --- a/initify.pl +++ b/initify.pl @@ -1,3 +1,6 @@ +# (c) goose121, 2017 +# Released under the MIT license + use v5.10.1; use feature "switch"; my $type = "simple"; -- cgit v1.2.3 From fd6b35f5a97b4018b069fefe31fb4f64282d9ecc Mon Sep 17 00:00:00 2001 From: goose121 Date: Fri, 8 Dec 2017 09:44:24 -0700 Subject: Create README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..75bc838 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# initify +This utility converts simple systemd services to OpenRC init-scripts + +## Usage + initify.pl [filename] + +NOTE: The service name will initially be `(fill in)`. This is due to the ability to pipe service-files from `stdin`, as well +as the lack of a service-name field in systemd services. + +## TODO + +- Handle the targets which directly map to OpenRC runlevels +- Convert systemd timers to crontab entries -- cgit v1.2.3 From ac599df75fbfd02d6f7d1108d554810e8284d982 Mon Sep 17 00:00:00 2001 From: goose121 Date: Fri, 8 Dec 2017 09:44:55 -0700 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75bc838..c7d2cef 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # initify -This utility converts simple systemd services to OpenRC init-scripts +This utility converts simple systemd services to OpenRC init-scripts. ## Usage initify.pl [filename] -- cgit v1.2.3 From 53c3fd2ff7a839de1535a3168584a7f36b4a02c6 Mon Sep 17 00:00:00 2001 From: nous Date: Fri, 8 Dec 2017 23:54:35 +0200 Subject: Guess script name from systemd service filename Also, write straight to file instead of stdout --- initify.pl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/initify.pl b/initify.pl index 3aa6960..0d84d3a 100644 --- a/initify.pl +++ b/initify.pl @@ -1,6 +1,9 @@ +#!/usr/bin/perl # (c) goose121, 2017 # Released under the MIT license +use warnings; +#use strict; use v5.10.1; use feature "switch"; my $type = "simple"; @@ -8,6 +11,7 @@ my @cmds_start = (); my @cmds_stop = (); my $pidfile = ""; my $desc = ""; +(my $service=$ARGV[0])=~s/\.service//; while(<>) { #s/\s*|\s*$//g; # Trim whitespace @@ -38,7 +42,7 @@ while(<>) { } } if (m/^Description=(.*)/) { - $desc = $1 + $desc = $1 } } @@ -52,13 +56,17 @@ map {my @sep = split(/ /, $_, 2); push(@cmd_argl, $sep[1]); } @cmds_start; -print <<"EOF"; +open(FH, '>', "$service") || die("Cannot create $service: $!\n"); + +print FH <<"EOF"; \#!/sbin/openrc-run command=$cmd_path[0] command_args="$cmd_argl[0]" pidfile=$pidfile -name="(fill in)" +name="$service" description="$desc" EOF + +close FH; -- cgit v1.2.3