blob: 3c8592a48d1556978cea46add93f7f8f84d8ccaf (
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
|
_services="system76-power.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:
system76-power.service System76 power support
And the following application
system76-power System76 power CLI interface
To run system76-power as a normal user, add them to the "adm" group.
EOF
}
pre_upgrade() {
_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
}
|