1 |
|
# Copyright 1999-2021 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=6
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
DESCRIPTION="Tool to manage OpenRC and systemd services that need to be restarted"
|
7 |
7 |
HOMEPAGE="https://dev.gentoo.org/~mschiff/restart-services/"
|
... | ... | |
9 |
9 |
|
10 |
10 |
LICENSE="GPL-3"
|
11 |
11 |
SLOT="0"
|
12 |
|
KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc x86"
|
13 |
|
IUSE=""
|
|
12 |
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
|
14 |
13 |
|
15 |
|
DEPEND=""
|
16 |
14 |
RDEPEND="
|
17 |
15 |
app-admin/lib_users
|
18 |
|
|| ( sys-apps/openrc sys-apps/systemd )
|
19 |
16 |
app-portage/portage-utils
|
|
17 |
|| ( sys-apps/openrc sys-apps/systemd )
|
20 |
18 |
"
|
21 |
19 |
|
22 |
20 |
src_install() {
|
... | ... | |
27 |
25 |
doins restart-services.conf
|
28 |
26 |
dodoc README CHANGES
|
29 |
27 |
|
30 |
|
sed -i 's/^#include/include/' "${D}"/etc/restart-services.conf
|
31 |
|
cat>"${D}"/etc/restart-services.d/00-local.conf<<-EOF
|
|
28 |
sed -i -e 's/^#include/include/' "${ED}"/etc/restart-services.conf || die
|
|
29 |
cat > "${ED}"/etc/restart-services.d/00-local.conf <<- EOF || die
|
32 |
30 |
# You may put your local changes here or in any other *.conf file
|
33 |
31 |
# in this directory so you can leave /etc/restart-services.conf as is.
|
34 |
32 |
# Example:
|
... | ... | |
38 |
36 |
}
|
39 |
37 |
|
40 |
38 |
pkg_postinst() {
|
41 |
|
local MAJOR MINOR
|
42 |
39 |
# migrate config data for versions < 0.13.2
|
43 |
|
if [[ $REPLACING_VERSIONS ]]; then
|
44 |
|
MAJOR=${REPLACING_VERSIONS%%.*}
|
45 |
|
MINOR=${REPLACING_VERSIONS%.*}
|
46 |
|
MINOR=${MINOR#*.}
|
|
40 |
if [[ -n ${REPLACING_VERSIONS} ]]; then
|
47 |
41 |
|
48 |
|
if [[ $MAJOR -eq 0 && $MINOR -lt 14 ]]; then
|
49 |
|
einfo "Checking for old config"
|
|
42 |
if [[ $(ver_cut 1 ${REPLACING_VERSIONS}) -eq 0 ]] \
|
|
43 |
&& [[ $(ver_cut 2 ${REPLACING_VERSIONS}) -lt 14 ]]; then
|
|
44 |
local have_old_config=0
|
|
45 |
ebegin "Checking for old config"
|
50 |
46 |
if [[ -f /etc/restart_services.conf ]]; then
|
|
47 |
have_old_config=1
|
51 |
48 |
ewarn "Old config file found: /etc/restart_services.conf"
|
52 |
49 |
ewarn "It will be ignored so please migrate settings to a file in"
|
53 |
50 |
ewarn "/etc/restart-services.d/ and/or remove /etc/restart_services.conf"
|
54 |
51 |
fi
|
55 |
52 |
if [[ -d /etc/restart_services.d ]]; then
|
|
53 |
have_old_config=1
|
56 |
54 |
ewarn "Old config directory found: /etc/restart_services.d"
|
57 |
55 |
ewarn "It will be ignored so please migrate files to /etc/restart-services.d"
|
58 |
56 |
ewarn "and/or remove /etc/restart_services.d"
|
59 |
57 |
fi
|
60 |
|
einfo "done"
|
|
58 |
eend ${have_old_config}
|
61 |
59 |
fi
|
62 |
60 |
fi
|
63 |
61 |
}
|