From 3c5c1efcf4c070de3813b4782abbcd816eb0f5b1 Mon Sep 17 00:00:00 2001 From: steve Date: Wed, 24 May 2006 19:22:39 +0000 Subject: [PATCH] 2006-05-24 19:22:39 by steve Temporary point in conversion to new hook script format. --- etc/hook.d/10-disable-tls | 9 ++--- etc/hook.d/20-setup-apt | 72 +++++++++++++++++++++++----------- etc/hook.d/30-fix-inittab | 7 +++- etc/hook.d/40-setup-networking | 2 +- 4 files changed, 60 insertions(+), 30 deletions(-) diff --git a/etc/hook.d/10-disable-tls b/etc/hook.d/10-disable-tls index c947bdf..96b4ebf 100755 --- a/etc/hook.d/10-disable-tls +++ b/etc/hook.d/10-disable-tls @@ -8,11 +8,8 @@ prefix=$1 +dist=$2 + mv ${prefix}/lib/tls ${prefix}/lib/tls.disabled - -# -# Make a new /lib/tls directory in the guest, and make sure -# it cannot be modified. -# -mkdir ${prefix}/lib/tls +mkdir ${prefix}/lib/tls diff --git a/etc/hook.d/20-setup-apt b/etc/hook.d/20-setup-apt index 3587a22..c75fee3 100755 --- a/etc/hook.d/20-setup-apt +++ b/etc/hook.d/20-setup-apt @@ -8,11 +8,15 @@ prefix=$1 +dist=$2 - -if [[ -d ${prefix}/etc/apt ]]; then - +# +# This function will setup the sources.list file for new installations +# of Debian GNU/Linux. +# +function setupDebianSources +{ cat < ${prefix}/etc/apt/sources.list # # /etc/apt/sources.list @@ -40,25 +44,49 @@ E_O_APT # Now that the sources have been setup make sure the system is up to date. # chroot ${prefix} /usr/bin/apt-get update -else +} + + + +# +# This function sets up Yum on the new CentOS4 installations. +# +function setupCentOS4 +{ + perl -pi.bak -e 's/enabled=0/enabled=1/g' ${prefix}/etc/yum.repos.d/*.repo + perl -pi.bak -e 's/gpgcheck=1/gpgcheck=0/g' ${prefix}/etc/yum.repos.d/*.repo + perl -pi.bak -e 's/^\#baseurl/baseurl/g' ${prefix}/etc/yum.repos.d/*.repo + perl -pi.bak -e 's/^mirrorlist/#mirrorlist/g' ${prefix}/etc/yum.repos.d/*.repo + perl -pi.bak -e 's/\$releasever/4/g' ${prefix}/etc/yum.repos.d/*.repo + # - # Setup yum if we've got it installed. - if [ -d ${prefix}/etc/yum.repos.d/ ]; then - - # - # This works for centos4 - dunno about the rest yet. - # - perl -pi.bak -e 's/enabled=0/enabled=1/g' ${prefix}/etc/yum.repos.d/*.repo - perl -pi.bak -e 's/gpgcheck=1/gpgcheck=0/g' ${prefix}/etc/yum.repos.d/*.repo - perl -pi.bak -e 's/^\#baseurl/baseurl/g' ${prefix}/etc/yum.repos.d/*.repo - perl -pi.bak -e 's/^mirrorlist/#mirrorlist/g' ${prefix}/etc/yum.repos.d/*.repo - - # - # Update the package lists that Yum knows about. - # - if [[ -x ${prefix}/usr/bin/yum ]]; then - chroot ${prefix}/usr/bin/yum update - fi + # Update the package lists that Yum knows about. + # + if [[ -x ${prefix}/usr/bin/yum ]]; then + chroot ${prefix}/usr/bin/yum update fi -fi +} + + + + +# +# Entry point to the script. +# +case "${dist}" in + sarge|etch|sid) + setupDebianSources + ;; + centos4) + setupCentOS4 + ;; + *) + echo "Unknown distribution. Fixme"; + exit; + ;; +esac + + + + diff --git a/etc/hook.d/30-fix-inittab b/etc/hook.d/30-fix-inittab index 5a26912..461b4c8 100755 --- a/etc/hook.d/30-fix-inittab +++ b/etc/hook.d/30-fix-inittab @@ -9,4 +9,9 @@ # -- # http://www.steve.org.uk/ -sed -i -e 's/tty[0-9]$/console/g' -e 's/^\([2-6].*:respawn*\)/#\1/' -e 's/^T/#\t/' $1/etc/inittab + +prefix=$1 +dist=$2 + + +sed -i -e 's/tty[0-9]$/console/g' -e 's/^\([2-6].*:respawn*\)/#\1/' -e 's/^T/#\t/' ${prefix}/etc/inittab diff --git a/etc/hook.d/40-setup-networking b/etc/hook.d/40-setup-networking index 9043f97..691e7d8 100755 --- a/etc/hook.d/40-setup-networking +++ b/etc/hook.d/40-setup-networking @@ -9,7 +9,7 @@ prefix=$1 - +dist=$1 ##