Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add CentOS rootfs setup

  • Loading branch information...
commit f698fcbedf6cb7b08c5fd1568756917abb90ec93 1 parent 2ea0203
Dmitriy Kalinin and Pieter Noordhuis authored
2  warden/Rakefile
View
@@ -49,7 +49,7 @@ namespace :setup do
end
sh "mkdir -p #{File.dirname(rootfs_path)}"
- sh "sudo -E unshare -m root/linux/base/setup.sh #{rootfs_path}"
+ sh "sudo -E unshare -m root/linux/rootfs/setup.sh #{rootfs_path}"
end
end
49 warden/root/linux/rootfs/centos.sh
View
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+[ -n "$DEBUG" ] && set -o xtrace
+set -o nounset
+set -o errexit
+shopt -s nullglob
+shopt -s globstar
+
+if [ $EUID -ne 0 ]
+then
+ echo "Sorry, you need to be root."
+ exit 1
+fi
+
+if [ "$#" -ne 1 ]
+then
+ echo "Usage: setup.sh [TARGET DIRECTORY]"
+ exit 1
+fi
+
+target=$1
+
+if [ -d $target ]
+then
+ read -p "Target directory already exists. Erase it? "
+ if [[ $REPLY =~ ^[Yy].*$ ]]
+ then
+ rm -rf $target
+ else
+ echo "Aborting..."
+ exit 1
+ fi
+fi
+
+mkdir -p $target
+
+tmpdir=$(mktemp -d)
+yumdownloader --destdir=$tmpdir centos-release
+rpm -iv --nodeps --root $target $tmpdir/centos-release-*.rpm
+rm -rf $tmpdir
+
+yum -y --installroot $target install yum
+yum -y --installroot $target groupinstall "Development Tools"
+yum -y --installroot $target install zlib-devel
+yum -y --installroot $target install openssl-devel
+yum -y --installroot $target install readline-devel
+
+# Only used for tests
+yum -y --installroot $target install nc
26 warden/root/linux/rootfs/setup.sh
View
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+[ -n "$DEBUG" ] && set -o xtrace
+set -o nounset
+set -o errexit
+shopt -s nullglob
+shopt -s globstar
+
+if [ ! -f /etc/issue ]
+then
+ echo "/etc/issue doesn't exist; cannot determine distribution"
+ exit 1
+fi
+
+if grep -q -i ubuntu /etc/issue
+then
+ exec $(dirname $0)/ubuntu.sh $@
+fi
+
+if grep -q -i centos /etc/issue
+then
+ exec $(dirname $0)/centos.sh $@
+fi
+
+echo "Unknown distribution: $(head -1 /etc/issue)"
+exit 1
11 warden/root/linux/base/setup.sh → warden/root/linux/rootfs/ubuntu.sh
View
@@ -4,6 +4,7 @@
set -o nounset
set -o errexit
shopt -s nullglob
+shopt -s globstar
packages="openssh-server,rsync"
suite="lucid"
@@ -62,18 +63,12 @@ fi
if [ "$#" -ne 1 ]
then
- echo "Usage: setup.sh [base_dir]"
- exit 1
-fi
-
-dirname=$(readlink -nf $(dirname $1))
-if [ ! -d $dirname ]
-then
- echo "Looks like $dirname doesn't exist or isn't a directory"
+ echo "Usage: setup.sh [TARGET DIRECTORY]"
exit 1
fi
target=$1
+mkdir -p $target
debootstrap
Please sign in to comment.
Something went wrong with that request. Please try again.