Bug 230598 - add solaris patch-checker patch by roland.mainz@nrubsig.org r=leon.sha@sun.com sr=bz moa=me Landing new files first.
git-svn-id: svn://10.0.0.236/trunk@152595 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
51
mozilla/xpfe/bootstrap/init.d/Makefile.in
Normal file
51
mozilla/xpfe/bootstrap/init.d/Makefile.in
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Roland Mainz <roland.mainz@nrubsig.org>
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = apprunner
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Solaris
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
# Install Solaris patch checker scripts
|
||||
libs:: moz_patch_checker.dtksh
|
||||
$(INSTALL) $(IFLAGS1) $< $(DIST)/bin
|
||||
install:: moz_patch_checker.dtksh
|
||||
$(SYSINSTALL) $(IFLAGS2) $< $(DESTDIR)$(bindir)
|
||||
|
||||
libs:: S02solaris_patchchecker.sh
|
||||
$(INSTALL) $(IFLAGS1) $< $(DIST)/bin/init.d
|
||||
install:: S02solaris_patchchecker.sh
|
||||
$(SYSINSTALL) $(IFLAGS2) $< $(DESTDIR)$(bindir)/init.d
|
||||
endif
|
||||
|
||||
libs:: README
|
||||
$(INSTALL) $< $(DIST)/bin/init.d
|
||||
install:: README
|
||||
$(SYSINSTALL) $(IFLAGS2) $< $(DESTDIR)$(bindir)/init.d
|
||||
|
||||
34
mozilla/xpfe/bootstrap/init.d/README
Normal file
34
mozilla/xpfe/bootstrap/init.d/README
Normal file
@@ -0,0 +1,34 @@
|
||||
mozilla/xpfe/bootstrap/init.d/README
|
||||
|
||||
This file describes the mechanism for installing and executing
|
||||
initialization and termination scripts used to implement pluggable
|
||||
shell scripts to modify the behaviour of Mozilla/FireFox/ThunderBird/SunBird.
|
||||
|
||||
File names in the mozilla/init.d/ and %user_profile%/init.d/
|
||||
(for example ${HOME}/.mozilla/init.d/ for Mozilla) are of the form
|
||||
[SK]nn<filename> where 'S' means "run this script at application startup",
|
||||
'K' means "run this script at application termination", and 'nn' is the
|
||||
sequence number for killing or starting the job.
|
||||
When the application (e.g. Mozilla) starts scripts prefixed with 'S' are
|
||||
executed (first those in Mozilla's installation directory, then those in
|
||||
user's profile directory), on termination those scripts prefixed with 'K'
|
||||
are being executed (first those in user's profile dir, finally those in
|
||||
mozilla's installation directory).
|
||||
|
||||
When executing each script a single argument is passed to it - argument
|
||||
'stop' for scripts prefixed with 'K' and the argument 'start' for scripts
|
||||
prefixed with 'S'.
|
||||
|
||||
An exception of this rule are scripts with the suffix *.sh - they are called
|
||||
"inline" in the current shell process which starts/terminates Mozilla. These
|
||||
scripts have FULL ACCESS to all variables of the calling script (which means
|
||||
these scripts can set/modify/unset environment variables used by Mozilla).
|
||||
Since these scripts run in the same shell the author of such scripts should
|
||||
ensure that no namespace collisions occur (e.g. accidential modify variable
|
||||
names used by the parent script).
|
||||
|
||||
Any files which do not match the [SK][0-9][0-9]* pattern are FORBIDDEN
|
||||
in ${HOME}/.mozilla/init.d/ and %user_profile%/init.d/. The only
|
||||
exception is this README file.
|
||||
|
||||
# EOF.
|
||||
68
mozilla/xpfe/bootstrap/init.d/S02solaris_patchchecker.sh
Normal file
68
mozilla/xpfe/bootstrap/init.d/S02solaris_patchchecker.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
# S02solaris_patchchecker.sh
|
||||
# Note: This script is called "inline" by the "mozilla" shell script.
|
||||
|
||||
moz_spc_fatal_error()
|
||||
{
|
||||
echo "$0: Solaris patch checker error: $1"
|
||||
moz_startstop_addon_scripts "stop"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# This is only for debugging purposes.
|
||||
moz_spc_verbose_echo()
|
||||
{
|
||||
# echo "$1"
|
||||
:
|
||||
}
|
||||
|
||||
moz_spc_verbose_echo "# patchchecker running."
|
||||
if [ "`uname -s`" = "SunOS" -a "${MOZILLA_SOLARIS_PATCHCHECKER}" != "disable_patchchecker" ] ; then
|
||||
moz_spc_verbose_echo "# Solaris"
|
||||
|
||||
# Prechecks
|
||||
if [ -z "${dist_bin}" ] ; then
|
||||
moz_spc_fatal_error "dist_bin not set."
|
||||
fi
|
||||
if [ -z "${MOZ_USER_DIR}" ] ; then
|
||||
moz_spc_fatal_error "MOZ_USER_DIR not set."
|
||||
fi
|
||||
if [ ! -x "${dist_bin}/moz_patch_checker.dtksh" ] ; then
|
||||
moz_spc_fatal_error "Patch checker script ${dist_bin}/moz_patch_checker.dtksh not found or not executable."
|
||||
fi
|
||||
|
||||
# Generate a "key" which is (more or less) unique for each single mozilla installation
|
||||
keyfiledir="${HOME}/${MOZ_USER_DIR}"
|
||||
keyfile="${keyfiledir}/solaris_patchchecker_keys.txt"
|
||||
moz_spc_verbose_echo "# keyfile=$keyfile"
|
||||
key1="`uname -n`:${dist_bin}" # host and path of mozilla
|
||||
key2="`ls -la ${dist_bin} | sum | tr -d ' '`" # file names and time stamps
|
||||
key="spckey=${key1};${key2}"
|
||||
moz_spc_verbose_echo "# key=$key"
|
||||
|
||||
# Check whether we checked the patches for this installation
|
||||
if [ "`([ -r "${keyfile}" ] && cat "${keyfile}") | fgrep "${key}"`" != "" ] ; then
|
||||
moz_spc_verbose_echo "# match found in ${keyfile}"
|
||||
else
|
||||
moz_spc_verbose_echo "# no match found in ${keyfile}"
|
||||
|
||||
# Run patch checker
|
||||
${dist_bin}/moz_patch_checker.dtksh
|
||||
spc_exitcode=$?
|
||||
|
||||
if [ ${spc_exitcode} -eq 0 ] ; then
|
||||
moz_spc_verbose_echo "# Patch checker returned OK, caching result"
|
||||
mkdir -p "${keyfiledir}"
|
||||
if [ ! -f "${keyfile}" ] ; then
|
||||
echo >"${keyfile}" "# Solaris patch checker 'key' file"
|
||||
echo >>"${keyfile}" "# This script is for private use of the Mozilla patch checker for Solaris"
|
||||
fi
|
||||
echo "${key}" >>"${keyfile}"
|
||||
else
|
||||
echo "# Patch checker failure. Please apply the missing Solaris patches."
|
||||
moz_startstop_addon_scripts "stop"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
moz_spc_verbose_echo "# patchchecker done."
|
||||
# EOF.
|
||||
211
mozilla/xpfe/bootstrap/init.d/moz_patch_checker.dtksh
Normal file
211
mozilla/xpfe/bootstrap/init.d/moz_patch_checker.dtksh
Normal file
@@ -0,0 +1,211 @@
|
||||
#!/usr/dt/bin/dtksh
|
||||
#
|
||||
# Solaris patch checker script
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Roland Mainz <roland.mainz@nrubsig.org>
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
export PATH=/usr/xpg4/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# Enumerate installed patches
|
||||
enumerate_patch_list()
|
||||
{
|
||||
showrev -p | grep "^Patch: "
|
||||
#cat patchlist.txt | grep "^Patch: "
|
||||
}
|
||||
|
||||
# Setup list of required patches
|
||||
typeset -A required_patches
|
||||
case "$(uname -p)" in
|
||||
"sparc")
|
||||
case "$(uname -r)" in
|
||||
# Solaris 2.7/SPARC
|
||||
"5.7")
|
||||
required_patches=(
|
||||
[0]="106950-24" [0_title]="SunOS 5.7: linker patch"
|
||||
[1]="106327-21" [1_title]="32-Bit Shared library patch for C++"
|
||||
[2]="106300-22" [2_title]="64-Bit Shared library patch for C++"
|
||||
[3]="108376-44" [3_title]="OpenWindows 3.6.1: Xsun Patch"
|
||||
[4]="107650-08" [4_title]="OpenWindows 3.6.1 X11R6.4 Xprint Extension Patch"
|
||||
[5]="107636-10" [5_title]="SunOS 5.7: X Input & Output Method patch"
|
||||
[6]="112689-02" [6_title]="SunOS 5.7: UTF-8 locale ICONV patch"
|
||||
)
|
||||
num_required_patches=7
|
||||
;;
|
||||
|
||||
# Solaris 2.8/SPARC
|
||||
"5.8")
|
||||
required_patches=(
|
||||
[0]="109147-27" [0_title]="SunOS 5.8: linker patch"
|
||||
[1]="108434-14" [1_title]="32-Bit Shared library patch for C++"
|
||||
[2]="108435-14" [2_title]="64-Bit Shared library patch for C++"
|
||||
[3]="108773-18" [3_title]="SunOS 5.8: IIIM and X Input & Output Method patch"
|
||||
[4]="108652-77" [4_title]="X11 6.5.1: Xsun patch"
|
||||
)
|
||||
num_required_patches=5
|
||||
;;
|
||||
|
||||
# Solaris 2.9/SPARC
|
||||
"5.9")
|
||||
required_patches=(
|
||||
[0]="112963-10" [0_title]="SunOS 5.9: linker patch"
|
||||
[1]="111711-08" [1_title]="32-Bit Shared library patch for C++"
|
||||
[2]="111712-08" [2_title]="64-Bit Shared library patch for C++"
|
||||
[3]="112661-06" [3_title]="SunOS 5.9: IIIM and X Input & Output Method patch"
|
||||
[4]="112785-30" [4_title]="X11 6.6.1: Xsun patch"
|
||||
)
|
||||
num_required_patches=5
|
||||
;;
|
||||
*)
|
||||
echo "# WARNING: Patch checker not supported for $(uname -s)."
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
# FixMe: Need support for Solaris/{x86,x86-64}
|
||||
*)
|
||||
echo "# WARNING: Patch checker not supported for $(uname -p)."
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
typeset -A patchmap
|
||||
|
||||
# Fill patchmap
|
||||
enumerate_patch_list | while read i1 i2 i3 ; do
|
||||
patch_id="${i2%-*}"
|
||||
patch_rev="${i2#*-}"
|
||||
patchmap[${patch_id}]="${patch_rev}"
|
||||
done
|
||||
|
||||
# Check patch requirements against the list of installed patches and
|
||||
# print out missing patches ...
|
||||
missing_patches_msg="$(
|
||||
count=0
|
||||
while [ ${count} -lt ${num_required_patches} ] ; do
|
||||
req_patch_id="${required_patches[${count}]%-*}"
|
||||
req_patch_rev="${required_patches[${count}]#*-}"
|
||||
|
||||
if [ "${patchmap[${req_patch_id}]}" = "" ] ; then
|
||||
echo "- patch ${req_patch_id} (\"${required_patches[${count}_title]}\"). Install ${required_patches[${count}]} (or higher)."
|
||||
fi
|
||||
|
||||
count=$((${count} + 1))
|
||||
done
|
||||
)"
|
||||
|
||||
# ... and then the patches which need updates:
|
||||
low_rev_patches_msg="$(
|
||||
count=0
|
||||
while [ ${count} -lt ${num_required_patches} ] ; do
|
||||
req_patch_id="${required_patches[${count}]%-*}"
|
||||
req_patch_rev="${required_patches[${count}]#*-}"
|
||||
|
||||
if [ "${patchmap[${req_patch_id}]}" != "" ] ; then
|
||||
if [ ${req_patch_rev} -gt ${patchmap[${req_patch_id}]} ] ; then
|
||||
echo "- patch ${required_patches[${count}]} (or higher), currently installed patch ${req_patch_id}-${patchmap[${req_patch_id}]} (\"${required_patches[${count}_title]}\")."
|
||||
fi
|
||||
fi
|
||||
|
||||
count=$((${count} + 1))
|
||||
done
|
||||
)"
|
||||
|
||||
# Build message text
|
||||
display_warning=false
|
||||
# Intro...
|
||||
msg=" \
|
||||
One or more of the following Solaris patches are missing in your OS which are requirements to run Mozilla.\n \
|
||||
Please contact your system adminstrator to install these patches. \n \
|
||||
"
|
||||
# ... missing patches ...
|
||||
if [ "${missing_patches_msg}" != "" ] ; then
|
||||
msg="$(printf "%s\n%s\n%s\n " "${msg}" "* The following patches are not installed:" "${missing_patches_msg}")"
|
||||
display_warning=true
|
||||
fi
|
||||
# ... and the too old ones ...
|
||||
if [ "${low_rev_patches_msg}" != "" ] ; then
|
||||
msg="$(printf "%s\n%s\n%s\n " "${msg}" "* The following patches need to be updated to higher revisions:" "${low_rev_patches_msg}")"
|
||||
display_warning=true
|
||||
fi
|
||||
|
||||
# Do we really need to display the dialog ?
|
||||
if [ "${display_warning}" = "false" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Display warning dialog
|
||||
dismissCB()
|
||||
{
|
||||
exit 0
|
||||
}
|
||||
|
||||
exitCB()
|
||||
{
|
||||
exit 1
|
||||
}
|
||||
|
||||
XtInitialize TOPLEVEL moz_patch_error MozPatchError "$@"
|
||||
|
||||
XmCreateMessageBox MISSING_PATCHES_DIALOG ${TOPLEVEL} missing_patches_dialog \
|
||||
messageString:"${msg}" \
|
||||
dialogTitle:"Mozilla patch checker" \
|
||||
okLabelString:"Ignore problem and start Mozilla" \
|
||||
cancelLabelString:"Exit" \
|
||||
dialogType:DIALOG_ERROR
|
||||
XmMessageBoxGetChild CANCEL_BUTTON ${MISSING_PATCHES_DIALOG} DIALOG_CANCEL_BUTTON
|
||||
XmMessageBoxGetChild HELP_BUTTON ${MISSING_PATCHES_DIALOG} DIALOG_HELP_BUTTON
|
||||
|
||||
# Remove the unwanted help button
|
||||
XtUnmanageChild ${HELP_BUTTON}
|
||||
|
||||
XtAddCallback ${MISSING_PATCHES_DIALOG} okCallback dismissCB
|
||||
XtAddCallback ${MISSING_PATCHES_DIALOG} cancelCallback exitCB
|
||||
|
||||
XtDisplay DISP ${TOPLEVEL}
|
||||
XmInternAtom CLOSE_ATOM ${DISP} WM_DELETE_WINDOW false
|
||||
XmAddWMProtocolCallback ${TOPLEVEL} ${CLOSE_ATOM} exitCB
|
||||
|
||||
XtSetValues ${TOPLEVEL} deleteResponse:DO_NOTHING
|
||||
|
||||
XtManageChild ${MISSING_PATCHES_DIALOG}
|
||||
|
||||
XtRealizeWidget ${TOPLEVEL}
|
||||
|
||||
XtMainLoop
|
||||
|
||||
echo "# should not be hit."
|
||||
exit 255
|
||||
# EOF.
|
||||
Reference in New Issue
Block a user