@@ -74,7 +74,13 @@ if [ $ARCH = "amd64" -a $SUITE = "hardy" ]; then
74
74
FLAVOUR=server
75
75
fi
76
76
77
- addpkg=openssh-server,pciutils,build-essential,git-core,subversion,lxc,linux-image-generic
77
+ addpkg=pciutils,build-essential,git-core,subversion
78
+
79
+ if [ $LXC = " 1" ]; then
80
+ addpkg=$addpkg ,lxc
81
+ else
82
+ addpkg=$addpkg ,linux-image-generic,grub-pc,openssh-server
83
+ fi
78
84
79
85
# Remove cron to work around vmbuilder issue when umounting /dev on target
80
86
removepkg=cron
@@ -99,26 +105,40 @@ if [ $VBOX = "1" ]; then
99
105
exit 0
100
106
fi
101
107
102
- if [ -e $OUT .qcow2 ]; then
103
- echo $OUT .qcow2 already exists, please remove it first
104
- exit 1
108
+ if [ $LXC = " 1" ]; then
109
+ if [ -e $OUT ]; then
110
+ echo $OUT already exists, please remove it first
111
+ # exit 1
112
+ fi
113
+ else
114
+ if [ -e $OUT .qcow2 ]; then
115
+ echo $OUT .qcow2 already exists, please remove it first
116
+ exit 1
117
+ fi
105
118
fi
106
119
107
- libexec/config-bootstrap-fixup
108
- rm -rf $OUT
109
- env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo vmbuilder kvm ubuntu --rootsize 10240 --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=` pwd` /target-bin/bootstrap-fixup
110
- mv $OUT /* .qcow2 $OUT .qcow2
111
- rm -rf $OUT
112
-
113
120
if [ $LXC = " 1" ]; then
114
- # sudo debootstrap --include=$addpkg --arch=$ARCH $SUITE $OUT-root $MIRROR
115
- echo Extracting partition for lxc
116
- qemu-img convert $OUT .qcow2 $OUT .raw
117
- loop=` sudo kpartx -av $OUT .raw| sed -n ' /loop.p1/{s/.*loop\(.\)p1.*/\1/;p}' `
118
- sudo cp --sparse=always /dev/mapper/loop${loop} p1 $OUT
119
- sudo chown $USER $OUT
120
- sudo kpartx -d /dev/loop$loop
121
- rm -f $OUT .raw
121
+ sudo rm -rf $OUT -bootstrap
122
+ # Need universe for lxc in lucid
123
+ env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo debootstrap --arch=$ARCH --include=$addpkg --exclude=$removepkg --components=main,universe $SUITE $OUT -bootstrap $MIRROR
124
+ dd if=/dev/zero of=$OUT -lxc bs=1M count=1 seek=10240
125
+ mkfs.ext4 $OUT -lxc
126
+ t=` mktemp -d gitian.XXXXXXXX`
127
+ sudo mount $OUT -lxc $t
128
+ sudo cp -a $OUT -bootstrap/* $t
129
+ sudo umount $t
130
+ rmdir $t
131
+
132
+ sudo rm -rf $OUT -bootstrap
133
+ mv $OUT -lxc $OUT
122
134
# bootstrap-fixup is done in libexec/make-clean-vm
135
+ else
136
+ libexec/config-bootstrap-fixup
137
+
138
+ rm -rf $OUT
139
+ env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo vmbuilder kvm ubuntu --rootsize 10240 --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=` pwd` /target-bin/bootstrap-fixup
140
+ mv $OUT /* .qcow2 $OUT .qcow2
141
+ rm -rf $OUT
142
+ # bootstrap-fixup is done on first boot
123
143
fi
124
144
0 commit comments