conf/osx/createpackage.sh in facter-1.5.4 vs conf/osx/createpackage.sh in facter-1.5.5
- old
+ new
@@ -5,17 +5,17 @@
# Author: Nigel Kersten (nigelk@google.com)
#
# Last Updated: 2008-07-31
#
# Copyright 2008 Google Inc.
-#
+#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
@@ -28,11 +28,11 @@
PROTO_PLIST="PackageInfo.plist"
PREFLIGHT="preflight"
function find_installer() {
- # we walk up three directories to make this executable from the root,
+ # we walk up three directories to make this executable from the root,
# root/conf or root/conf/osx
if [ -f "./${INSTALLRB}" ]; then
installer="$(pwd)/${INSTALLRB}"
elif [ -f "../${INSTALLRB}" ]; then
installer="$(pwd)/../${INSTALLRB}"
@@ -62,27 +62,27 @@
# As we can't specify to follow symlinks from the command line, we have
# to go through the hassle of creating an Info.plist file for packagemaker
# to look at for package creation and substitue the version strings out.
# Major/Minor versions can only be integers, so we have "1" and "50" for
# facter version 1.5
- # Note too that for 10.5 compatibility this Info.plist *must* be set to
+ # Note too that for 10.5 compatibility this Info.plist *must* be set to
# follow symlinks.
VER1=$(echo ${facter_version} | awk -F "." '{print $1}')
VER2=$(echo ${facter_version} | awk -F "." '{print $2}')
VER3=$(echo ${facter_version} | awk -F "." '{print $3}')
major_version="${VER1}"
minor_version="${VER2}${VER3}"
cp "${facter_root}/conf/osx/${PROTO_PLIST}" "${pkgtemp}"
sed -i '' "s/{SHORTVERSION}/${facter_version}/g" "${pkgtemp}/${PROTO_PLIST}"
sed -i '' "s/{MAJORVERSION}/${major_version}/g" "${pkgtemp}/${PROTO_PLIST}"
sed -i '' "s/{MINORVERSION}/${minor_version}/g" "${pkgtemp}/${PROTO_PLIST}"
-
+
# We need to create a preflight script to remove traces of previous
# facter installs due to limitations in Apple's pkg format.
mkdir "${pkgtemp}/scripts"
cp "${facter_root}/conf/osx/${PREFLIGHT}" "${pkgtemp}/scripts"
-
+
# substitute in the sitelibdir specified above on the assumption that this
# is where any previous facter install exists that should be cleaned out.
sed -i '' "s|{SITELIBDIR}|${SITELIBDIR}|g" "${pkgtemp}/scripts/${PREFLIGHT}"
chmod 0755 "${pkgtemp}/scripts/${PREFLIGHT}"
}
@@ -122,47 +122,47 @@
echo "This script needs to be run as root via su or sudo."
cleanup_and_exit 1
fi
find_installer
-
+
if [ ! "${installer}" ]; then
echo "Unable to find ${INSTALLRB}"
cleanup_and_exit 1
fi
find_facter_root
-
+
if [ ! "${facter_root}" ]; then
echo "Unable to find facter repository root."
cleanup_and_exit 1
fi
-
+
pkgroot=$(mktemp -d -t facterpkg)
-
+
if [ ! "${pkgroot}" ]; then
echo "Unable to create temporary package root."
cleanup_and_exit 1
fi
-
+
pkgtemp=$(mktemp -d -t factertmp)
-
+
if [ ! "${pkgtemp}" ]; then
echo "Unable to create temporary package root."
cleanup_and_exit 1
fi
-
+
install_facter
get_facter_version
-
+
if [ ! "${facter_version}" ]; then
echo "Unable to retrieve facter version"
cleanup_and_exit 1
fi
-
+
prepare_package
create_package
-
+
cleanup_and_exit 0
}
main "$@"