blob: 0a9b373c94d860dad8e26dcd407309b65c382477 (
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
|
_printcap='/etc/lprng/printcap'
_service='lpd.service'
_clean_untracked() {
set -u
local _untracked=(
'/usr/share/doc/lprng/lpd.conf.sample'
'/usr/share/doc/lprng/lpd.perms.sample'
'/usr/share/doc/lprng/printcap.sample'
)
# These untracked files can't be cleaned any other way
rm -f "${_untracked[@]}"
set +u
}
_post_ui() {
set -u
systemctl daemon-reload
if systemctl -q is-active 'org.cups.cups-lpd.socket'; then
echo 'You may need to disable cups-lpd with'
echo " systemctl disable --now 'org.cups.cups-lpd.socket'"
fi
if ! systemctl -q is-enabled "${_service}"; then
echo 'Enable your lpd server with'
echo " sudo systemctl enable --now '${_service}'"
fi
if ! grep -qe '^[a-zA-Z]' "${_printcap}"; then
echo "Add some printers to ${_printcap}"
fi
set +u
}
post_upgrade() {
_post_ui
_clean_untracked
}
post_install() {
_post_ui
_clean_untracked
}
pre_remove() {
set -u
systemctl stop "${_service}"
systemctl disable "${_service}"
set +u
_clean_untracked
}
|