~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to debian/golang-go.postinst

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
# Load debconf variables
4
 
. /usr/share/debconf/confmodule
5
 
 
6
3
confdir=/etc/golang
7
4
conffile=$confdir/goinstall.conf
8
5
 
9
6
set -e
10
7
 
11
 
if [ -e $conffile ] ; then
12
 
    # Fetch current values.
13
 
    . $conffile
14
 
fi
15
 
 
16
 
# Get this setting from debconf.  It was set based on the content of
17
 
# /etc/golang/goinstall.conf in the 'config' script, so it should be
18
 
# safe to ignore the value fetched by loading the file above.  This
19
 
# should allow for using debconf to reconfigure the package.
20
 
db_get golang-go/dashboard || true
21
 
if [ "$RET" = "yes" ] || [ "$RET" = "YES" ] || [ "$RET" = "true" ]; then
22
 
    DASHBOARD="yes"
23
 
else
24
 
    DASHBOARD="no"
25
 
fi
26
 
 
27
 
generate_conffile() {
28
 
        if [ ! -d $confdir ]; then
29
 
                mkdir $confdir
30
 
        fi
31
 
        cat <<-EOF >$conffile
32
 
                # Config file for goinstall tool.
33
 
                #
34
 
                # To change this file, use:
35
 
                #        dpkg-reconfigure golang-go
36
 
                #
37
 
                # You can also edit it by hand, if you so choose.
38
 
                
39
 
                DASHBOARD="$DASHBOARD"
40
 
        EOF
41
 
 
42
 
        # Make sure user nobody can read the file.
43
 
        chmod a+r $conffile
44
 
}
 
8
. /usr/share/debconf/confmodule
 
9
 
 
10
# Cleanup old debconf dashboard question that was removed in golang-go 2:1.1
 
11
# -- 2013-05-14 stapelberg
 
12
db_purge
45
13
 
46
14
case "$1" in
47
15
    configure)
48
 
        if [ ! -e $conffile ]; then
49
 
            generate_conffile
50
 
        else
51
 
            # Replace only if the content changed, to avoid changing the
52
 
            # config file date when no change was done.
53
 
            sedopts=" \
54
 
                s/^DASHBOARD=.*$/DASHBOARD=\"$DASHBOARD\"/;   \
55
 
                "
56
 
            if sed "$sedopts" < $conffile > $conffile.new &&
57
 
                ! cmp $conffile $conffile.new > /dev/null; then
58
 
                mv $conffile.new $conffile
59
 
                # Make sure user nobody can read the file.
60
 
                chmod a+r $conffile
61
 
            else
62
 
                rm $conffile.new
63
 
            fi
 
16
        # Remove obsolete goinstall.conf.
 
17
        # -- 2013-05-14 stapelberg
 
18
        if [ -e $conffile ]; then
 
19
                rm -f $conffile
 
20
                rmdir /etc/golang || true
64
21
        fi
65
22
        # Very ugly hack to set timestamps same as /usr/bin/go
66
23
        find /usr/lib/go/pkg -exec touch -r /usr/bin/go {} \;