blob: f642287d0380e17fdb740da0e8a538be02eb04d9 (
plain)
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
|
_services="com.system76.PowerDaemon.service"
_stop_services() {
for service in $_services; do
if /usr/bin/systemctl -q is-active $service >/dev/null 2>&1; then
/usr/bin/systemctl stop $service >/dev/null 2>&1
fi
done
}
_disable_services() {
for service in $_services; do
if /usr/bin/systemctl -q is-enabled $service >/dev/null 2>&1; then
/usr/bin/systemctl disable $service >/dev/null 2>&1
/usr/bin/systemctl reset-failed $service >/dev/null 2>&1
fi
done
}
_restore_services() {
for service in $_services; do
if /usr/bin/systemctl -q is-enabled $service >/dev/null 2>&1; then
/usr/bin/systemctl start $service > /dev/null 2>&1
fi
done
}
post_install() {
cat << EOF
The System76 Power package provides the following system services:
com.system76.PowerDaemon.service System76 power support
And the following application
system76-power System76 power CLI interface
EOF
}
pre_upgrade() {
if /usr/bin/systemctl -q is-enabled system76-power.service >/dev/null 2>&1; then
/usr/bin/systemctl stop system76-power.service >/dev/null 2>&1
/usr/bin/systemctl disable system76-power.service >/dev/null 2>&1
cat << EOF
The systemd unit have been renamed to com.system76.PowerDaemon.service, you
need to re-enable the service using the new name.
EOF
fi
_stop_services
}
post_upgrade() {
/usr/bin/systemctl daemon-reload >/dev/null 2>&1
_restore_services
post_install
}
pre_remove() {
_stop_services
_disable_services
}
post_remove() {
/usr/bin/systemctl daemon-reload >/dev/null 2>&1
cat << EOF
Be sure to stop and disable all running System76 user services.
EOF
}
|