[Pkg-sysvinit-devel] Request for dh_installinit and/or update-rc.d
Marc MERLIN
marc at merlins.org
Tue Mar 22 15:19:15 UTC 2011
Hi,
I work on debian packages that need to have all their files as part of the
package.
As a result, the normal dh_installinit that creates a postinst that runs
update-rc.d is no good for me since the symlink files aren't part of the
package.
It would be fantastic if dh_installinit could grow an option that tells it
to make the rcX.d symlinks at package build time.
However for now I figured I would just use update-rc.d to make my own
symlinks in the foo/debian/packagename/ directory at build time.
But then I realized that it has
my $initd = "/etc/init.d";
my $etcd = "/etc/rc";
hardcoded in it, with no override capability.
It would be great if update-rc.d could take a command line option and/or an
env variable to allow replacing those 2 variables, or at least the '/etc'
prefix (which would be good enough for me here).
Joey (hi :), I'm not sure if my feature request for dh_installinit is
reasonable within your vision or would even happen.
Sysvinit maintainers, separately, would you consider adding a patch like
the one below?
Thanks,
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/
-------------- next part --------------
--- /usr/sbin/update-rc.d 2010-09-24 11:16:41.000000000 -0700
+++ /tmp/update-rc.d 2011-03-22 08:14:35.152011532 -0700
@@ -6,8 +6,18 @@
use strict;
use warnings;
-my $initd = "/etc/init.d";
-my $etcd = "/etc/rc";
+my $prefix ='/etc';
+if ($ENV{'RCD_PREFIX'})
+{
+ $prefix = $ENV{'RCD_PREFIX'};
+ foreach my $dir (qw(rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc5.d rc6.d rcS.d))
+ {
+ mkdir ($dir, 0755);
+ }
+}
+
+my $initd = "$prefix/init.d";
+my $etcd = "$prefix/rc";
my $notreally = 0;
# Print usage message and die.
@@ -30,7 +40,7 @@
# Dependency based boot sequencing is the default, but upgraded
# systems might keep the legacy ordering until the sysadm choose to
# migrate to the new ordering method.
-if ( ! -f "/etc/init.d/.legacy-bootordering" ) {
+if ( ! -f "$initd/.legacy-bootordering" and $prefix eq '/etc') {
info("using dependency based boot sequencing");
exit insserv_updatercd(@ARGV);
}
@@ -52,7 +62,7 @@
my ($script, @arguments) = @_;
my $archive = "/var/lib/update-rc.d";
- return if $notreally;
+ return if ($notreally or $prefix ne "/etc");
open(FILE, ">", "$archive/${script}.new") || die;
print FILE join(" ","update-rc.d", at arguments), "\n";
@@ -376,7 +386,7 @@
$scriptname = shift @args;
$action = shift @args;
if ("remove" eq $action) {
- if ( -f "/etc/init.d/$scriptname" ) {
+ if ( -f "$initd/$scriptname" ) {
my $rc = system "insserv", @opts, "-r", $scriptname;
if (0 == $rc && !$notreally) {
save_last_action($scriptname, @orig_argv);
@@ -398,14 +408,14 @@
# with Default-Start/Default-Stop values of LSB comment.
cmp_args_with_defaults($scriptname, $action, @args);
- if ( -f "/etc/init.d/$scriptname" ) {
+ if ( -f "$initd/$scriptname" ) {
my $rc = system "insserv", @opts, $scriptname;
if (0 == $rc && !$notreally) {
save_last_action($scriptname, @orig_argv);
}
exit $rc;
} else {
- error("initscript does not exist: /etc/init.d/$scriptname");
+ error("initscript does not exist: $initd/$scriptname");
}
} elsif ("disable" eq $action || "enable" eq $action) {
insserv_toggle($notreally, $action, $scriptname, @args);
@@ -451,7 +461,7 @@
sub lsb_header_for_script {
my $name = shift;
- foreach my $file ("/etc/insserv/overrides/$name", "/etc/init.d/$name",
+ foreach my $file ("/etc/insserv/overrides/$name", "$initd/$name",
"/usr/share/insserv/overrides/$name") {
return $file if -s $file;
}
@@ -464,7 +474,7 @@
my ($lsb_start_ref, $lsb_stop_ref, $arg_str, $lsb_str);
my (@arg_start_lvls, @arg_stop_lvls, @lsb_start_lvls, @lsb_stop_lvls);
- ($lsb_start_ref, $lsb_stop_ref) = parse_def_start_stop("/etc/init.d/$name");
+ ($lsb_start_ref, $lsb_stop_ref) = parse_def_start_stop("$initd/$name");
@lsb_start_lvls = @$lsb_start_ref;
@lsb_stop_lvls = @$lsb_stop_ref;
return if (!@lsb_start_lvls and !@lsb_stop_lvls);
More information about the Pkg-sysvinit-devel
mailing list