]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/xen-image/xen-image-maker.sh
xen-image-maker: fix linux-pae metafile create.
[people/teissler/ipfire-2.x.git] / config / xen-image / xen-image-maker.sh
index 4a7c7f2a7e3500fd11a5ab6ba4fb05f3ecc40539..4f632805e130a72379f7e0857ef263bfb04f1911 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2013  Arne Fitzenreiter  <arne_f@ipfire.org>             #
+# Copyright (C) 2007-2014  Arne Fitzenreiter  <arne_f@ipfire.org>             #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -27,23 +27,13 @@ KERN_TYPE=pae
 KVER=xxxKVERxxx
 KERN_PACK=xxxKERN_PACKxxx
 KRNDOWN=http://mirror0.ipfire.org/pakfire2/$VERSION/paks
+CONSOLE=hvc0
 
-###############################################################################
-# If you really want to use  outdated legacy kernel uncomment this lines. #####
-# Not recommended!!! ##########################################################
-######################
-#KERN_TYPE=xen
-#KVER=2.6.32.61
-#KERN_PACK=27
-#KRNDOWN=http://mirror0.ipfire.org/pakfire2/2.13/paks
-###############################################################################
-
-SIZEboot=30
+SIZEboot=64
 SIZEswap=512
-SIZEroot=512
-SIZEvar=950
-# ct'server does not support ext4 so change this to ext3.
-FSTYPE=ext4
+SIZEroot=1024
+SIZEvar=1024
+FSTYPE=ext3
 
 ##############################################################################
 
@@ -61,6 +51,25 @@ IMGvar=./$SNAME-var.img
 
 KERNEL=linux-$KERN_TYPE-$KVER-$KERN_PACK.ipfire
 
+if [ "$XEN_IMG_TYPE" == "xva" ]; then
+       # download xva.py if it not exist.
+       if [ ! -e xva.py ]; then
+               wget http://source.ipfire.org/source-2.x/xva.py
+       fi
+       # XenCenter use other devicenames and
+       # xvdd seems to be reserved (converter bug?).
+       P1=xvda
+       P2=xvdb
+       P3=xvdc
+       P4=xvde
+else
+       # old style xen image partition names
+       P1=xvda1
+       P2=xvda2
+       P3=xvda3
+       P4=xvda4
+fi
+
 rm -rf $TMPDIR && mkdir -p $MNThdd && mkdir -p $ISODIR
 echo --------------------------------------------------------
 echo - Download $SOURCEISO ...
@@ -107,11 +116,12 @@ mount -o loop $IMGboot $MNThdd/boot
 mount -o loop $IMGvar $MNThdd/var
 
 # Install IPFire without kernel modules
-tar -C $MNThdd/ -xvf $ISODIR/$SNAME-$VERSION.tlz --lzma \
-       --exclude=lib/modules* --exclude=boot*
+xz -d < $ISODIR/$SNAME-$VERSION.tlz > $TMPDIR/$SNAME-$VERSION.tar
+tar -C $MNThdd/ -xvf $TMPDIR/$SNAME-$VERSION.tar \
+       --exclude=lib/modules* --exclude=boot* --numeric-owner
 
 #Install Kernel
-tar -C $MNThdd/opt/pakfire/tmp -xvf $TMPDIR/$KERNEL
+tar -C $MNThdd/opt/pakfire/tmp -xvf $TMPDIR/$KERNEL --numeric-owner
 chroot $MNThdd /opt/pakfire/tmp/install.sh
 rm -rf $MNThdd/opt/pakfire/tmp/*
 
@@ -120,7 +130,7 @@ mkdir $MNThdd/boot/grub
 echo "timeout 10"                          > $MNThdd/boot/grub/grub.conf
 echo "default 0"                          >> $MNThdd/boot/grub/grub.conf
 echo "title IPFire ($KERN_TYPE-kernel)"   >> $MNThdd/boot/grub/grub.conf
-echo "  kernel /vmlinuz-$KVER-ipfire-xen root=/dev/xvda3 rootdelay=10 panic=10 console=xvc0 ro" \
+echo "  kernel /vmlinuz-$KVER-ipfire-$KERN_TYPE root=/dev/$P3 rootdelay=10 panic=10 console=$CONSOLE ro" \
                                          >> $MNThdd/boot/grub/grub.conf
 echo "  initrd /ipfirerd-$KVER-$KERN_TYPE.img" >> $MNThdd/boot/grub/grub.conf
 echo "# savedefault 0" >> $MNThdd/boot/grub/grub.conf
@@ -128,16 +138,16 @@ echo "# savedefault 0" >> $MNThdd/boot/grub/grub.conf
 ln -s grub.conf $MNThdd/boot/grub/menu.lst
 
 #create the meta-info of linux-kernel package
-echo ""                       >  $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
-echo "Name: linux-$KERN_TYPE" >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
-echo "ProgVersion: $KVER"     >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
-echo "Release: $KERN_PACK"    >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
-echo ""                       >> $MNThdd/opt/pakfire/db/meta/linux-$KERN_TYPE
-echo ""                       >  $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
-echo "Name: linux-$KERN_TYPE" >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
-echo "ProgVersion: $KVER"     >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
-echo "Release: $KERN_PACK"    >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
-echo ""                       >> $MNThdd/opt/pakfire/db/installed/linux-$KERN_TYPE
+echo ""                       >  $MNThdd/opt/pakfire/db/meta/meta-linux-$KERN_TYPE
+echo "Name: linux-$KERN_TYPE" >> $MNThdd/opt/pakfire/db/meta/meta-linux-$KERN_TYPE
+echo "ProgVersion: $KVER"     >> $MNThdd/opt/pakfire/db/meta/meta-linux-$KERN_TYPE
+echo "Release: $KERN_PACK"    >> $MNThdd/opt/pakfire/db/meta/meta-linux-$KERN_TYPE
+echo ""                       >> $MNThdd/opt/pakfire/db/meta/meta-linux-$KERN_TYPE
+echo ""                       >  $MNThdd/opt/pakfire/db/installed/meta-linux-$KERN_TYPE
+echo "Name: linux-$KERN_TYPE" >> $MNThdd/opt/pakfire/db/installed/meta-linux-$KERN_TYPE
+echo "ProgVersion: $KVER"     >> $MNThdd/opt/pakfire/db/installed/meta-linux-$KERN_TYPE
+echo "Release: $KERN_PACK"    >> $MNThdd/opt/pakfire/db/installed/meta-linux-$KERN_TYPE
+echo ""                       >> $MNThdd/opt/pakfire/db/installed/meta-linux-$KERN_TYPE
 
 #Set default configuration
 echo "LANGUAGE=en" >> $MNThdd/var/ipfire/main/settings
@@ -149,10 +159,10 @@ mount --bind /proc $MNThdd/proc
 mount --bind /dev  $MNThdd/dev
 mount --bind /sys  $MNThdd/sys
 chroot $MNThdd /usr/bin/perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
-sed -i -e "s|DEVICE1|/dev/xvda1|g" $MNThdd/etc/fstab
-sed -i -e "s|DEVICE2|/dev/xvda2|g" $MNThdd/etc/fstab
-sed -i -e "s|DEVICE3|/dev/xvda3|g" $MNThdd/etc/fstab
-sed -i -e "s|DEVICE4|/dev/xvda4|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE1|/dev/$P1|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE2|/dev/$P2|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE3|/dev/$P3|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE4|/dev/$P4|g" $MNThdd/etc/fstab
 
 sed -i -e "s|FSTYPE|$FSTYPE|g" $MNThdd/etc/fstab
 
@@ -161,12 +171,12 @@ rm -rf $MNThdd/etc/rc.d/rcsysinit.d/S19checkfstab
 #Remove console init
 rm -rf $MNThdd/etc/rc.d/rcsysinit.d/S70console
 
-#Add xvc0 to securetty
-echo xvc0 >> $MNThdd/etc/securetty
+#Add console to securetty
+echo $CONSOLE >> $MNThdd/etc/securetty
 
-#Add getty for xvc0
+#Add getty for console
 echo "#Enable login for XEN" >> $MNThdd/etc/inittab
-echo "8:2345:respawn:/sbin/agetty xvc0 9600" >> $MNThdd/etc/inittab
+echo "8:2345:respawn:/sbin/agetty $CONSOLE 9600 --noclear" >> $MNThdd/etc/inittab
 
 #Disable some initskripts
 echo "#!/bin/sh" > $MNThdd/etc/rc.d/init.d/setclock
@@ -191,6 +201,11 @@ umount $MNThdd
 
 umount $ISODIR
 rm -rf ./ipfire-tmp
+
+if [ "$XEN_IMG_TYPE" == "xva" ]; then
+       python xva.py --sparse -c $SNAME.cfg -f $SNAME.xva
+       rm -f $SNAME*.img
+fi
 echo --------------------------------------------------------
 echo - Done.
 echo --------------------------------------------------------