source: oracle-java7-installer/trunk/fuentes/debian/oracle-java7-installer.preinst @ 627

Last change on this file since 627 was 627, checked in by jrpelegrina, 4 years ago

First release to xenial

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7license=oracle-license-v1-1
8
9errmsg()
10{
11        echo >&2 ''
12        echo >&2 "$@"
13        echo >&2 "try 'dpkg-reconfigure debconf' to select a frontend other than noninteractive"
14        echo >&2 ''
15}
16
17db_get shared/accepted-$license
18if [ "$RET" = "true" ]; then
19        echo "$license license has already been accepted" >&2
20        exit 0
21fi
22
23# facilitate backup capability per debconf-devel(7)
24STATE=1
25while true; do
26        case "$STATE" in
27        0) # Ensure going back from license presentment is harmless
28                STATE=1 
29                continue
30        ;;
31        1) # Present license
32                db_fset shared/present-$license seen false
33                if ! db_input critical shared/present-$license; then
34                        errmsg "$license license could not be presented"
35                        exit 2
36                fi
37                db_fset shared/accepted-$license seen false
38                if ! db_input critical shared/accepted-$license; then
39                        errmsg "$license agree question could not be asked"
40                        exit 2
41                fi
42        ;;
43        2) # Determine users' choice
44                db_get shared/accepted-$license
45                if [ "$RET" = "true" ]; then
46                        # License accepted
47                        exit 0
48                fi
49                # Error on decline license (give user chance to back up)
50                db_input critical shared/error-$license
51        ;;     
52        3) # User has confirmed declining license
53                echo "user did not accept the $license license" >&2
54                exit 1
55        ;;
56        *) # Unknown state
57                echo "$license license state unknown: $STATE" >&2
58                exit 2
59        ;;
60        esac
61        if db_go; then
62                STATE=$(($STATE + 1))
63        else
64                STATE=$(($STATE - 1))
65        fi
66done
67 
68#DEBHELPER#
69
70# proper exit (0 or 1) above
71errmsg "$license license could not be presented / was not accepted"
72exit 2
Note: See TracBrowser for help on using the repository browser.