File: postinst

package info (click to toggle)
rtlinux 3.1pre3-2
  • links: PTS
  • area: non-free
  • in suites: sarge, woody
  • size: 4,892 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (108 lines) | stat: -rw-r--r-- 4,037 bytes parent folder | download | duplicates (2)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#! /bin/sh
# postinst script for rtlinux
#
# see: dh_installdeb(1)

set -e
DOCDIR=/usr/share/doc/rtlinux
ORGDIR=rtlinux-3.1pre3

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

case "$1" in
    configure)
    rm -f /usr/src/rtlinux
    (cd /usr/src; ln -s $ORGDIR /usr/src/rtlinux)
    if [ ! -d $DOCDIR ] ; then
        echo "rtlinux: Error: Directory $DOCDIR does not exists"
        exit -1
    fi
    if [ ! -f /usr/bin/wget ] ; then
        echo "rtlinux: I cant find the \"wget\" program."
        echo "It is not possible to download de susv documentation."
        exit 0
    fi
    echo -e "\n The SUSV2 man pages can not be redistributed but can be"
    echo "\"downloaded for local installation and personal use only\""
    echo "from:  http://www.opengroup.org/onlinepubs/7908799/download/."
    echo "To avoid license problems, only root will be able to read them."
    echo -e "\n You need an Internet connection to download the SUSV2 man pages."
    echo "The size of the file to download is 1.8Mb."
    echo -ne "\nPress enter to read the license: "
    read dummy;
    zless $DOCDIR/README.susv.gz
    while : ;  do 
        echo -e "\nDo you agree with the lincense and want do donwnload it now ?"
        echo -n "[Y]es, [N]o, [R]ead license: "
        read response;
        case "$response" in
            [Yy]*)
                TMPFILE=$(mktemp /tmp/rtldoc.XXXXXX)
                if [ $? -ne 0 ]; then
                   echo "rtlinux: Can't create temp file, exiting..."
                   exit 1
                fi
                echo "Getting the file. It may take some time ..."
                if ! wget -t 5 -c http://www.opengroup.org/onlinepubs/7908799/download/susv2.tgz -O $TMPFILE ; then
                    echo "rtlinux: Error: Unable to download susv2 file."
                    echo "rtlinux: Check your network connection, and try to configure the package again.";
                    sleep 3;
                    exit 1;
                fi
                echo "Installing the documentation."
                tar zxf $TMPFILE -C $DOCDIR/html
                # Only the ROOT can browse this HTML files, in order to prevent Apache 
                # to let internet users to read /usr/share/doc directory. 
                # The default configuration of Apache is to allow clients to browse doc information.
                chown -R root:root $DOCDIR/html/susv2
                chmod -R 500 $DOCDIR/html/susv2
                rm -f $TMPFILE
                exit 0;
                ;;
            [Rr]*)
                zless $DOCDIR/README.susv.gz
                ;;
            [Nn]*)
                echo -e "\nOK, all the rtlinux documentation has been installed but susv2 html manpages."
                echo -e "Execute \"dpkg-reconfigure rtlinux\" to download them later.\n\n"
                sleep 2;
                exit 0;
                ;;
        esac
    done
    
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
        rm -f /tmp/rtldoc.*
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0