Commit 4b51b7b4 authored by EclipseSpark's avatar EclipseSpark

import package

parents
if deb-systemd-helper debian-installed #UNITFILE#; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask #UNITFILE# >/dev/null || true
if deb-systemd-helper --quiet was-enabled #UNITFILE#; then
# Create new symlinks, if any.
deb-systemd-helper enable #UNITFILE# >/dev/null || true
fi
fi
# Update the statefile to add new symlinks (if any), which need to be cleaned
# up on purge. Also remove old symlinks.
deb-systemd-helper update-state #UNITFILE# >/dev/null || true
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask #UNITFILE# >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled #UNITFILE#; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable #UNITFILE# >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state #UNITFILE# >/dev/null || true
fi
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
_dh_action=try-restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action #UNITFILES# >/dev/null || true
fi
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start #UNITFILES# >/dev/null || true
fi
if [ "$1" = "remove" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask #UNITFILES# >/dev/null
fi
fi
if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge #UNITFILES# >/dev/null
deb-systemd-helper unmask #UNITFILES# >/dev/null
fi
fi
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
if [ -d /run/systemd/system ]; then
deb-systemd-invoke stop #UNITFILES# >/dev/null
fi
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop #UNITFILES# >/dev/null
fi
This diff is collapsed.
Source: init-system-helpers
Section: admin
Priority: extra
Maintainer: Debian systemd Maintainers <pkg-systemd-maintainers@lists.alioth.debian.org>
Uploaders: Michael Biebl <biebl@debian.org>,
Martin Pitt <mpitt@debian.org>,
Build-Depends: debhelper (>= 9),
perl:any,
Standards-Version: 3.9.6
Vcs-Git: git://anonscm.debian.org/collab-maint/init-system-helpers.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/init-system-helpers.git;a=summary
Package: init-system-helpers
Architecture: all
Priority: required
Multi-Arch: foreign
Depends: perl-base (>= 5.20.1-3),
${misc:Depends},
${perl:Depends},
Replaces: sysv-rc (<< 2.88dsf-59.3~),
sysvinit-utils (<< 2.88dsf-59.3),
# sysv-rc now pre-depends on us and if we break them we get:
# E: This installation run will require temporarily removing the essential package sysvinit-utils:amd64 due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option.
#Breaks: sysv-rc (<< 2.88dsf-59.3~)
Breaks: systemd (<< 44-12),
sysvinit-utils (<< 2.88dsf-59.3~),
Conflicts: file-rc (<< 0.8.17~),
openrc (<= 0.18.3-1),
Description: helper tools for all init systems
This package contains helper tools that are necessary for switching between
the various init systems that Debian contains (e. g. sysvinit or
systemd). An example is deb-systemd-helper, a script that enables systemd unit
files without depending on a running systemd.
.
It also includes the "service", "invoke-rc.d", and "update-rc.d" scripts which
provide an abstraction for enabling, disabling, starting, and stopping
services for all supported Debian init systems as specified by the policy.
.
While this package is maintained by pkg-systemd-maintainers, it is NOT
specific to systemd at all. Maintainers of other init systems are welcome to
include their helpers in this package.
Package: dh-systemd
Architecture: all
Multi-Arch: foreign
Depends: debhelper,
${misc:Depends},
${perl:Depends},
Suggests: augeas-tools,
Description: debhelper add-on to handle systemd unit files
dh-systemd provides a debhelper sequence addon named 'systemd' and the
dh_systemd_enable/dh_systemd_start commands.
.
The dh_systemd_enable command adds the appropriate code to the postinst, prerm
and postrm maint scripts to properly enable/disable systemd service files.
The dh_systemd_start command deals with start/stop/restart on upgrades for
systemd-only service files.
Package: init
Section: metapackages
Architecture: any
Essential: yes
Priority: required
Multi-Arch: foreign
Pre-Depends: systemd-sysv [linux-any] | sysvinit-core,
Depends: init-system-helpers,
${misc:Depends},
Description: System-V-like init utilities - metapackage
This package is an essential metapackage which allows you to select from
the available init systems in Debian (systemd, sysvinit) while
ensuring that one of these is available on the system at all times.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: *
Copyright: 2013 Michael Stapelberg
License: BSD-3-clause
Files: systemd2init
Copyright: 2014 Ondřej Surý <ondrej@sury.org>
2014 Lukáš Zapletal <lzap+git@redhat.com>
License: GPL-3+
Files: debian/*
Copyright: 2013 Michael Stapelberg <stapelberg@debian.org>
License: BSD-3-clause
License: GPL-3+
On Debian systems the full text of the GNU General Public
License can be found in the `/usr/share/common-licenses/GPL'
file.
License: BSD-3-clause
Copyright © 2013 Michael Stapelberg
All rights reserved.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.
* Neither the name of Michael Stapelberg nor the
names of contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY Michael Stapelberg ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Michael Stapelberg BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
autoscripts usr/share/debhelper
lib/Debian/Debhelper/Sequence/systemd.pm usr/share/perl5/Debian/Debhelper/Sequence/
script/dh_systemd_enable usr/bin
script/dh_systemd_start usr/bin
systemd2init/skeleton.debian usr/share/dh-systemd
systemd2init/skeleton.redhat usr/share/dh-systemd
systemd2init/systemd2init usr/bin
script/dh_systemd_enable.1p
script/dh_systemd_start.1p
/etc/systemd/system
/var/lib/systemd
script/deb-systemd-helper usr/bin
script/deb-systemd-invoke usr/bin
script/invoke-rc.d usr/sbin
script/service usr/sbin
script/update-rc.d usr/sbin
# The upstream command is called “systemctl reenable”, so we cannot just
# rename it to “re-enable” :).
init-system-helpers: spelling-error-in-manpage usr/share/man/man1/deb-systemd-helper.1p.gz reenable re-enable
man8/invoke-rc.d.8
man8/service.8
man8/update-rc.d.8
script/deb-systemd-helper.1p
script/deb-systemd-invoke.1p
#!/bin/sh
set -e
# See http://bugs.debian.org/722524
if dpkg --compare-versions "$2" lt "1.9"; then
if [ -d /var/lib/systemd/deb-systemd-helper-enabled ]; then
find /var/lib/systemd/deb-systemd-helper-enabled -type f -exec chmod 644 '{}' \;
fi
fi
#DEBHELPER#
exit 0
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
BUILD_DATE = $(shell dpkg-parsechangelog -S Date)
POD_MAN_DATE = $(shell date -u +"%Y-%m-%d" --date="$(BUILD_DATE)")
export POD_MAN_DATE
override_dh_perl:
dh_perl -d --package=init-system-helpers
dh_perl --no-package=init-system-helpers
override_dh_auto_build:
dh_auto_build
for file in $$(ls script/deb-* script/dh_*); do \
pod2man --section=1p --utf8 $$file $$file.1p; \
done
SBIN = debian/init-system-helpers/usr/sbin
override_dh_install-indep:
dh_install
mv $(SBIN)/update-rc.d $(SBIN)/debian-update-rc.d
cp script/parrot-update-rc.d $(SBIN)/update-rc.d
%:
dh $@
Tests: t
Depends: @,
cpanminus,
build-essential
Restrictions: needs-root, allow-stderr, isolation-container
#!/bin/sh
set -eu
mount --make-rprivate /
cpanm Linux::Clone
for test in t/*.t; do
echo "======== $(basename $test) ======="
perl $test
done
This is the internal documentation for invoke-rc.d, as
written by Henrique M Holschuh <hmh@debian.org>
This document can be found on the web as well at
http://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt
There is also the Debian BTS entry for the invoke-rc.d policy change at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=76868
INVOKE-RC.D (/usr/sbin/invoke-rc.d) interface:
==============================================
The interface for all implementations of invoke-rc.d is mandated by the base
implementation in the sysvinit package, just like it is done for
update-rc.d.
There is a provision for a "local initscript policy layer" (read: a call to
/usr/sbin/policy-rc.d if this executable is present in the local system),
which allows the local system administrator to control the behaviour of
invoke-rc.d for every initscript id and action. It is assumed that this
script is OPTIONAL and will by written and provided by packages other than
the initscript system (sysvinit and file-rc packages).
The basic interface for all implementations of policy-rc.d is mandated by
the requirements of the base implementation of invoke-rc.d. This interface
will be described either in the manpage of invoke-rc.d, and in a text file
stored in /usr/share/doc/sysvinit/ by package sysvinit (which will host the
base implementation of invoke-rc.d).
Proposed script interfaces:
invoke-rc.d [options] <basename> <action> [extra initscript parameters...]
basename - Initscript ID, as per update-rc.d(8)
action - Initscript action. Known actions are:
start, [force-]stop, restart,
[force-]reload, status
(status is there because of the LSB. Debian does not use it).
extra initscript parameters: These parameters are passed to the initscript
as is, after the action parameter. <action> is always the first paramenter
to the initscript, and may be modified by fallback actions or policy-rc.d
requests. Note, however, that the extra parameters are not dropped or
modified even if the action (first parameter) is modified.
Options:
--quiet
Quiet mode, no error messages are generated by invoke-rc.d; policy-rc.d
is also called with --quiet if this option is in effect.
--force
Try to run init script regardless of policy and non-fatal errors. Use
of this option in automated scripts is severely discouraged as it
bypasses integrity checks. If the initscript cannot be executed, error
status 102 is returned. Do note that the policy layer call
(policy-rc.d) is NOT skipped, although its results are ignored.
--try-anyway
Try to run the initscript even if a non-fatal subsystem error is
detected (e.g: bad rc.d symlinks). A 102 status exit code will result
if init script fails to execute anyway). Unlike --force, policy is
still enforced with --try-anyway.
--disclose-deny
Return status code 101 instead of status code 0 if initscript action is
denied by local policy rules or runlevel constrains. An warning is
generated if the action is denied.
--query
Returns one of status codes 100-106, does not execute the init.d
script. Implies --disclose-deny and --nofallback. Status codes 104-106
are only generated by this option.
Note many messages are still sent to stderr in --query mode, including
those regarding policy overrides and subsystem errors. Use --quiet if
silent --query operation is desired.
--no-fallback
The policy layer (policy-rc.d) may return fallback actions to be run
instead of the requested action. If this option is active, a fallback
action request will be ignored and a "action not allowed" reply used in
its place. This is probably a BAD idea unless you know exactly what
you're doing.
--help
Outputs help message to stdout
Unknown actions may generate warnings, but are passed to the underlying
initscript anyway. The reason for the warning is simple: It is very unlikely
that an unknown action (by invoke-rc.d) will be known to the policy layer
(policy-rc.d), and therefore it may cause an initscript to execute an action
which the local system administrator would have not allowed had he known
about it. If policy-rc.d is not present, no warnings for unknown actions
are generated.
Should an initscript be executed, invoke-rc.d ALWAYS returns the status code
returned by the initscript. Initscripts should not return status codes in
the 100+ range (this is also a LSB requirement).
Exit status codes (LSB compatible):
0 : success
either the init script was run and returned exit status 0 (note
that a fallback action may have been run instead of the one given
in the command line), or it was not run because of runlevel/local
policy constrains and --disclose-deny is not in effect.
1 - 99 : reserved for init.d script
100 : init script ID (basename) unknown
init script not registered sucessfully through
update-rc.d or init script does not exist.
This error is fatal for most initscript systems.
101 : action not allowed
requested action will not be performed because of
runlevel or local policy constrains, and
--disclose-deny is in effect. Note that a fallback
action is NOT considered "action not allowed",
unless --nofalback is in effect.
102 : subsystem error
initscript (or policy) subsystem malfuncion.
(e.g. broken /sbin/runlevel).
Also, forced initscript execution due to
--try-anyway or --force failed.
103 : syntax error
104 : action allowed
--query is in effect; init script would be run if
not for --query.
105 : behaviour uncertain
cannot determine if action should be carried out or
not, and --query in effect.
106 : fallback action requested
the policy layer denied the requested action, and
supplied an allowed fallback action.
This is the internal documentation for policy-rc.d, as
written by Henrique M Holschuh <hmh@debian.org>
This document can be found on the web as well at
http://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt
There is also the Debian BTS entry for the invoke-rc.d policy change at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=76868
POLICY-RC.D Policy layer (/usr/sbin/policy-rc.d) interface:
=============================================================
Most Debian systems will not have this script as the need for a policy layer
is not very common. Most people using chroot jails just need an one-line
script which returns an exit status of 101 as the jailed
/usr/sbin/policy-rc.d script.
The /usr/sbin/policy-rc.d file *must* be managed through the alternatives
system (/usr/sbin/update-alternatives) by any packages providing it.
/usr/sbin/policy-rc.d [options] <initscript ID> <actions> [<runlevel>]
/usr/sbin/policy-rc.d [options] --list <initscript ID> [<runlevel> ...]
Options:
--quiet
no error messages are generated.
--list
instead of verifying policy, list (in a "human parseable" way) all
policies defined for the given initscript id (for all runlevels if no
runlevels are specified; otherwise, list it only for the runlevels
specified), as well as all known actions and their fallbacks for the
given initscript id (note that actions and fallback actions might be
global and not particular to a single initscript id).
<actions> is a space-separated list of actions (usually only one). Note that
the list is passed in a single parameter and not as multiple parameters.
The following actions are always known (even if specifying a policy for them
is not supported by whatever policy-rc.d system is in use): start,
[force-]stop, restart, [force-]reload, status.
If an out-of-runlevel start or restart attempt is detected by invoke-rc.d,
the "start" or "restart" action will be changed to "(start)" or "(restart)"
respectively. This allows policy-rc.d to differentiate an out-of-runlevel
start/restart from a normal one.
The runlevel parameters are optional. If a runlevel is not specified, it is
considered to be unknown/undefined. Note that for sysv-like initscript
systems, an undefined runlevel is very likely to cause a 105 exit status.
A runlevel for update-rc.d is defined as a character string, of which the
usual INIT one-character runlevels are only a subset. It may contain
embedded blanks.
stdout is used to output a single line containing fallback actions,
or to output --list results.
stderr is used to output error messages
stdin is not to be used, this is not an interactive interface.
Exit status codes:
0 - action allowed
1 - unknown action (therefore, undefined policy)
100 - unknown initscript id
101 - action forbidden by policy
102 - subsystem error
103 - syntax error
104 - [reserved]
105 - behaviour uncertain, policy undefined.
106 - action not allowed. Use the returned fallback actions
(which are implied to be "allowed") instead.
When in doubt (policy-rc.d returned status 105 or status 1), invoke-rc.d
will assume an action is allowed, but it will warn the user of the problem.
Returning fallback information:
Fallback actions are returned in the first line sent to stdout (other lines
will be discarded). Multiple actions to be tried are allowed, and must be
separated by spaces. Multiple actions are carried out one at a time, until
one is sucessful.
e.g.: returning status 106 and "restart stop" in stdout (without
the quotes) will cause invoke-rc.d to attempt action "restart",
and then only if "restart" failed, attempt action "stop".
invoke-rc.d built-in policy rules:
To shield policy-rc.d of the underlying initscript system (file-rc, links in
/etc/rc?.d or something else), invoke-rc.d implements the following built-in
rules:
1. action "start" out of runlevel is denied,
(policy-rc.d receives action "(start)" instead of "start");
2. action "restart" out of runlevel is denied,
(policy-rc.d receives action "(restart)" instead of "restart");
3. any action for a non-executable initscript is denied.
Rule 3 is absolute, policy-rc.d cannot override it.
#!/usr/bin/perl
use warnings;
use strict;
use Debian::Debhelper::Dh_Lib;
# dh_systemd_enable runs unconditionally, and before dh_installinit, so that
# the latter can use invoke-rc.d and all symlinks are already in place.
insert_before("dh_installinit", "dh_systemd_enable");
# dh_systemd_start handles the case where there is no corresponding init
# script, so it runs after dh_installinit.
insert_after("dh_installinit", "dh_systemd_start");
1
.\" Hey, Emacs! This is an -*- nroff -*- source file.
.\" Authors: Ian Jackson
.\" (c) 2003 Software in the Public Interest
.\" Traductor: Rubén Porras (nahoo@inicia.es)
.\" Revisado por : Javier Fernández-Sanguino Peńa (jfs@debian.org)
.\" Esteban Manchado Velázquez (zoso@demiurgo.org)
.\" Está basada en la página de manual original:
.\" versión 1.2 del CVS de /cvs/debian-doc/manpages/english/sysvinit/update-rc.d.8
.TH UPDATE\-RC.D 8 "23 de Diciembre de 2003" "Proyecto Debian" "sysv-rc"
.SH NOMBRE
update\-rc.d \- crea y borra los enlaces a los scripts init de tipo
System V
.SH SINOPSIS
.B update\-rc.d
.RI [ -n ]
.RI [ -f ]
.IB nombre " remove"
.HP
.B update-rc.d
.RI [ -n ]
.IB nombre " defaults"
.RI [ NN " | " NN-start " " NN-stop ]
.HP
.B update-rc.d
.RI [ -n ]
.I nombre
.BR start | stop
.IR "NN nivel_de_ejecución nivel_de_ejecución " ...
.B .
.BR start | stop
.IR "NN nivel_de_ejecución nivel_de_ejecución " ...
.BR . " ..."
.SH DESCRIPCI\['O]N
.B update-rc.d
actualiza automáticamente los enlaces a los scripts de init tipo
System V que se encuentran en
.BI /etc/rc[nivel_de_ejecución].d/NNnombre
y que apuntan a los script
.BI /etc/init.d/nombre\fR.
Estos son ejecutados por
.B init
cuando se cambia de nivel de ejecución y se usan generalmente para
arrancar y parar servicios del sistema (por ejemplo, demonios).
.I nivel_de_ejecución
es uno de los soportados por
.BR init ", " 0123456789S ,
y
.I NN
es el código de secuencia de dos dígitos usado por
.B init
para decidir en que orden se ejecutan los scripts.
Esta página del manual documenta sólo el modo de uso y comportamiento de
.BR update-rc.d .
Para una explicación más detallada sobre la administración de los
scripts de init estilo System V, por favor, lea
.BR init (8)
y el
.IR "Manual de normativa de Debian" .
.SH CREACI\['O]N DE ENLACES A LOS SCRIPTS DE INIT
Cuando se ejecuta con una o varias de las opciones
.BR defaults ", " start ", o " stop ,
.B update-rc.d
crea los enlaces
.BI /etc/rc[nivel_de_ejecución].d/[SK]NNnombre
apuntando al script
.BI /etc/init.d/nombre\fR.
Si ya existe algún fichero con el nombre
.BI /etc/rc[nivel_de_ejecución].d/[SK]??
entonces
.B update-rc.d
no hace nada. Esto es así para que el administrador del sistema pueda
reorganizar los enlaces ( teniendo en cuenta que debe dejar al
menos un enlace si los quiere eliminar ) sin que se sobreescriba su
configuración.
Si se usa la opción
.B defaults
entonces
.B update-rc.d
creará enlaces para arrancar los servicios en los niveles de ejecución
.B 2345
y parar los servicios en los niveles de ejecución
.BR 016 .
Por omisión todos los enlaces tendrán el código de secuencia 20, pero
esto puede cambiarse especificando uno o dos argumentos
.I NN.
Un argumento cambia el valor por omisión del código de secuencia tanto
para los enlaces de arranque como para los de parada, y si se
proporcionan dos argumentos el primero cambia el código de los enlaces
de arranque y el segundo el de los enlaces de parada.
En vez de usar
.B defaults
, los niveles de ejecución en los que se arranca o se para un servicio
pueden ser especificados explícitamente mediante un conjunto de
argumentos:
Cada uno de estos conjuntos empieza con un argumento
.BR start " o " stop
para especificar cuándo se van a crear enlaces para arrancar o parar
el servicio.
Luego les sigue
.IR NN ,
el código de secuencia para todos los enlaces del conjunto, y uno o
más números de nivel de ejecución, cada uno como un solo argumento. El
conjunto se termina con el argumento
.B '.'
(un punto).
Cuando se especifican explícitamente los niveles de ejecución,
normalmente habrá un conjunto
.B start
y otro
.B stop .
Si son necesarios diferentes códigos de secuencia para los
distintos niveles de ejecución, entonces es necesario especificar
varios conjuntos
.B start
y
.B stop .
El script
.BI /etc/init.d/nombre
debe existir antes de ejecutar
.B update-rc.d
para crear los enlaces.
.SH BORRADO DE LOS SCRIPTS
Cuando se ejecuta con la opción
.I remove
, update-rc.d borra todos los enlaces dentro del directorio
.BI /etc/rc[nivel_de_ejecución].d
que apunten al script
.BI /etc/init.d/nombre\fR .
El script debe haber sido borrado previamente (
.B update-rc.d
lo comprueba ).
Normalmente los scripts post-eliminación de los paquetes ejecutan