1. Copy "resolv.conf" before running apt-get update / yum update.
Without this DNS is probably not available/working.
2. Copy /etc/sudoers from the host, if we're installing sudo.
57 lines
941 B
Bash
Executable File
57 lines
941 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script sets up the Yum for CentOS4.
|
|
#
|
|
# Steve
|
|
# --
|
|
# http://www.steve.org.uk/
|
|
|
|
|
|
prefix=$1
|
|
|
|
|
|
#
|
|
# Source our common functions
|
|
#
|
|
if [ -e /usr/lib/xen-tools/common.sh ]; then
|
|
. /usr/lib/xen-tools/common.sh
|
|
else
|
|
. ./hooks/common.sh
|
|
fi
|
|
|
|
|
|
#
|
|
# Log our start
|
|
#
|
|
logMessage Script $0 starting
|
|
|
|
|
|
#
|
|
# DNS is probably required to run "yum update".
|
|
#
|
|
cp /etc/resolv.conf ${prefix}/etc
|
|
|
|
|
|
#
|
|
# Transform yum so that it works.
|
|
#
|
|
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
|
|
|
|
#
|
|
# Update yum
|
|
#
|
|
chroot ${prefix}/usr/bin/yum update
|
|
|
|
#
|
|
# Log our finish
|
|
#
|
|
logMessage Script $0 finished
|
|
|
|
|
|
|
|
|