/[sysadmin-cookbook]/recepies/lxc/kvm/01-setup/01-create-kvm-root.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /recepies/lxc/kvm/01-setup/01-create-kvm-root.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 260 - (hide annotations)
Sat May 14 20:07:00 2011 UTC (13 years ago) by dpavlin
File MIME type: application/x-sh
File size: 929 byte(s)
added missing file
1 dpavlin 248 #!/bin/sh
2    
3 dpavlin 250 if [ -z "$SUDO_UID" ] ; then
4     echo "Run this script with: sudo $0"
5     exit 1
6     fi
7 dpavlin 248
8 dpavlin 257 MIRROR=ftp.debian.org/debian
9     dpkg -l apt-cacher-ng >/dev/null && MIRROR="127.0.0.1:3142/$MIRROR"
10 dpavlin 250
11 dpavlin 257 echo "Using $MIRROR"
12    
13 dpavlin 260 debootstrap --include=psmisc,less,strace,bzip2,make,gcc,libc6-dev,dropbear,lxc,libc6-amd64,file squeeze squeeze http://$MIRROR
14 dpavlin 257
15 dpavlin 248 echo -e "root\nroot" | chroot squeeze passwd
16     echo -e "auto lo\niface lo inet loopback\nauto eth0\niface eth0 inet dhcp" \
17     > squeeze/etc/network/interfaces
18     ln -sf vimrc squeeze/etc/vimrc.tiny
19     rm -f squeeze/etc/udev/rules.d/70-persistent-net.rules
20     echo kvm > squeeze/etc/hostname
21     echo cgroup /mnt/cgroup cgroup defaults >> squeeze/etc/fstab
22     mkdir -p squeeze/mnt/cgroup
23    
24     BLOCKS=$(((1024*$(du -m -s squeeze | awk '{print $1}')*12)/10))
25     genext2fs -z -d squeeze -b $BLOCKS -i 1024 squeeze.ext3
26     resize2fs squeeze.ext3 1G
27     tune2fs -j -c 0 -i 0 squeeze.ext3
28 dpavlin 250
29     chown $SUDO_UID:$SUDO_GID squeeze.ext3
30    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26