diff --git a/clean_images/clean-starter.img.tar b/clean_images/clean-starter.img.tar deleted file mode 100644 index 8f61c17..0000000 Binary files a/clean_images/clean-starter.img.tar and /dev/null differ diff --git a/clean_images/clean-volatile.img.tar b/clean_images/clean-volatile.img.tar new file mode 100644 index 0000000..81622f2 Binary files /dev/null and b/clean_images/clean-volatile.img.tar differ diff --git a/cleanup_image b/cleanup_image index ec17beb..b40f0b6 100755 --- a/cleanup_image +++ b/cleanup_image @@ -13,7 +13,7 @@ if ! [ -f $IMG ]; then exit 1 fi ls -als $IMG -mount -o loop,offset=$((63*512)) $IMG mnt || exit 1 +mount -o loop $IMG mnt || exit 1 INSTALLDIR=`pwd`/mnt/ yum clean packages --installroot=$INSTALLDIR dd if=/dev/zero of=mnt/fillme bs=1M diff --git a/fedorize_image b/fedorize_image index fd3d830..f8c723f 100755 --- a/fedorize_image +++ b/fedorize_image @@ -11,17 +11,18 @@ fi if [ -f $IMG ]; then echo "-> Image file already exists, assuming *update*..." - mount -o loop,offset=$((63*512)) $IMG mnt || exit 1 + mount -o loop $IMG mnt || exit 1 INSTALLDIR=`pwd`/mnt/ else - echo "-> Initializing empty image with part table and filesystems..." - tar kOxf clean_images/clean-starter.img.tar > $IMG + echo "-> Initializing empty image..." + truncate -s 10G $IMG || exit 1 - touch $IMG || exit 1 + echo "-> Creating filesystem..." + mkfs.ext4 -F $IMG || exit 1 mkdir -p mnt - mount -o loop,offset=$((63*512)) $IMG mnt || exit 1 + mount -o loop $IMG mnt || exit 1 INSTALLDIR=`pwd`/mnt/ diff --git a/qubeize_image b/qubeize_image index a586921..bb38218 100755 --- a/qubeize_image +++ b/qubeize_image @@ -33,7 +33,7 @@ cp $CLEANIMG $IMG || exit 1 echo "--> Mouting $IMG" mkdir -p mnt -mount -o loop,offset=$((63*512)) $IMG mnt || exit 1 +mount -o loop $IMG mnt || exit 1 echo "--> Installing RPMs..." rpm --force --root=$(pwd)/mnt -ihv rpms_to_install/* diff --git a/templates.spec b/templates.spec index ea8c481..48e2412 100644 --- a/templates.spec +++ b/templates.spec @@ -40,6 +40,8 @@ for i in qubeized_images/root.img.part.* ; do ln $i $RPM_BUILD_ROOT/%{dest_dir}/ touch $RPM_BUILD_ROOT/%{dest_dir}/root.img # we will create the real file in %post touch $RPM_BUILD_ROOT/%{dest_dir}/private.img # we will create the real file in %post +cp clean_images/clean-volatile.img.tar $RPM_BUILD_ROOT/%{dest_dir}/clean-volatile.img.tar + cp vm_conf_files/appvm-template.conf $RPM_BUILD_ROOT/%{dest_dir}/appvm-template.conf cp vm_conf_files/netvm-template.conf $RPM_BUILD_ROOT/%{dest_dir}/netvm-template.conf cp vm_conf_files/templatevm.conf $RPM_BUILD_ROOT/%{dest_dir}/templatevm.conf @@ -78,6 +80,9 @@ mv %{dest_dir}/%{template_name}-root.img %{dest_dir}/root.img chown root.qubes %{dest_dir}/root.img chmod 0660 %{dest_dir}/root.img +echo "--> Processing the clean-volatile.img..." +tar --sparse -xf {dest_dir}/clean-volatile.img.tar -C %{dest_dir} + if [ "$1" = 1 ] ; then # installing for the first time echo "--> Creating private.img..." @@ -126,6 +131,8 @@ rm -rf $RPM_BUILD_ROOT %dir %{dest_dir} %ghost %{dest_dir}/root.img %{dest_dir}/root.img.part.* +%ghost %{dest_dir}/clean-volatile.img +%{dest_dir}/clean-volatile.img.tar %ghost %{dest_dir}/private.img %{dest_dir}/appvm-template.conf %{dest_dir}/netvm-template.conf diff --git a/vm_conf_files/appvm-template.conf b/vm_conf_files/appvm-template.conf index efccaa7..4301188 100644 --- a/vm_conf_files/appvm-template.conf +++ b/vm_conf_files/appvm-template.conf @@ -12,8 +12,7 @@ name = "%VMNAME%" disk = [ 'snapshot:%TEMPLATEDIR%/root.img:%TEMPLATEDIR%/root-cow.img,xvda,r', 'file:%VMDIR%/private.img,xvdb,w', - 'file:%VMDIR%/root-cow.img,xvdc,w', - 'file:%VMDIR%/swap-cow.img,xvdd,w' + 'file:%VMDIR%/volatile.img,xvdc,w', ] vcpus = %VCPUS% diff --git a/vm_conf_files/netvm-template.conf b/vm_conf_files/netvm-template.conf index 266c861..56091e0 100644 --- a/vm_conf_files/netvm-template.conf +++ b/vm_conf_files/netvm-template.conf @@ -14,8 +14,7 @@ pci = [ %PCIDEVS% ] disk = [ 'snapshot:%TEMPLATEDIR%/root.img:%TEMPLATEDIR%/root-cow.img,xvda,r', 'file:%VMDIR%/private.img,xvdb,w', - 'file:%VMDIR%/root-cow.img,xvdc,w', - 'file:%VMDIR%/swap-cow.img,xvdd,w' + 'file:%VMDIR%/volatile.img,xvdc,w', ] vcpus = %VCPUS% diff --git a/vm_conf_files/standalone-template.conf b/vm_conf_files/standalone-template.conf index 024f476..ccbcd4d 100644 --- a/vm_conf_files/standalone-template.conf +++ b/vm_conf_files/standalone-template.conf @@ -12,6 +12,7 @@ name = "%VMNAME%" disk = [ 'file:%VMDIR%/root.img,xvda,w', 'file:%VMDIR%/private.img,xvdb,w' + 'file:%VMDIR%/volatile.img,xvdc,w' ] vcpus = %VCPUS% diff --git a/vm_conf_files/templatevm.conf b/vm_conf_files/templatevm.conf index 2cc51de..f4ae0e4 100644 --- a/vm_conf_files/templatevm.conf +++ b/vm_conf_files/templatevm.conf @@ -12,6 +12,7 @@ name = "%TEMPLATENAME%" disk = [ 'origin:/var/lib/qubes/vm-templates/%TEMPLATENAME%/root.img:/var/lib/qubes/vm-templates/%TEMPLATENAME%/root-cow.img,xvda,w', 'file:/var/lib/qubes/vm-templates/%TEMPLATENAME%/private.img,xvdb,w', + 'file:/var/lib/qubes/vm-templates/%TEMPLATENAME%/volatile.img,xvdc,w', ] vcpus = 1 diff --git a/vm_initramfs_patches/qubes_cow_setup.sh b/vm_initramfs_patches/qubes_cow_setup.sh index 0944da9..117d257 100755 --- a/vm_initramfs_patches/qubes_cow_setup.sh +++ b/vm_initramfs_patches/qubes_cow_setup.sh @@ -13,25 +13,19 @@ modprobe xenblk || modprobe xen-blkfront || echo "Qubes: Cannot load Xen Block F echo "Waiting for /dev/xvda* devices..." while ! [ -e /dev/xvda ]; do sleep 0.1; done -while ! [ -e /dev/xvda1 ] ; do sleep 0.1; done -while ! [ -e /dev/xvda2 ] ; do sleep 0.1; done if [ `blockdev --getro /dev/xvda` = 1 ] ; then echo "Qubes: Doing COW setup for AppVM..." while ! [ -e /dev/xvdc ]; do sleep 0.1; done - while ! [ -e /dev/xvdd ]; do sleep 0.1; done + while ! [ -e /dev/xvdc2 ]; do sleep 0.1; done - echo "0 `blockdev --getsz /dev/xvda1` snapshot /dev/xvda1 /dev/xvdc P 16" | \ + echo "0 `blockdev --getsz /dev/xvda` snapshot /dev/xvda /dev/xvdc2 P 16" | \ dmsetup create dmroot || { echo "Qubes: FATAL: cannot create dmroot!"; } - echo "0 `blockdev --getsz /dev/xvda2` snapshot /dev/xvda2 /dev/xvdd P 16" | \ - dmsetup create dmswap || { echo "Qubes: FATAL: cannot create dmswap!"; } echo Qubes: done. else echo "Qubes: Doing R/W setup for TemplateVM..." - echo "0 `blockdev --getsz /dev/xvda1` linear /dev/xvda1 0" | \ + echo "0 `blockdev --getsz /dev/xvda` linear /dev/xvda 0" | \ dmsetup create dmroot || { echo "Qubes: FATAL: cannot create dmroot!"; exit 1; } - echo "0 `blockdev --getsz /dev/xvda2` linear /dev/xvda2 0" | \ - dmsetup create dmswap || { echo "Qubes: FATAL: cannot create dmswap!"; exit 1; } echo Qubes: done. fi