1
0
mirror of synced 2026-01-20 17:38:02 +00:00
steve b57c662926 2006-06-09 10:32:38 by steve
Updated header and formatting slightly
2006-06-09 10:32:38 +00:00

86 lines
1.4 KiB
Bash

#
# Common shell functions which may be used by any hook script
#
# If you find that a distribution-specific hook script or two
# are doing the same thing more than once it should be added here.
#
# This script also includes a logging utility which you're encouraged
# to use.
#
# Steve
# --
#
#
# If we're running verbosely show a message, otherwise swallow it.
#
function logMessage
{
message="$*"
if [ ! -z "${verbose}" ]; then
echo $message
fi
}
#
# Install a Debian package via apt-get.
#
function installDebianPackage
{
prefix=$1
package=$2
#
# Log our options
#
logMessage "Installing Debian package ${package} to prefix ${prefix}"
#
# Make sure the prefix exists.
#
if [ -z "${prefix}" ]; then
logMessage "Prefix '${prefix}' does not exist. Abortin"
return
fi
#
# Install the package
#
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install ${package}
}
#
# Install a CentOS4 package via yum
#
function installCentOS4Package
{
prefix=$1
package=$2
#
# Log our options
#
logMessage "Installing CentOS4 ${package} to prefix ${prefix}"
#
# Make sure the prefix exists.
#
if [ -z "${prefix}" ]; then
logMessage "Prefix '${prefix}' does not exist. Abortin"
return
fi
#
# Install the package
#
chroot ${prefix} /usr/bin/yum -y install ${package}
}