I think this a very good idea which solves a usibility issue. The suggested solution is simple.
Here is my version of the script:
#!/usr/bin/env sh
#
# A simple placeholder script for a missing java installation.
# Copyright (c) 2013, Florian R. A. Angermeier
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the OpenPandora Project nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL FLORIAN R. A. ANGERMEIER BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if [[ -z "${DISPLAY-}" ]]; then
fmt_std="\e[0m"
fmt_bold="\e[1m"
printf "You have currently not installed the ${fmt_bold}Java™ runtime environment${fmt_std}.\n"
printf "Please install it via the appropriate PND.\n\n"
printf "The PND can be found here:\n"
printf "${fmt_bold}http://repo.openpandora.org/?page=detail&app=java${fmt_std}\n\n"
printf "Please follow the installation instructions there.\n"
else
text="You have currently not installed the <i>Java™ runtime environment</i>.\n"
text+="Please install it via the appropriate PND.\n\n"
text+="The PND can be found here:\n"
text+="<i>http://repo.openpandora.org/?page=detail&app=java</i>\n\n"
text+="Please follow the installation instructions there."
zenity --title "Java™ runtime environment" \
--info --text "${text}" --no-wrap
fi
Screenshots:
Terminal (only if no display is available; for demonstration I have passed by the check)
GUI
The link can be selected and copied to the clipboard.
I have added a license header (
New BSD License). If it is not necessary for shell/bash scripts just drop it.
EDIT 1: What should be the <organization>?
EDIT 2: I have used "OpenPandora Project" for the <organization> placeholder. If another name is wished let me know.