source: oracle-java8-installer/trunk/fuentes/debian/oracle-java8-installer.preinst @ 2122

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

First release to xenial

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