summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2012-02-27 15:16:45 +0100
committerAndoni Morales Alastruey <ylatuya@gmail.com>2012-03-20 17:19:04 +0100
commit7bb90503f2149d97acedd1666dbb4dbc77b259fa (patch)
treec5373b99cee6ef86e06d9be58c80c08d876f7c8a /tools
parent358222e0ed0bfb10738db239862502eb4fbd67f5 (diff)
Add tool to create debian chroot environments with debootstrap
Diffstat (limited to 'tools')
-rwxr-xr-xtools/chroot.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/chroot.sh b/tools/chroot.sh
new file mode 100755
index 00000000..e2b8e70a
--- /dev/null
+++ b/tools/chroot.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+CHROOT_PREFIX=$1
+DISTRO=$2
+USER=$3
+
+CHROOT_PATH=$CHROOT_PREFIX/$DISTRO
+
+debootstrap $DISTRO $CHROOT_PATH http://archive.ubuntu.com/ubuntu
+
+cp /etc/resolv.conf $CHROOT_PATH/etc/resolv.conf
+cp /etc/hosts $CHROOT_PATH/etc/hosts
+
+echo "$USER:x:1000:1000:$USER,,,:/home/$USER:/bin/bash" >> $CHROOT_PATH/etc/passwd
+echo "$USER:x:1000:" >> $CHROOT_PATH/etc/group
+echo "$USER ALL=NOPASSWD: ALL" >>$CHROOT_PATH/etc/sudoers
+
+mkdir $CHROOT_PATH/home/$USER
+cp ~/.gitconfig $CHROOT_PATH/home/$USER/
+mkdir $CHROOT_PATH/home/$USER/.ssh
+cp ~/.ssh/id_rsa $CHROOT_PATH/home/$USER/.ssh/
+chmod -R 600 CHROOT_PATH/home/$USER/.ssh/
+chown $USER:$USER $CHROOT_PATH/home/$USER
+
+mkdir -p $CHROOT_PATH/home/$USER/git/cerbero
+cp -r * $CHROOT_PATH/home/$USER/git/cerbero
+cp -r .git $CHROOT_PATH/home/$USER/git/cerbero