37 lines
813 B
Bash
Executable File
37 lines
813 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# usage ./provision.sh
|
|
|
|
if [ "$USER" != "root" ]; then
|
|
echo "must be run as root"
|
|
exit 2
|
|
fi
|
|
|
|
FLAVOR=$1
|
|
BASEPATH=$2
|
|
|
|
if [ ! -d "$BASEPATH" ]; then
|
|
|
|
echo "container-provisioner: building new $FLAVOR at $BASEPATH"
|
|
debootstrap $FLAVOR "$BASEPATH"
|
|
|
|
Q=$?
|
|
if [ $Q -ne 0 ]; then
|
|
echo "debootstrap failed; are you connected to the Internet?"
|
|
exit $Q
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ ! -d "$BASEPATH" ]; then
|
|
echo "base path not found: $BASEPATH"
|
|
exit 2
|
|
fi
|
|
|
|
# update the sources.list - this is only for ubuntu!!
|
|
echo "deb http://archive.ubuntu.com/ubuntu $FLAVOR main universe
|
|
deb http://archive.ubuntu.com/ubuntu $FLAVOR-updates main universe
|
|
deb http://archive.ubuntu.com/ubuntu $FLAVOR-backports main universe
|
|
deb http://archive.ubuntu.com/ubuntu $FLAVOR-security main universe" > $BASEPATH/etc/apt/sources.list
|
|
|