[xorg-commit-diffs] xc/packager/mozilla_xpi Imakefile, NONE,
1.1.2.1 K98xprint_xpi.sh, NONE, 1.1.2.1 S98xprint_xpi.sh, NONE,
1.1.2.1 install.js, NONE, 1.1.2.1 make_mozilla_xpi.sh, NONE, 1.1.2.1
Roland Mainz
xorg-commit at pdx.freedesktop.org
Mon Apr 12 20:16:36 PDT 2004
Committed by: gisburn
Update of /cvs/xorg/xc/packager/mozilla_xpi
In directory pdx:/tmp/cvs-serv9732/xc/packager/mozilla_xpi
Added Files:
Tag: XPRINT
Imakefile K98xprint_xpi.sh S98xprint_xpi.sh install.js
make_mozilla_xpi.sh
Log Message:
Fix for http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=462 - RFE: Merge xprint.mozdev.org Xprint enhancements into Xorg XPRINT branch
--- NEW FILE: Imakefile ---
XCOMM $Xorg: Imakefile,v 1.1 2003/01/20 19:54:53 gisburn Exp $
#if BuildMozillaXprintXPIPackage
make_mozilla_xpi::
XPRINTDIR=$(XPRINTDIR) XBINDIR=$(BINDIR) XTOP=$(TOP) ; \
export XPRINTDIR XBINDIR XTOP ; \
/bin/ksh -e ./make_mozilla_xpi.sh
clean::
$(RM) mozilla_xprint_xpi.xpi
#endif /* BuildMozillaXprintXPIPackage */
--- NEW FILE: K98xprint_xpi.sh ---
echo "# Stopping Xprint server"
if [ -z "${MOZ_USER_DIR}" ] ; then
echo "Internal error: MOZ_USER_DIR not set."
exit 1
fi
# Make sure we pick the right binary - users may share one profile
# between different architectures
uname_os="`uname -s`"
uname_cpu="`uname -p 2>/dev/null`" # uname -p may fail on old Debian
if [ "${uname_cpu}" = "unknown" -o "${uname_cpu}" = "" ] ; then
uname_cpu="`uname -m`"
fi
MOZXPSTARTSCRIPT="${HOME}/${MOZ_USER_DIR}/xprint_xpi/${uname_os}_${uname_cpu}/run_xprint_from_tarball.sh"
if [ -f "${MOZXPSTARTSCRIPT}" ] ; then
/bin/sh "${MOZXPSTARTSCRIPT}" stop
fi
echo "# Done."
--- NEW FILE: S98xprint_xpi.sh ---
echo "# Starting Xprint server"
if [ -z "${MOZ_USER_DIR}" ] ; then
echo "Internal error: MOZ_USER_DIR not set."
moz_startstop_addon_scripts stop
exit 1
fi
# Make sure we pick the right binary - users may share one profile
# between different architectures
uname_os="`uname -s`"
uname_cpu="`uname -p 2>/dev/null`" # uname -p may fail on old Debian
if [ "${uname_cpu}" = "unknown" -o "${uname_cpu}" = "" ] ; then
uname_cpu="`uname -m`"
fi
MOZXPSTARTSCRIPT="${HOME}/${MOZ_USER_DIR}/xprint_xpi/${uname_os}_${uname_cpu}/run_xprint_from_tarball.sh"
if [ -f "${MOZXPSTARTSCRIPT}" ] ; then
echo "# Starting Xprint server"
/bin/sh "${MOZXPSTARTSCRIPT}" start
echo "# Populating XPSERVERLIST"
XPSERVERLIST="`/bin/sh "${MOZXPSTARTSCRIPT}" get_xpserverlist`"
export XPSERVERLIST
echo "XPSERVERLIST=${XPSERVERLIST}"
if [ -z "${XPSERVERLIST}" ] ; then
echo "Fatal error: XPSERVERLIST empty."
moz_startstop_addon_scripts stop
exit 1
fi
else
echo "# Warning: No Xprint XPI start script found for \"${uname_os}_${uname_cpu}\"."
fi
echo "# Done."
--- NEW FILE: install.js ---
// Install script for Xprint XPI
var err;
var regname="xprint";
var version="20040214";
err = initInstall("XprintXPI v0.0.2", // name for install UI
regname, // registered name
version); // package version
logComment("initInstall: " + err);
logComment("# Main start.");
doXpXPIInstall();
logComment("# Main done.");
function doXpXPIInstall()
{
var srDest = 16384; // Disk space required for installation (KB)
var fProgram = getFolder("Program");
var fComponents = getFolder("Components");
var userProfileBaseDir = getUserProfileBaseDir();
logComment("# fProgram: '" + fProgram + "'.");
logComment("# fComponents: '" + fComponents + "'.");
logComment("# userProfileBaseDir: '" + userProfileBaseDir + "'.");
/* Test whether Xprint's client side module was compiled-in (this is the
* default for Mozilla builds, but Red Hat has turned it off... ;-( ) */
var libgfxxprintPath = getFolder(fComponents, "libgfxxprint.so");
logComment("# Checking whether '" + libgfxxprintPath + "' exists.");
if (!File.exists(libgfxxprintPath)) {
logComment("# libgfxxprint.so missing");
alert("It seems that your version of Mozilla was build with --disable-xprint\n" +
"which means the Xprint client support was EXPLICITLY TURNED OFF at build time.\n" +
"Please contact the creator of the Mozilla package to provide a build where this flag was not set.");
cancelInstall(ACCESS_DENIED);
return;
}
/* Test whether we're running mozilla or something else */
logComment("# Checking application type exists.");
var is_mozilla = File.exists(getFolder(fProgram, "mozilla-bin"));
var is_firefox = File.exists(getFolder(fProgram, "firefox-bin")) || File.exists(getFolder(fProgram, "firebird-bin"));
var is_thunderbird = File.exists(getFolder(fProgram, "thunderbird-bin"));
if ( (!is_mozilla) && (!is_firefox) && (!is_thunderbird)) {
logComment("# unknown application type");
alert("This XPI currently only supports Mozilla, FirdBird and ThunderBird.\n" +
"Please contact file a bug at http://xprint.mozdev.org if you see this error.");
cancelInstall(ACCESS_DENIED);
return;
}
/* Test whether this mozilla supports pluggable shell scripts */
var init_d_readme_path = getFolder(fProgram, "init.d/README");
logComment("# Checking whether '" + init_d_readme_path + "' exists.");
if (!File.exists(init_d_readme_path)) {
logComment("# init_d_readme_path missing");
if (is_firefox) {
alert("Your version of FireFox does not support pluggable shell scripts.\n" +
"You need at least FireFox 0.9 (or later).");
}
else if (is_thunderbird) {
alert("Your version of ThunderBird does not support pluggable shell scripts.\n" +
"You need at least ThunderBird 0.6 (or later).");
}
else
{
alert("Your version of Mozilla does not support pluggable shell scripts.\n" +
"You need at least Mozilla 1.7a (or later).");
}
cancelInstall(ACCESS_DENIED);
return;
}
/* Verify available disk space */
if (!verifyDiskSpace(fProgram, srDest)) {
logComment("# verifyDiskSpace failure.");
cancelInstall(INSUFFICIENT_DISK_SPACE);
return;
}
/* Add the files which should be installed */
logComment("# addDirectory sequence begin.");
addDirectory(regname, version, "xprint_xpi", userProfileBaseDir, "xprint_xpi", true);
addDirectory(regname, version, "init.d", userProfileBaseDir, "init.d", true);
logComment("# addDirectory sequence end.");
err = getLastError();
if (err == ACCESS_DENIED) {
logComment("# ACCESS_DENIED");
alert("Unable to write to directory " + userProfileBaseDir + ".\n" +
"You will need to restart the browser with administrator/root " +
"privileges to install this software." +
"After installing as root (or administrator), " +
"you will need to restart the browser one more time to " +
"register the installed software.\n After the second restart, " +
"you can go back to running the browser without privileges!");
logComment("# cancelInstall(), ACCESS_DENIED");
cancelInstall(ACCESS_DENIED);
return;
}
else if (err != SUCCESS) {
logComment("# cancelInstall(), err=" + err);
cancelInstall(err);
return;
}
logComment("# performInstall()");
performInstall();
}
// this function verifies disk space in kilobytes
function verifyDiskSpace(dirPath, spaceRequired) {
var spaceAvailable;
// Get the available disk space on the given path
spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
// Convert the available disk space into kilobytes
spaceAvailable = parseInt(spaceAvailable / 1024);
// do the verification
if(spaceAvailable < spaceRequired) {
logComment("Insufficient disk space: " + dirPath);
logComment(" required : " + spaceRequired + " K");
logComment(" available: " + spaceAvailable + " K");
return false;
}
return true;
}
function getUserProfileBaseDir()
{
var userPofileBaseDir;
logComment("# getUserProfileBaseDir");
userPofileBaseDir = getFolder("Profile", "../..");
logComment("# getUserProfileBaseDir='" + userPofileBaseDir + "'");
return userPofileBaseDir;
}
/* EOF. */
--- NEW FILE: make_mozilla_xpi.sh ---
#!/bin/ksh
# Set search path for commands
export PATH=/usr/xpg4/bin:/usr/sbin:/usr/bin:/bin:/sbin
set -x
set -e
#XPRINTDIR=/usr/openwin/server/etc/XpConfig/
#XBINDIR=/usr/openwin/bin
PKG_NAME="mozilla_xprint_xpi"
PKG_FILES="/tmp/tmp_${PKG_NAME}"
if [ "${XPRINTDIR}" = "" ] ; then
echo "$0: Error: XPRINTDIR not set"
exit 1
fi
if [ "${XBINDIR}" = "" ] ; then
echo "$0: Error: XBINDIR not set"
exit 1
fi
# Do not edit
# REL_* vars are paths relative to '/'
# Thanks to the "wonders" of some /bin/sh I cannot use ...
# REL_XPRINTDIR=${XPRINTDIR#*/}
# REL_XBINDIR=${XBINDIR#*/}
# ... ;-(
REL_XPRINTDIR="`echo ${XPRINTDIR} | sed 's/\///'`"
REL_XBINDIR="`echo ${XBINDIR} | sed 's/\///'`"
#### Main
# Create and test tarball of files which should be in the final RPM...
if true ; then
echo "###### Fetching files from build dir..."
(
# Go to xc/packager/tarball
cd ../tarball
# ${XPDESTTARFILE} is used by "make make_xprint_tarball"
export XPDESTTARFILE="/tmp/xprint_pkg_`date +%y%m%d%H%M%S`.tar.gz"
make make_xprint_tarball
# Check if the temp. tarball was being build
if [ ! -f "${XPDESTTARFILE}" ] ; then
echo "# temp. tarball missing."
exit 1
fi
# ... and then unpack the temp. tarball in the ${PKG_FILES} dir
[ -d "${PKG_FILES}" ] && rm -Rf "${PKG_FILES}"
mkdir "${PKG_FILES}"
cd "${PKG_FILES}"
gunzip -c ${XPDESTTARFILE} | tar -xf -
rm -f ${XPDESTTARFILE}
cd xprint/install
# Remove old ReadMe
rm -f ${REL_XPRINTDIR}/README
# Remove docs we do not need in the XPI
rm -Rf usr/X11R6/man
)
fi
echo "###### Building pkgproto file..."
# Make sure we pick the right binary - users may share one profile
# between different architectures
uname_os="`uname -s`"
uname_cpu="`uname -p 2>/dev/null`" # uname -p may fail on old Debian
if [ "${uname_cpu}" = "unknown" -o "${uname_cpu}" = "" ] ; then
uname_cpu="`uname -m`"
fi
XPIDIR="${PKG_FILES}/xpi"
echo "XPIDIR=${XPIDIR}."
mkdir -p "${XPIDIR}/xprint_xpi"
mkdir -p "${XPIDIR}/xprint_xpi/${uname_os}_${uname_cpu}"
(
cd "${XPIDIR}/xprint_xpi"
# FixME: Need softlinks for all compatible |uname_cpu| types
case "${uname_cpu}" in
"i386" | "i486" | "i586" | "i686" | "x86_64" )
[ ! -d "${uname_os}_i386" ] && ln -s "${uname_os}_${uname_cpu}" "${uname_os}_i386"
[ ! -d "${uname_os}_i486" ] && ln -s "${uname_os}_${uname_cpu}" "${uname_os}_i486"
[ ! -d "${uname_os}_i586" ] && ln -s "${uname_os}_${uname_cpu}" "${uname_os}_i586"
[ ! -d "${uname_os}_i686" ] && ln -s "${uname_os}_${uname_cpu}" "${uname_os}_i686"
[ ! -d "${uname_os}_x86_64" ] && ln -s "${uname_os}_${uname_cpu}" "${uname_os}_x86_64"
;;
esac
)
mkdir -p "${XPIDIR}/init.d"
mv "${PKG_FILES}/xprint"/* "${XPIDIR}/xprint_xpi/${uname_os}_${uname_cpu}/."
cp "K98xprint_xpi.sh" "${XPIDIR}/init.d/."
cp "S98xprint_xpi.sh" "${XPIDIR}/init.d/."
chmod a+rx "${XPIDIR}/init.d"/*.sh
cp "install.js" "${XPIDIR}/."
echo "###### Making package..."
echo "#### zip..."
(
OLDPWD="${PWD}"
cd "${XPIDIR}"
zip -r -y -9 "${OLDPWD}/${PKG_NAME}.xpi" .
)
#echo "###### Cleaning up..."
rm -rf "${PKG_FILES}"
echo "###### Package done:"
ls -lad "${PKG_NAME}.xpi"
echo "###### Done."
exit 0
#
More information about the xorg-commit-diffs
mailing list