forked from Kicksecure/sdwdate
/
sdwdate.postinst
73 lines (55 loc) · 2.27 KB
/
sdwdate.postinst
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
73
#!/bin/bash
## This file is part of Whonix.
## Copyright (C) 2012 - 2014 Patrick Schleizer <adrelanos@riseup.net>
## See the file COPYING for copying conditions.
if [ -f /usr/lib/pre.bsh ]; then
source /usr/lib/pre.bsh
fi
set -e
true "
#####################################################################
## INFO: BEGIN: $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME ${1+"$@"}
#####################################################################
"
if [ -x /usr/lib/anon-shared-helper-scripts/torsocks-remove-ld-preload ]; then
source /usr/lib/anon-shared-helper-scripts/torsocks-remove-ld-preload
fi
case "$1" in
configure)
## Not using --no-create-home, so sdwdate can write into /home/sdwdate.
adduser --quiet --system --group sdwdate || true
mkdir --parents "/var/cache/sdwdate/sclockadj"
chown --recursive root:root "/var/cache/sdwdate/sclockadj"
chmod --recursive 700 "/var/cache/sdwdate/sclockadj"
## Clean up from previous version.
rm -f -r "/var/cache/sdwdate/.ruby_inline"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "$DPKG_MAINTSCRIPT_NAME called with unknown argument \`$1'" >&2
exit 1
;;
esac
## workaround for 'dh_installinit should run systemd-tmpfiles if a
## /usr/lib/tmpfiles.d/ snippet gets shipped for systemd-only packages
## also' - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795519
# In case this system is running systemd, we need to ensure that all
# necessary tmpfiles (if any) are created before starting.
if [ -d /run/systemd/system ] ; then
systemd-tmpfiles --create /usr/lib/tmpfiles.d/sdwdate.conf >/dev/null || true
fi
service systemd-timesyncd stop >/dev/null 2>&1 || true
## Deletes /etc/system/sysinit.target.wants/systemd-timesyncd.service.
## Otherwise timedatectl still thinks systemd-timesyncd is enabled.
timedatectl set-ntp false >/dev/null 2>&1 || true
true "INFO: debhelper beginning here."
#DEBHELPER#
true "INFO: Done with debhelper."
true "
#####################################################################
## INFO: END : $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME ${1+"$@"}
#####################################################################
"
## Explicitly "exit 0", so eventually trapped errors can be ignored.
exit 0