blob: 9ef65061521f5767eb33212f106bb2fb4204d78d (
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
|
#!/bin/sh
# Load debconf variables
. /usr/share/debconf/confmodule
confdir=/etc/golang
conffile=$confdir/goinstall.conf
set -e
if [ -e $conffile ] ; then
# Fetch current values.
. $conffile
fi
# Get this setting from debconf. It was set based on the content of
# /etc/golang/goinstall.conf in the 'config' script, so it should be
# safe to ignore the value fetched by loading the file above. This
# should allow for using debconf to reconfigure the package.
db_get golang-go/dashboard || true
if [ "$RET" = "yes" ] || [ "$RET" = "YES" ] || [ "$RET" = "true" ]; then
DASHBOARD="yes"
else
DASHBOARD="no"
fi
generate_conffile() {
if [ ! -d $confdir ]; then
mkdir $confdir
fi
cat <<-EOF >$conffile
# Config file for goinstall tool.
#
# To change this file, use:
# dpkg-reconfigure golang-go
#
# You can also edit it by hand, if you so choose.
DASHBOARD="$DASHBOARD"
EOF
# Make sure user nobody can read the file.
chmod a+r $conffile
}
case "$1" in
configure)
if [ ! -e $conffile ]; then
generate_conffile
else
# Replace only if the content changed, to avoid changing the
# config file date when no change was done.
sedopts=" \
s/^DASHBOARD=.*$/DASHBOARD=\"$DASHBOARD\"/; \
"
if sed "$sedopts" < $conffile > $conffile.new &&
! cmp $conffile $conffile.new > /dev/null; then
mv $conffile.new $conffile
# Make sure user nobody can read the file.
chmod a+r $conffile
else
rm $conffile.new
fi
fi
# Very ugly hack to set timestamps same as /usr/bin/go
find /usr/lib/go/pkg -exec touch -r /usr/bin/go {} \;
;;
*)
;;
esac
#DEBHELPER#
|