From 2cffab79b034ff55e536d50836477f02b39c10c0 Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 24 Aug 2005 23:39:15 +0000 Subject: [PATCH] started mpkg support git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1072 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- maintenance/make-osxmpkg.sh | 361 ++++++++++++++++++ maintenance/make-osxpkg.sh | 8 + maintenance/rm-sope-on-osxlib.sh | 2 + .../samples/CoreDataBlog/RSS10.wo/RSS10.wod | 3 +- 4 files changed, 373 insertions(+), 1 deletion(-) create mode 100755 maintenance/make-osxmpkg.sh diff --git a/maintenance/make-osxmpkg.sh b/maintenance/make-osxmpkg.sh new file mode 100755 index 00000000..52ffac82 --- /dev/null +++ b/maintenance/make-osxmpkg.sh @@ -0,0 +1,361 @@ +#!/bin/sh +# +# make-osxmpkg.sh +# +# Create a MacOSX Installer *multi* package for SOPE. +# + +PKG_NAME="$1" + +oldpwd="$PWD" +PKG_BUILD_DIR="$PWD/osxpkgbuild" +PKG_DIR="$PKG_BUILD_DIR/${PKG_NAME}.mpkg" +PKG_RSRC_DIR="$PKG_BUILD_DIR/${PKG_NAME}.mpkg/Contents/Resources" +PKG_VERSION="4.5" +ROOT_DIR="$PKG_BUILD_DIR/Packages" + +CHECK_XML="yes" +PLIST_DT_ID="-//Apple Computer//DTD PLIST 1.0//EN" +PLIST_DT_LOC="http://www.apple.com/DTDs/PropertyList-1.0.dtd" +INSTALLER_FORMAT_KEY="0.10000000149011612" + +BACKGROUND_TIFF="maintenance/package-background.tiff" +LICENSE_FILE="maintenance/License.rtf" +WELCOME_FILE="maintenance/Welcome.rtf" + +MKDIRS="mkdirhier" +CHMOD="chmod" +CHOWN="chown" +CHGRP="chgrp" +SUDO="sudo" +RM_R="rm -r" + + +# ****************************** usage ******************************** + +function usage() { + cat <<_ACEOF +make-osxmpkg.sh +_ACEOF +} + + +# ****************************** validate cmdline args **************** + +function validateArgs() { + if test "x$PKG_NAME" = "x"; then + usage; + exit 1 + fi +} + + +# ****************************** prepare/cleanup tmpfiles ************* + +function prepareTmpDirs() { + if test -d $PKG_BUILD_DIR; then + echo -n " deleting old builddir: $PKG_BUILD_DIR .." + ${SUDO} ${RM_R} $PKG_BUILD_DIR + echo ".. done." + fi + + echo -n " preparing temporary builddir .." + ${MKDIRS} "${PKG_BUILD_DIR}" + ${MKDIRS} "${PKG_DIR}" + ${MKDIRS} "${PKG_RSRC_DIR}" + ${MKDIRS} "${PKG_RSRC_DIR}/English.lproj" + ${MKDIRS} "${ROOT_DIR}" + echo ".. done: $PKG_BUILD_DIR." +} + +function fixUpPermissions() { + echo -n " fixing permissions in builddir (requires sudo) .." + ${SUDO} ${CHOWN} -R root "${ROOT_DIR}" + ${SUDO} ${CHGRP} -R admin "${ROOT_DIR}" + ${SUDO} ${CHMOD} -R 755 "${ROOT_DIR}" + ${SUDO} ${CHMOD} u+t "${ROOT_DIR}" + ${SUDO} ${CHMOD} u+t "${ROOT_DIR}/Library" + echo ".. done." +} + +function cleanupTmpDirs() { + if test -d $PKG_BUILD_DIR; then + echo -n " deleting builddir: $PKG_BUILD_DIR .." + rm -r $PKG_BUILD_DIR + echo ".. done." + fi +} + + +# ****************************** info files *************************** + +function plistWriteString() { + echo " $1" + echo " $2" +} +function plistWriteInt() { + echo " $1" + echo " `echo $2`" +} +function plistWriteReal() { + echo " $1" + echo " `echo $2`" +} +function plistWriteDate() { + echo " $1" + echo " $2" +} +function plistWriteBool() { + echo " $1" + echo " <$2/>" +} + +function genSubPkgEntry { + echo " " + echo " IFPkgFlagPackageLocation" + echo " $1" + echo " IFPkgFlagPackageSelection" + echo " $2" + echo " " +} + +function genInfoPList() { + # http://developer.apple.com/documentation/DeveloperTools/Conceptual/ + # SoftwareDistribution/Concepts/sd_pkg_flags.html + F="${PKG_DIR}/Contents/Info.plist" + echo -n " gen Info.plist: $F .." + + echo >$F "" + echo >>$F "" + echo >>$F "" + echo >>$F " " + + plistWriteString >>$F IFMajorVersion 4 + plistWriteString >>$F IFMinorVersion 5 + + plistWriteDate >>$F IFPkgBuildDate "`date -u +%Y-%m-%dT%H:%M:%SZ`" + plistWriteString >>$F IFPkgBuildVersion "${PKG_VERSION}" + plistWriteBool >>$F IFPkgFlagAllowBackRev true + plistWriteString >>$F IFPkgFlagAuthorizationAction AdminAuthorization + plistWriteString >>$F IFPkgFlagBackgroundAlignment topright + plistWriteString >>$F IFPkgFlagBackgroundScaling none + plistWriteString >>$F IFPkgFlagDefaultLocation / + plistWriteBool >>$F IFPkgFlagFollowLinks true + plistWriteBool >>$F IFPkgFlagInstallFat true + plistWriteBool >>$F IFPkgFlagIsRequired false + plistWriteBool >>$F IFPkgFlagOverwritePermissions false + plistWriteBool >>$F IFPkgFlagRelocatable true + plistWriteString >>$F IFPkgFlagRestartAction NoRestart + plistWriteBool >>$F IFPkgFlagRootVolumeOnly false + plistWriteBool >>$F IFPkgFlagUpdateInstalledLanguages false + plistWriteBool >>$F IFPkgFlagUseUserMask false + plistWriteReal >>$F IFPkgFormatVersion "${INSTALLER_FORMAT_KEY}" + + plistWriteString >>$F IFPkgFlagComponentDirectory "../Packages" + + # generate sub-package list + echo >>$F " IFPkgFlagPackageList" + echo >>$F " " + for i in sope-xml sope-core sope-mime sope-appserver; do + genSubPkgEntry >>$F $i.pkg required + done + for i in sope-ical sope-ldap sope-gdl1 sopex; do + genSubPkgEntry >>$F $i.pkg selected + done + echo >>$F " " + + # close plist + echo >>$F " " + echo >>$F "" + if test "x$CHECK_XML" = "xyes"; then + xmllint --noout $F + fi + + echo ".. done." +} + +function genVersionPList() { + # http://developer.apple.com/documentation/DeveloperTools/Conceptual/ + # SoftwareDistribution/Concepts/sd_pkg_flags.html + F="${PKG_DIR}/Contents/version.plist" + echo -n " gen version.plist: $F .." + + echo >$F "" + echo >>$F "" + echo >>$F "" + echo >>$F " " + + plistWriteString >>$F BuildVersion 4 + plistWriteString >>$F CFBundleShortVersionString "4.5" + plistWriteString >>$F ProjectName "${PKG_NAME}" + plistWriteString >>$F SourceVersion 45000 + + # close plist + echo >>$F " " + echo >>$F "" + if test "x$CHECK_XML" = "xyes"; then + xmllint --noout $F + fi + + echo ".. done." +} + +function genEnDescription() { + F="${PKG_RSRC_DIR}/English.lproj/Description.plist" + echo -n " gen description plist: $F .." + + echo >$F "" + echo >>$F "" + echo >>$F "" + echo >>$F " " + + plistWriteString >>$F IFPkgDescriptionDescription "${PKG_NAME}" + plistWriteString >>$F IFPkgDescriptionTitle "${PKG_NAME}" + plistWriteString >>$F IFPkgDescriptionVersion "${PKG_VERSION}" + + echo >>$F " " + echo >>$F "" + if test "x$CHECK_XML" = "xyes"; then + xmllint --noout $F + fi + echo ".. done." +} + +function genInfoFile() { + F="${PKG_RSRC_DIR}/English.lproj/${PKG_NAME}.info" + echo -n " gen info file: $F .." + + echo >$F "Title ${PKG_NAME}" + echo >>$F "Version ${PKG_VERSION}" + echo >>$F "Description ${PKG_VERSION}" + + echo >>$F "PackageLocation ../" + echo >>$F "FastInstall NO" + + echo >>$F "Require Reboot NO" # TODO: consolidate + echo >>$F "OverwritePermissions NO" # TODO: consolidate + echo >>$F "UseUserMask NO" # TODO: consolidate + echo >>$F "RootVolumeOnly NO" # TODO: consolidate + echo >>$F "NeedsAuthorization YES" # TODO: consolidate + echo >>$F "DefaultLocation /" # TODO: consolidate + echo >>$F "Relocatable YES" # TODO: consolidate + echo >>$F "Install Fat YES" # TODO: consolidate + echo >>$F "LibrarySubdirectory Standard" + + ln -s ${PKG_RSRC_DIR}/English.lproj/${PKG_NAME}.info \ + ${PKG_RSRC_DIR}/English.lproj/Install.info + echo ".. done." +} + + +function genPkgInfoFile() { + F="${PKG_DIR}/Contents/PkgInfo" + echo -n " gen PkgInfo: $F .." + echo >$F "pmkrpkg1" + echo ".. done." +} + +function genPkgVersionFile() { + F="${PKG_RSRC_DIR}/package_version" + echo -n " gen package_version: $F .." + echo >$F "major: 4" + echo >>$F "minor: 5" + echo ".. done." +} + +function genRequiredPkgs() { + F="${PKG_RSRC_DIR}/Install.list" + echo -n " gen Install.list (requirements): $F .." + echo >$F "BSD.pkg:required" + echo >>$F "BSDSDK.pkg:required" + echo >>$F "DeveloperTools.pkg:required" + echo ".. done." +} + + +# ****************************** resources **************************** + +function copyBackgroundImage() { + if test -f "${BACKGROUND_TIFF}"; then + cp "${BACKGROUND_TIFF}" "${PKG_RSRC_DIR}/background.tiff" + else + echo "ERROR: did not find background image: ${BACKGROUND_TIFF}" + fi +} + +function copyLicenseFile() { + if test -f "${LICENSE_FILE}"; then + cp "${LICENSE_FILE}" "${PKG_RSRC_DIR}/English.lproj/License.rtf" + else + echo "ERROR: did not find file: ${LICENSE_FILE}" + fi +} +function copyWelcomeFile() { + if test -f "${WELCOME_FILE}"; then + cp "${WELCOME_FILE}" "${PKG_RSRC_DIR}/English.lproj/Welcome.rtf" + else + echo "ERROR: did not find file: ${WELCOME_FILE}" + fi +} + + +# ****************************** debugging **************************** + +function debugShowResults() { + echo "" + echo "prepared contents:" + find -s $PKG_BUILD_DIR \ + | sed "sX${PKG_BUILD_DIR}/X Xg" +} + + +# ****************************** sudo ********************************* + +function ensureSudo() { + # this will bring up the 'sudo' authentication + if test "x$USER" != "xroot"; then + echo "We need to run some commands using 'sudo', so please enter your " + echo "credentials when being asked for them (unless you already did so)" + sudo touch /tmp/osx-pkg-sudo-tmp + sudo rm /tmp/osx-pkg-sudo-tmp + fi +} + + +# ****************************** sudo ********************************* + +function copyPackages() { + for i in */*.pkg; do + cp -R $i "${ROOT_DIR}"/ + done +} + + +# ****************************** running ****************************** + +echo "Building SOPE MacOSX Installer.app packages $PKG_NAME.mpkg .." +validateArgs; + +ensureSudo; + +prepareTmpDirs; +copyPackages; + +genInfoPList; +genVersionPList; +genEnDescription; +genInfoFile; +genPkgInfoFile; +genRequiredPkgs; +genPkgVersionFile; + +copyBackgroundImage; +copyLicenseFile; +copyWelcomeFile; + + +# debugging, print results +debugShowResults; + + +#cleanupTmpDirs; diff --git a/maintenance/make-osxpkg.sh b/maintenance/make-osxpkg.sh index 23c4d324..e26a33a0 100755 --- a/maintenance/make-osxpkg.sh +++ b/maintenance/make-osxpkg.sh @@ -1,4 +1,11 @@ #!/bin/sh +# +# make-osxpkg.sh +# +# Create a MacOSX Installer package for a given GNUstep directory. It does so +# by installing the results in a certain directory and then running the +# necessary packaging commands. +# PKG_NAME="$1" @@ -8,6 +15,7 @@ PKG_DIR="$PKG_BUILD_DIR/${PKG_NAME}.pkg" PKG_RSRC_DIR="$PKG_BUILD_DIR/${PKG_NAME}.pkg/Contents/Resources" PKG_VERSION="4.5" ROOT_DIR="$PKG_BUILD_DIR/root" + CHECK_XML="yes" PLIST_DT_ID="-//Apple Computer//DTD PLIST 1.0//EN" PLIST_DT_LOC="http://www.apple.com/DTDs/PropertyList-1.0.dtd" diff --git a/maintenance/rm-sope-on-osxlib.sh b/maintenance/rm-sope-on-osxlib.sh index 59173641..47459b13 100755 --- a/maintenance/rm-sope-on-osxlib.sh +++ b/maintenance/rm-sope-on-osxlib.sh @@ -35,6 +35,8 @@ sope-appserver.framework sope-ical.framework sope-ldap.framework sope-gdl1.framework + +SOPEX.framework " for i in $FW; do diff --git a/sope-appserver/samples/CoreDataBlog/RSS10.wo/RSS10.wod b/sope-appserver/samples/CoreDataBlog/RSS10.wo/RSS10.wod index bfe1d5a5..c6fd7ee9 100644 --- a/sope-appserver/samples/CoreDataBlog/RSS10.wo/RSS10.wod +++ b/sope-appserver/samples/CoreDataBlog/RSS10.wo/RSS10.wod @@ -32,7 +32,8 @@ ItemDescription: WOString { // TODO: shorten? (and _then_ escape) value = item.body.stringByEscapingXMLString; } -ItemDcSubject: WOString { value = ""; } // TODO: check spec +ItemDcSubject: WOString { value = ""; } // TODO: check spec + ItemDcCreator: WOString { value = item.author.name.stringByEscapingXMLString; escapeHTML = NO; -- 2.39.5