diff options
Diffstat (limited to 'build-support/disabled/java/bin32-jdk7/bin32-jdk7.install')
-rw-r--r-- | build-support/disabled/java/bin32-jdk7/bin32-jdk7.install | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/build-support/disabled/java/bin32-jdk7/bin32-jdk7.install b/build-support/disabled/java/bin32-jdk7/bin32-jdk7.install new file mode 100644 index 00000000..7e849cbb --- /dev/null +++ b/build-support/disabled/java/bin32-jdk7/bin32-jdk7.install @@ -0,0 +1,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 +} |