2006-10-19 17:04:17 by steve
Portability fixups for using a non-bash shell. Patches from Eric Lemoine.
This commit is contained in:
parent
3d31602934
commit
8f79f92a88
1
AUTHORS
1
AUTHORS
@ -28,6 +28,7 @@ Contributions
|
||||
|
||||
Eric Lemoine <<eric.lemoine [at] com.gmail>
|
||||
- Improved binary detection and good suggestions.
|
||||
- Better portability for non-bash shells.
|
||||
|
||||
Radu Spineanu <radu [at] org.debian>
|
||||
- Supplied many small tweaks, bugfixes, and suggestions.
|
||||
|
||||
@ -35,7 +35,7 @@ mkdir -p ${prefix}/etc/sysconfig/network-scripts/
|
||||
#
|
||||
# Test for static vs. DHCP
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
#
|
||||
# Setup the initial interface
|
||||
@ -95,4 +95,4 @@ EOF
|
||||
#
|
||||
# Log our finish
|
||||
#
|
||||
logMessage Script $0 finished
|
||||
logMessage Script $0 finished
|
||||
|
||||
@ -39,7 +39,7 @@ echo ${hostname} > ${prefix}/etc/mailname
|
||||
# Fixup the /etc/hosts file upon the new image for
|
||||
# machines with static IPs
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
# Non-IPv6 stuff.
|
||||
grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts
|
||||
@ -56,7 +56,7 @@ fi
|
||||
#
|
||||
# Allow the host system to know the IP address of our new guest.
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
if ( grep ${hostname} /etc/hosts > /dev/null ) ; then
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#
|
||||
# If we're running verbosely show a message, otherwise swallow it.
|
||||
#
|
||||
function logMessage
|
||||
logMessage ()
|
||||
{
|
||||
message="$*"
|
||||
|
||||
@ -35,10 +35,15 @@ function logMessage
|
||||
#
|
||||
assert ()
|
||||
{
|
||||
line=$1;
|
||||
shift;
|
||||
lineno="?"
|
||||
|
||||
if ! [ $* ] ; then
|
||||
if [ -n "${LINENO}" ]; then
|
||||
# our shell defines variable LINENO, great!
|
||||
lineno=$1
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ ! $* ] ; then
|
||||
echo "assert failed: $0:$lineno [$*]"
|
||||
exit
|
||||
fi
|
||||
@ -48,7 +53,7 @@ assert ()
|
||||
#
|
||||
# Install a Debian package via apt-get.
|
||||
#
|
||||
function installDebianPackage
|
||||
installDebianPackage ()
|
||||
{
|
||||
prefix=$1
|
||||
package=$2
|
||||
@ -81,7 +86,7 @@ function installDebianPackage
|
||||
#
|
||||
# Remove a Debian package.
|
||||
#
|
||||
function removeDebianPackage
|
||||
removeDebianPackage ()
|
||||
{
|
||||
prefix=$1
|
||||
package=$2
|
||||
@ -113,7 +118,7 @@ function removeDebianPackage
|
||||
#
|
||||
# Install a CentOS4 package via yum
|
||||
#
|
||||
function installCentOS4Package
|
||||
installCentOS4Package ()
|
||||
{
|
||||
prefix=$1
|
||||
package=$2
|
||||
@ -146,7 +151,7 @@ function installCentOS4Package
|
||||
#
|
||||
# TODO: STUB
|
||||
#
|
||||
function installGentooPackage
|
||||
installGentooPackage ()
|
||||
{
|
||||
prefix=$1
|
||||
package=$2
|
||||
|
||||
@ -35,7 +35,7 @@ mkdir -p ${prefix}/etc/network
|
||||
#
|
||||
# A function to setup DHCP for our new image.
|
||||
#
|
||||
function setupDynamicNetworking
|
||||
setupDynamicNetworking ()
|
||||
{
|
||||
#
|
||||
# The host is using DHCP.
|
||||
@ -65,7 +65,7 @@ E_O_DHCP
|
||||
#
|
||||
# A function to setup static IP addresses for our new image.
|
||||
#
|
||||
function setupStaticNetworking
|
||||
setupStaticNetworking ()
|
||||
{
|
||||
#
|
||||
# if $p2p is set then add a "pointtopoint" setting.
|
||||
@ -131,7 +131,7 @@ E_O_STATIC
|
||||
#
|
||||
# Call the relevant function
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
logMessage "Setting up static networking"
|
||||
setupStaticNetworking
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ echo ${hostname} > ${prefix}/etc/mailname
|
||||
# Fixup the /etc/hosts file upon the new image for
|
||||
# machines with static IPs
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
# Non-IPv6 stuff.
|
||||
grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts
|
||||
@ -56,7 +56,7 @@ fi
|
||||
#
|
||||
# Allow the host system to know the IP address of our new guest.
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
if ( grep ${hostname} /etc/hosts > /dev/null ) ; then
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ mkdir -p ${prefix}/etc/conf.d
|
||||
#
|
||||
# A function to setup DHCP for our new image.
|
||||
#
|
||||
function setupDynamicNetworking
|
||||
setupDynamicNetworking ()
|
||||
{
|
||||
#
|
||||
# The host is using DHCP.
|
||||
@ -55,7 +55,7 @@ E_O_DHCP
|
||||
#
|
||||
# A function to setup static IP addresses for our new image.
|
||||
#
|
||||
function setupStaticNetworking
|
||||
setupStaticNetworking ()
|
||||
{
|
||||
#
|
||||
# if $p2p is set then add a "pointtopoint" setting.
|
||||
@ -104,7 +104,7 @@ E_O_STATIC
|
||||
#
|
||||
# Call the relevant function
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
logMessage "Setting up static networking"
|
||||
setupStaticNetworking
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ echo DNSDOMAIN=\"${domain}\" >> ${prefix}/etc/conf.d/domainname
|
||||
# Fixup the /etc/hosts file upon the new image for
|
||||
# machines with static IPs
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
# Non-IPv6 stuff.
|
||||
grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts
|
||||
@ -63,7 +63,7 @@ fi
|
||||
#
|
||||
# Allow the host system to know the IP address of our new guest.
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
if ( grep ${hostname} /etc/hosts > /dev/null ) ; then
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ mkdir -p ${prefix}/etc/network
|
||||
#
|
||||
# A function to setup DHCP for our new image.
|
||||
#
|
||||
function setupDynamicNetworking
|
||||
setupDynamicNetworking ()
|
||||
{
|
||||
#
|
||||
# The host is using DHCP.
|
||||
@ -65,7 +65,7 @@ E_O_DHCP
|
||||
#
|
||||
# A function to setup static IP addresses for our new image.
|
||||
#
|
||||
function setupStaticNetworking
|
||||
setupStaticNetworking ()
|
||||
{
|
||||
#
|
||||
# We have a static IP address
|
||||
@ -120,7 +120,7 @@ E_O_STATIC
|
||||
#
|
||||
# Call the relevant function
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
logMessage "Setting up static networking"
|
||||
setupStaticNetworking
|
||||
|
||||
@ -133,4 +133,4 @@ fi
|
||||
#
|
||||
# Log our finish
|
||||
#
|
||||
logMessage Script $0 finished
|
||||
logMessage Script $0 finished
|
||||
|
||||
@ -39,7 +39,7 @@ echo ${hostname} > ${prefix}/etc/mailname
|
||||
# Fixup the /etc/hosts file upon the new image for
|
||||
# machines with static IPs
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
# Non-IPv6 stuff.
|
||||
grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts
|
||||
@ -56,7 +56,7 @@ fi
|
||||
#
|
||||
# Allow the host system to know the IP address of our new guest.
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
if [ -z "${dhcp}" ]; then
|
||||
|
||||
if ( grep ${hostname} /etc/hosts > /dev/null ) ; then
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user