This file is indexed.

/usr/bin/dh_metainit is in dh-metainit 0.0.5.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/perl -w

=head1 NAME

dh_metainit - install metainit files into package build directories

=cut

use strict;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<dh_metainit> [S<I<debhelper options>>] [B<--name=>I<name>] [B<-n>] [B<-o>] 

=head1 DESCRIPTION

dh_metainit is a debhelper program that is responsible for installing
metainit files (for further creation of initscripts via the update-metainit
facility) into package build directories.

It also automatically generates the postinst and postrm and prerm commands
needed to create the appropriate initscripts for the init system employed on
the user machine.

B<Important:> If generated postinst script finds /etc/init.d/ or /etc/default files with the same
name as the shipped metainit files, and these are conffiles from non-installed
packages (probably earlier version of this package) they are removed (or renamed
if the user has modified them). This works only if the name of the new metainit is
the same as the name of the old init.d and default file, otherwise you will have to
remove these files yourself. See http://wiki.debian.org/DpkgConffileHandling for that.

If a file named debian/package.metainit exists, then it is installed into
etc/metainit/package in the package build directory, with "package" replaced
by the package name.


=head1 OPTIONS

=over 4

=item B<-n>, B<--noscripts>

Do not modify postinst/postrm/prerm scripts.

=item B<-o>, B<--onlyscripts>

Only modify postinst/postrm/prerm scripts, do not actually install any metainit
files. May be useful if the init script is shipped and/or installed by upstream
in a way that doesn't make it easy to let dh_metainit find it.

=item B<--name=>I<name>

Install the metainit script using the filename I<name>
instead of the default filename, which is the package name. When this parameter
is used, dh_metainit looks for and installs files named
debian/package.name.metainit, instead of the usual debian/package.init.

=item B<--error-handler=>I<function>

Call the named shell function if running the init script fails. The
function should be provided in the prerm and postinst scripts, before the
#DEBHELPER# token.

=back

=head1 NOTES

Note that this command is not idempotent. "dh_clean -k" should be called
between invocations of this command. Otherwise, it may cause multiple
instances of the same text to be added to maintainer scripts.

=cut

init();

foreach my $package (@{$dh{DOPACKAGES}}) {
	my $tmp=tmpdir($package);

	# Figure out what filename to install it as.
	my $script;
	my $init;
	if (defined $dh{NAME}) {
		$script=$dh{NAME};
		$init=pkgfile($package,"$dh{NAME}.metainit") || pkgfile($package,'metainit');
	}
	else {
		$script=$package;
		$init=pkgfile($package,'metainit');
	}       
	

	if ($init ne '' || $dh{ONLYSCRIPTS}) {
		if (! $dh{ONLYSCRIPTS}) {
			if (! -d "$tmp/etc/metainit") {
				doit("install","-d","$tmp/etc/metainit");
			}
		
			doit("install","-p","-m644",$init,"$tmp/etc/metainit/$script.metainit");
		}
		
		if (! $dh{NOSCRIPTS}) {
			# update-rc.d, and start script
			autoscript($package,"postinst", "postinst-metainit",
				"s/#SCRIPT#/$script/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/;s/#PACKAGE#/$package/;");

			# always stops script
			autoscript($package,"prerm","prerm-metainit",
				"s/#SCRIPT#/$script/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/;s/#PACKAGE#/$package/;");

			# removes rc.d links
			autoscript($package,"postrm","postrm-metainit",
				"s/#SCRIPT#/$script/;s/#ERROR_HANDLER#/$dh{ERROR_HANDLER}/;s/#PACKAGE#/$package/;");
		}
	}
}

=head1 SEE ALSO

L<debhelper(7)>

This program is a part of debhelper.

=head1 AUTHOR

Urs Ganse <urs@nerd2nerd.org>
based on dh_installinit by
Joey Hess <joeyh@debian.org>

=cut