Browse files

Add variables that can be overriden in the conf file to enable proxy …

…support for downloading things.

This mostly works. gems may not be working quite right.  It is off by default.
  • Loading branch information...
1 parent eda64b1 commit 4dc5900aec237c9d9bd49ba84a548b1b3713f3f8 Greg Althaus committed Aug 17, 2011
Showing with 24 additions and 7 deletions.
  1. +9 −0 build_crowbar.sh
  2. +12 −5 redhat-5.6-extra/build_lib.sh
  3. +3 −2 redhat-5.6-extra/packages/base.list
View
9 build_crowbar.sh
@@ -184,6 +184,15 @@ in_repo() ( cd "$CROWBAR_DIR"; git "$@" )
# Tree-ish to check out in the build-cache"
[[ $CACHE_REVISION ]] || CACHE_REVISION="master"
+ # Proxy Variables
+ [[ $USE_PROXY ]] || USE_PROXY=0
+ [[ $PROXY_HOST ]] || PROXY_HOST=""
+ [[ $PROXY_PORT ]] || PROXY_PORT=""
+ [[ $PROXY_USER ]] || PROXY_USER=""
+ [[ $PROXY_PASSWORD ]] || PROXY_PASSWORD=""
+ [[ $WEBRICK_IP ]] || WEBRICK_IP="127.0.0.1"
+ [[ $WEBRICK_BIND ]] || WEBRICK_BIND="127.0.0.1"
+
# Make any directories we don't already have
for d in "$PKG_CACHE" "$GEM_CACHE" "$ISO_LIBRARY" "$ISO_DEST" \
"$IMAGE_DIR" "$BUILD_DIR" "$AMI_CACHE" \
View
17 redhat-5.6-extra/build_lib.sh
@@ -17,7 +17,7 @@ OS_BASIC_PACKAGES=(MAKEDEV SysVinit audit-libs basesystem bash beecrypt \
nspr openssl pam pcre popt procps psmisc python python-libs \
python-elementtree python-sqlite python-urlgrabber python-iniparse \
readline rpm rpm-libs rpm-python sed setup shadow-utils sqlite sysklogd \
- termcap tzdata udev util-linux yum yum-metadata-parser zlib)
+ termcap tzdata udev util-linux wget yum yum-metadata-parser zlib)
# The name of the OS iso we are using as a base.
[[ $ISO ]] || ISO="RHEL5.6-Server-20110106.0-x86_64-DVD.iso"
@@ -29,7 +29,13 @@ fetch_os_iso() {
die "build_crowbar.sh does not know how to automatically download $ISO"
}
-in_chroot() { sudo -H /usr/sbin/chroot "$CHROOT" "$@"; }
+in_chroot() {
+ if [ "$USE_PROXY" == "1" ] ; then
+ sudo -H no_proxy="localhost,localhost.localdomain,127.0.0.0/8,$PROXY_HOST" http_proxy="http://$PROXY_USER:$PROXY_PASSWORD@$PROXY_HOST:$PROXY_PORT/" https_proxy="http://$PROXY_USER:$PROXY_PASSWORD@$PROXY_HOST:$PROXY_PORT/" /usr/sbin/chroot "$CHROOT" "$@";
+ else
+ sudo -H /usr/sbin/chroot "$CHROOT" "$@";
+ fi
+}
chroot_install() { in_chroot /usr/bin/yum -y install "$@"; }
chroot_fetch() { in_chroot /usr/bin/yum -y --downloadonly install "$@"; }
@@ -68,7 +74,7 @@ make_redhat_chroot() (
# second, fix up the chroot to make sure we can use it
sudo cp /etc/resolv.conf "$CHROOT/etc/resolv.conf"
sudo rm -f "$CHROOT/etc/yum.repos.d/"*
- make_repo_file redhat-base "http://127.0.0.1:54321/Server/"
+ make_repo_file redhat-base "http://${WEBRICK_IP}:54321/Server/"
for d in proc sys dev dev/pts; do
mkdir -p "$CHROOT/$d"
sudo mount --bind "/$d" "$CHROOT/$d"
@@ -94,7 +100,7 @@ make_redhat_chroot() (
update_caches() {
( cd "$IMAGE_DIR"
exec ruby -rwebrick -e \
- 'WEBrick::HTTPServer.new(:BindAddress=>"127.0.0.1",:Port=>54321,:DocumentRoot=>".").start' &>/dev/null ) &
+ "WEBrick::HTTPServer.new(:BindAddress=>\"${WEBRICK_BIND}\",:Port=>54321,:DocumentRoot=>\".\").start" &>/dev/null ) &
webrick_pid=$!
make_redhat_chroot
# First, copy in our current packages and fix up ownership
@@ -109,7 +115,8 @@ update_caches() {
rtype="${repo%% *}"
rdest="${repo#* }"
case $rtype in
- rpm) in_chroot rpm -Uvh "$rdest";;
+ rpm) in_chroot wget -q -O /tmp/rpm.rpm "$rdest"
+ in_chroot rpm -Uvh /tmp/rpm.rpm;;
bare) make_repo_file $rdest;;
esac
done
View
5 redhat-5.6-extra/packages/base.list
@@ -14,6 +14,7 @@ repository rpm http://ftp.cse.buffalo.edu/pub/epel/5/x86_64/epel-release-5-4.noa
# repository rpm http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm
repository bare epel5-nagios3 http://repos.fedorapeople.org/repos/peter/nagios3/epel-5/x86_64/
+repository bare-rpm epel5-ganglia http://georgiou.fedorapeople.org/epel/5/
# base Chef packages
pkgs rubygem-chef-server curl-devel rubygem-kwalify ruby-ri ruby-docs syslinux
@@ -53,13 +54,13 @@ pkgs ruby-shadow
pkgs nscd
# nagios stuff
-pkgs nagios
+pkgs nagios nrpe nagios-plugins-all nagios-plugins nagios-plugins-perl nagios-plugins-nrpe
# bind9 stuff
pkgs bind bind-utils
# ganglia stuff
-pkgs ganglia ganglia-gmond ganglia-web
+pkgs ganglia ganglia-gmond ganglia-web ganglia-gmetad
# ntp stuff
pkgs ntp

0 comments on commit 4dc5900

Please sign in to comment.