blob: 41586a07446c2243fa3921f3437f9f1ae3b9d8a9 (
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
|
post_remove() {
update-mime-database /usr/share/mime
update-desktop-database -q
gtk-update-icon-cache
[[ -z $2 ]] && echo -e "Stopping conveyor.service"
[[ -z $2 ]] && echo -e "Disabling conveyor.service"
systenctl disable conveyor 2>/dev/null
userdel -r conveyor >/dev/null 2>/dev/null
[[ -z "$2" ]] && echo -e "Restoring /run/lock's permissions"
chmod g-w /run/lock
true
}
post_install() {
## Reuse post_remove code
post_remove "null" "null"
## Create conveyor user
echo -e "\nAdding user: conveyor"
if ! getent passwd conveyor >/dev/null; then
useradd --system \
-M -d /dev/null \
--shell /bin/false conveyor
gpasswd -a conveyor lp
gpasswd -a conveyor uucp
fi
# Create and set permissions for /var/run/conveyor
mkdir -p -m 3777 /var/run/conveyor
chmod g+s /var/run/conveyor
chgrp conveyor /var/run/conveyor
# Set proper permissions for any existing lock files
chgrp conveyor /var/run/conveyor/* >/dev/null 2>&1 || true
chown conveyor /var/run/conveyor/* >/dev/null 2>&1 || true
chmod 0644 /var/run/conveyor/* >/dev/null 2>&1 || true
# Create and set permissions for /var/log/conveyor
mkdir -p -m 3777 /var/log/conveyor
chmod g+w /var/log/conveyor
chgrp conveyor /var/log/conveyor
# Set proper permissions for any existing log files
chgrp conveyor /var/log/conveyor/* >/dev/null 2>&1 || true
chown conveyor /var/log/conveyor/* >/dev/null 2>&1 || true
chmod 0664 /var/log/conveyor/* >/dev/null 2>&1 || true
echo -e "Changing /run/lock's permissions. Setting g+w"
chmod g+w /run/lock
gpasswd -a conveyor root
chown /var/log/conveyor/conveyord.log
## Enable and start conveyor service
msg2 "Enable and start conveyor.service to be able to connect to printer\n #~ systemctl enable conveyor.service && systemctl start conveyor.service"
}
post_upgrade() {
chown conveyor /var/log/conveyor/conveyord.log
msg2 "Please restart conveyor.service with\n #~ systemctl restart conveyor.service"
}
|