summaryrefslogtreecommitdiff
path: root/build-support/disabled/java/bin32-jdk7/bin32-jdk7.install
blob: 7e849cbbbd92916cb3e36f91c330d58a533bb853 (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
THIS_JAVA='java32-7-jdk'
NAME='32-bit JDK 7'

all_off="$(tput sgr0)"
bold="${all_off}$(tput bold)"
blue="${bold}$(tput setaf 4)"
yellow="${bold}$(tput setaf 3)"

note() {
    printf "${blue}::${yellow} archlinux-java32:${bold} $1${all_off}\n"
}

update_desktop() {
    update-desktop-database -q
    update-mime-database /usr/share/mime >/dev/null
    xdg-icon-resource forceupdate &>/dev/null
}

post_install() {
    default=$(archlinux-java32 get)
    case ${default} in
        "")
            archlinux-java32 set ${THIS_JAVA}
            note "${NAME} ('${THIS_JAVA}') set as default Java environment."
            ;;
        ${THIS_JAVA})
            note "${NAME} ('${THIS_JAVA}') set as default Java environment."
            ;;
        *)
            note "Default Java environment already set to '${default}'.
                     To use ${NAME} ('${THIS_JAVA}'), run:
                       # archlinux-java32 set ${THIS_JAVA}
                     For status, use:
                       $ archlinux-java32 status"
            ;;
    esac

    if [[ ! -f /etc/ssl/certs/java/cacerts ]]; then
        update-ca-trust
    fi

    update_desktop
}

post_upgrade() {
    post_install
}

pre_remove() {
    default=$(archlinux-java32 get)
    if [[ ${default} = ${THIS_JAVA} ]]; then
        archlinux-java32 unset
    fi
}

post_remove() {
    default=$(archlinux-java32 get) # reassign
    if [[ ${default} ]]; then
        note "Default Java environment is '${default}'."
    else
        archlinux-java32 fix
        default=$(archlinux-java32 get) # re-reassign
        if [[ ${default} ]]; then
            note "Default Java environment left as '${default}'."
        else
            note "Java environment unset."
        fi
    fi

    update_desktop
}