93 lines
1.6 KiB
Bash
Executable File
93 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script sets up the /etc/apt/sources.list for APT.
|
|
#
|
|
# Steve
|
|
# --
|
|
# http://www.steve.org.uk/
|
|
|
|
|
|
prefix=$1
|
|
dist=$2
|
|
|
|
|
|
#
|
|
# This function will setup the sources.list file for new installations
|
|
# of Debian GNU/Linux.
|
|
#
|
|
function setupDebian
|
|
{
|
|
cat <<E_O_APT > ${prefix}/etc/apt/sources.list
|
|
#
|
|
# /etc/apt/sources.list
|
|
#
|
|
|
|
|
|
#
|
|
# ${dist}
|
|
#
|
|
deb ${mirror} ${dist} main contrib non-free
|
|
deb-src ${mirror} ${dist} main contrib non-free
|
|
|
|
#
|
|
# Security updates
|
|
#
|
|
deb http://security.debian.org/ stable/updates main contrib non-free
|
|
deb-src http://security.debian.org/ stable/updates main contrib non-free
|
|
|
|
|
|
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
|
|
}
|
|
|
|
|
|
|
|
|
|
#
|
|
# 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
|
|
|
|
#
|
|
# Update the package lists that Yum knows about.
|
|
#
|
|
if [[ -x ${prefix}/usr/bin/yum ]]; then
|
|
chroot ${prefix}/usr/bin/yum update
|
|
fi
|
|
}
|
|
|
|
|
|
|
|
|
|
#
|
|
# Entry point to the script.
|
|
#
|
|
case "${dist}" in
|
|
sarge|etch|sid)
|
|
setupDebian
|
|
;;
|
|
centos4)
|
|
setupCentOS4
|
|
;;
|
|
*)
|
|
echo "Unknown distribution '${dist}'. Fixme";
|
|
exit;
|
|
;;
|
|
esac
|
|
|
|
|
|
|
|
|