summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xAttic/archauto.sh140
-rwxr-xr-xAttic/copy_local_packages.sh35
-rw-r--r--README19
-rwxr-xr-xarchauto.sh138
-rwxr-xr-xcopy_local_packages.sh2
-rwxr-xr-xcreatevm.sh47
6 files changed, 281 insertions, 100 deletions
diff --git a/Attic/archauto.sh b/Attic/archauto.sh
new file mode 100755
index 0000000..9feca5e
--- /dev/null
+++ b/Attic/archauto.sh
@@ -0,0 +1,140 @@
+#!/bin/bash -x
+
+{
+
+INSTALL_DRIVE=/dev/sda
+PARTITION_BOOT=1
+PARTITION_SWAP=2
+PARTITION_ROOT=3
+LABEL_BOOT=BOOT
+LABEL_SWAP=SWAP
+LABEL_ROOT=ROOT
+MOUNT_PATH=/mnt
+GIT_REPO=git://andreasbaumann.dyndns.org/cfenginetests.git
+
+echo "Installing minimalistic base system.."
+
+sgdisk -Z ${INSTALL_DRIVE}
+sgdisk -a 2048 -o ${INSTALL_DRIVE}
+
+sgdisk -n ${PARTITION_BOOT}:0:+100M ${INSTALL_DRIVE}
+sgdisk -t ${PARTITION_BOOT}:ef02 ${INSTALL_DRIVE}
+sgdisk -c ${PARTITION_BOOT}:"${LABEL_BOOT}" ${INSTALL_DRIVE}
+
+sgdisk -n ${PARTITION_SWAP}:0:+900M ${INSTALL_DRIVE}
+sgdisk -t ${PARTITION_SWAP}:8200 ${INSTALL_DRIVE}
+sgdisk -c ${PARTITION_SWAP}:"${LABEL_SWAP}" ${INSTALL_DRIVE}
+
+sgdisk -n ${PARTITION_ROOT}:0:0 ${INSTALL_DRIVE}
+sgdisk -t ${PARTITION_ROOT}:8300 ${INSTALL_DRIVE}
+sgdisk -c ${PARTITION_ROOT}:"${LABEL_ROOT}" ${INSTALL_DRIVE}
+
+sgdisk -G ${INSTALL_DRIVE}
+
+mkswap ${INSTALL_DRIVE}${PARTITION_SWAP}
+swapon ${INSTALL_DRIVE}${PARTITION_SWAP}
+mkfs.ext4 ${INSTALL_DRIVE}${PARTITION_ROOT}
+#mkfs.ext4 ${INSTALL_DRIVE}${PARTITION_BOOT}
+
+mkdir -p ${MOUNT_PATH}
+mount ${INSTALL_DRIVE}${PARTITION_ROOT} ${MOUNT_PATH}
+#mkdir ${MOUNT_PATH}/boot
+#mount ${INSTALL_DRIVE}${PARTITION_BOOT} ${MOUNT_PATH}/boot
+
+#export http_proxy=http://192.168.1.12:3128
+export no_proxy=localhost,10.0.2.2
+
+# use our local cache
+sed -i '/\[core\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' /etc/pacman.conf
+sed -i '/\[extra\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' /etc/pacman.conf
+sed -i '/\[community\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' /etc/pacman.conf
+
+# switch off signature for now
+sed -i 's/^SigLevel.*/SigLevel = Never/g' /etc/pacman.conf
+
+pacstrap ${MOUNT_PATH} filesystem grep findutils coreutils glibc bash pacman mkinitcpio linux dhcpcd systemd
+
+# use our local cache in installed pacman
+sed -i '/\[core\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' ${MOUNT_PATH}/etc/pacman.conf
+sed -i '/\[extra\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' ${MOUNT_PATH}/etc/pacman.conf
+sed -i '/\[community\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' ${MOUNT_PATH}/etc/pacman.conf
+
+# add our local packages into a separate repository
+printf "\n[myrepo]\nServer = http://10.0.2.2:8080/\044repo/os/\044arch\n" >> ${MOUNT_PATH}/etc/pacman.conf
+
+# synchronize package databases for installed pacman
+arch-chroot ${MOUNT_PATH} pacman -Sy
+
+# switch off signature for now in installed pacman
+sed -i 's/^SigLevel.*/SigLevel = Never/g' ${MOUNT_PATH}/etc/pacman.conf
+
+arch-chroot ${MOUNT_PATH} pacman --noconfirm -S grub-bios sed
+mkdir ${MOUNT_PATH}/boot/grub/locale/
+cp ${MOUNT_PATH}/usr/share/locale/en@quot/LC_MESSAGES/grub.mo ${MOUNT_PATH}/boot/grub/locale/en.mo
+# disable quiet mode, set text mode instead of graphical mode
+# also ban cirrus KVM
+# set correct path of systemd binary (symlink /sbin/init has gone)
+sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="modprobe.blacklist=cirrus init=\/usr\/lib\/systemd\/systemd console=ttyS0,9600n8"/g' ${MOUNT_PATH}/etc/default/grub
+sed -i 's/GRUB_GFXMODE=auto/GRUB_GFXMODE=text/g' ${MOUNT_PATH}/etc/default/grub
+sed -i 's/GRUB_TERMINAL_INPUT=console/GRUB_TERMINAL_INPUT=serial/g' ${MOUNT_PATH}/etc/default/grub
+sed -i 's/#GRUB_TERMINAL_OUTPUT=console/GRUB_TERMINAL_OUTPUT=serial/g' ${MOUNT_PATH}/etc/default/grub
+echo 'GRUB_SERIAL_COMMAND="serial --speed=9600 --unit=0 --word=8 --parity=no --stop=1"' >> ${MOUNT_PATH}/etc/default/grub
+arch-chroot ${MOUNT_PATH} grub-mkconfig -o /boot/grub/grub.cfg
+arch-chroot ${MOUNT_PATH} grub-install --target=i386-pc --recheck ${INSTALL_DRIVE}
+
+genfstab -p ${MOUNT_PATH} >> ${MOUNT_PATH}/etc/fstab
+
+sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' ${MOUNT_PATH}/etc/locale.gen
+arch-chroot ${MOUNT_PATH} locale-gen
+echo LANG=en_US.UTF-8 > ${MOUNT_PATH}/etc/locale.conf
+
+ln -s /usr/share/zoneinfo/Europe/Zurich ${MOUNT_PATH}/etc/localtime
+arch-chroot ${MOUNT_PATH} hwclock --systohc --utc
+
+echo "archiso" > ${MOUNT_PATH}/etc/hostname
+
+arch-chroot ${MOUNT_PATH} systemctl enable dhcpcd@ens3.service
+
+arch-chroot ${MOUNT_PATH} sh -c "echo 'root:123qwe' | chpasswd"
+
+# synchronized time is a requirement, install and configure ntp
+# we use a standard NTP server, later we can change that via cfengine
+# we don't have a network here (yet, still chrooted)
+arch-chroot ${MOUNT_PATH} pacman --noconfirm -S ntp
+#while ! ping -c1 0.pool.ntp.org &>/dev/null; do :; done
+#arch-chroot ${MOUNT_PATH} ntpdate 0.pool.ntp.org
+arch-chroot ${MOUNT_PATH} systemctl enable ntpd.service
+
+# monitord needs netstat
+arch-chroot ${MOUNT_PATH} pacman --noconfirm -S net-tools
+
+# we use 'git' to manage our promises
+arch-chroot ${MOUNT_PATH} pacman --noconfirm -S git
+
+arch-chroot ${MOUNT_PATH} pacman --noconfirm -S cfengine
+
+# install rules for the machine from git
+# no net, must be done as cfengine rule, anyway, rule distribution should
+# happen only on generated cfengine masters
+#arch-chroot ${MOUNT_PATH} git clone ${GIT_REPO} /srv/cfengine/masterfiles
+
+# enable cfengine
+arch-chroot ${MOUNT_PATH} systemctl enable cf-execd.service
+arch-chroot ${MOUNT_PATH} systemctl enable cf-monitord.service
+arch-chroot ${MOUNT_PATH} systemctl enable cf-serverd.service
+
+# for debugging
+#echo "Installation.. press any key to reboot."
+#read
+
+echo "Unmounting installation mount points.."
+#umount ${MOUNT_PATH}/boot
+umount ${MOUNT_PATH}
+
+echo "Done.. Rebooting system.."
+sleep 3
+
+systemctl reboot
+
+} 2>&1 | tee -a /dev/ttyS0
+
diff --git a/Attic/copy_local_packages.sh b/Attic/copy_local_packages.sh
new file mode 100755
index 0000000..776d74a
--- /dev/null
+++ b/Attic/copy_local_packages.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+rm -rf {core,extra,community}/os/x86_64/
+mkdir -p {core,extra,community}/os/x86_64/
+
+for p in `cat archiso/arch/pkglist.x86_64.txt`; do
+ case $p in
+ core/*)
+ pkgname=`echo $p | cut -f 2 -d /`
+ if test -f /var/cache/pacman/pkg/$pkgname*x86_64.pkg.tar.xz; then
+ cp /var/cache/pacman/pkg/$pkgname*x86_64.pkg.tar.xz core/os/x86_64/.
+ fi
+ if test -f /var/cache/pacman/pkg/$pkgname*any.pkg.tar.xz; then
+ cp /var/cache/pacman/pkg/$pkgname*any.pkg.tar.xz core/os/x86_64/.
+ fi
+ ;;
+ esac
+done
+
+ADDITIONAL_PKGS="libunistring-0.9.3-6 ntp-4.2.7.p441-1 joe-3.7-4 git-1.9.2-1 perl-error-0.17022-1 libxml2-2.9.1-5"
+for pkgname in $ADDITIONAL_PKGS; do
+ if test -f /var/cache/pacman/pkg/$pkgname*x86_64.pkg.tar.xz; then
+ cp /var/cache/pacman/pkg/$pkgname*x86_64.pkg.tar.xz core/os/x86_64/.
+ fi
+ if test -f /var/cache/pacman/pkg/$pkgname*any.pkg.tar.xz; then
+ cp /var/cache/pacman/pkg/$pkgname*any.pkg.tar.xz core/os/x86_64/.
+ fi
+done
+
+repo-add -n core/os/x86_64/core.db.tar.gz core/os/x86_64/*
+ln -fs core.db.tar.gz core/os/x86_64/core.db
+tar zcvfT extra/os/x86_64/extra.db.tar.gz /dev/null
+ln -fs extra.db.tar.gz extra/os/x86_64/extra.db
+tar zcvfT community/os/x86_64/community.db.tar.gz /dev/null
+ln -fs community.db.tar.gz community/os/x86_64/community.db
diff --git a/README b/README
index 8344d6f..c373235 100644
--- a/README
+++ b/README
@@ -31,8 +31,8 @@ darkhttpd . --port 8080 &
# mirror now, basic packages should all exist on the host)
./copy_local_packages.sh
-TFTP root
---------
+TFTP root (for PXE boot)
+---------
Copy PXE bootstrap files to a TFTP root:
@@ -42,6 +42,12 @@ cp archiso/arch/boot/x86_64/archiso.img tftproot/boot/x86_64/
cp /usr/lib/syslinux/bios/pxelinux.0 tftproot
cp /usr/lib/syslinux/bios/ldlinux.c32 tftproot
+Local kernel and RAMdisk (for libvirt direct kernel boot)
+------------------------
+
+cp archiso/arch/boot/x86_64/vmlinuz .
+cp archiso/arch/boot/x86_64/archiso.img .
+
Custom software from AUR
------------------------
@@ -68,7 +74,7 @@ cp INSTALL/*/*pkg.tar.xz myrepo/os/x86_64/.
repo-add myrepo/os/x86_64/myrepo.db.tar.gz myrepo/os/x86_64/*
-Install Archlinux
+Install Archlinux (PXE and qemu directly)
-----------------
Create a Qemu image with Archlinux (automatically). The main
@@ -83,6 +89,13 @@ qemu-system-x86_64 -drive file=arch.img,index=0,media=disk,format=raw -net nic \
-machine accel=kvm -redir tcp:222::22 \
-nographic -serial mon:stdio |& tee log
+Install Archlinux (libvirtd and virt-install)
+-----------------
+
+There are quite some steps here, so they are wrapped into a shell script:
+
+./createvm.sh
+
TODOs
-----
diff --git a/archauto.sh b/archauto.sh
index 9feca5e..9fc002c 100755
--- a/archauto.sh
+++ b/archauto.sh
@@ -1,88 +1,57 @@
-#!/bin/bash -x
+#!/bin/bash
-{
+# configuration
-INSTALL_DRIVE=/dev/sda
+INSTALL_DRIVE=/dev/vda
PARTITION_BOOT=1
-PARTITION_SWAP=2
-PARTITION_ROOT=3
-LABEL_BOOT=BOOT
-LABEL_SWAP=SWAP
+PARTITION_ROOT=2
LABEL_ROOT=ROOT
MOUNT_PATH=/mnt
-GIT_REPO=git://andreasbaumann.dyndns.org/cfenginetests.git
+HTTP_SERVER=http://eurobuild3.lan:8080
+HOSTNAME=archlinux
+NTP_SERVER=192.168.1.1
-echo "Installing minimalistic base system.."
-
-sgdisk -Z ${INSTALL_DRIVE}
-sgdisk -a 2048 -o ${INSTALL_DRIVE}
-
-sgdisk -n ${PARTITION_BOOT}:0:+100M ${INSTALL_DRIVE}
-sgdisk -t ${PARTITION_BOOT}:ef02 ${INSTALL_DRIVE}
-sgdisk -c ${PARTITION_BOOT}:"${LABEL_BOOT}" ${INSTALL_DRIVE}
-
-sgdisk -n ${PARTITION_SWAP}:0:+900M ${INSTALL_DRIVE}
-sgdisk -t ${PARTITION_SWAP}:8200 ${INSTALL_DRIVE}
-sgdisk -c ${PARTITION_SWAP}:"${LABEL_SWAP}" ${INSTALL_DRIVE}
+echo "Partitioning and creating filesystem.."
-sgdisk -n ${PARTITION_ROOT}:0:0 ${INSTALL_DRIVE}
-sgdisk -t ${PARTITION_ROOT}:8300 ${INSTALL_DRIVE}
-sgdisk -c ${PARTITION_ROOT}:"${LABEL_ROOT}" ${INSTALL_DRIVE}
+wipefs -a ${INSTALL_DRIVE}
+printf ",128M,L,*\n" | /sbin/sfdisk -f ${INSTALL_DRIVE}
+printf ",,L,*\n" | /sbin/sfdisk -a -f ${INSTALL_DRIVE}
-sgdisk -G ${INSTALL_DRIVE}
-
-mkswap ${INSTALL_DRIVE}${PARTITION_SWAP}
-swapon ${INSTALL_DRIVE}${PARTITION_SWAP}
+mkfs.ext2 ${INSTALL_DRIVE}${PARTITION_BOOT}
mkfs.ext4 ${INSTALL_DRIVE}${PARTITION_ROOT}
-#mkfs.ext4 ${INSTALL_DRIVE}${PARTITION_BOOT}
-mkdir -p ${MOUNT_PATH}
mount ${INSTALL_DRIVE}${PARTITION_ROOT} ${MOUNT_PATH}
-#mkdir ${MOUNT_PATH}/boot
-#mount ${INSTALL_DRIVE}${PARTITION_BOOT} ${MOUNT_PATH}/boot
-
-#export http_proxy=http://192.168.1.12:3128
-export no_proxy=localhost,10.0.2.2
+mkdir ${MOUNT_PATH}/boot
+mount ${INSTALL_DRIVE}${PARTITION_BOOT} ${MOUNT_PATH}/boot
-# use our local cache
-sed -i '/\[core\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' /etc/pacman.conf
-sed -i '/\[extra\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' /etc/pacman.conf
-sed -i '/\[community\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' /etc/pacman.conf
+echo "Installing minimalistic base system.."
-# switch off signature for now
sed -i 's/^SigLevel.*/SigLevel = Never/g' /etc/pacman.conf
-pacstrap ${MOUNT_PATH} filesystem grep findutils coreutils glibc bash pacman mkinitcpio linux dhcpcd systemd
+sed -i "/\[core\]/aServer = ${HTTP_SERVER}/\$repo/os/\$arch" /etc/pacman.conf
+sed -i "/\[extra\]/aServer = ${HTTP_SERVER}/\$repo/os/\$arch" /etc/pacman.conf
+sed -i "/\[community\]/aServer = ${HTTP_SERVER}/\$repo/os/\$arch" /etc/pacman.conf
+
+pacstrap ${MOUNT_PATH} filesystem grep findutils coreutils glibc bash pacman mkinitcpio linux dhcpcd systemd sed systemd-sysvcompat
-# use our local cache in installed pacman
-sed -i '/\[core\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' ${MOUNT_PATH}/etc/pacman.conf
-sed -i '/\[extra\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' ${MOUNT_PATH}/etc/pacman.conf
-sed -i '/\[community\]/aServer = http://10.0.2.2:8080/$repo/os/$arch' ${MOUNT_PATH}/etc/pacman.conf
+sed -i 's/^SigLevel.*/SigLevel = Never/g' ${MOUNT_PATH}/etc/pacman.conf
-# add our local packages into a separate repository
-printf "\n[myrepo]\nServer = http://10.0.2.2:8080/\044repo/os/\044arch\n" >> ${MOUNT_PATH}/etc/pacman.conf
+sed -i "/\[core\]/aServer = ${HTTP_SERVER}/\$repo/os/\$arch" ${MOUNT_PATH}/etc/pacman.conf
+sed -i "/\[extra\]/aServer = ${HTTP_SERVER}/\$repo/os/\$arch" ${MOUNT_PATH}/etc/pacman.conf
+sed -i "/\[community\]/aServer = ${HTTP_SERVER}/\$repo/os/\$arch" ${MOUNT_PATH}/etc/pacman.conf
-# synchronize package databases for installed pacman
arch-chroot ${MOUNT_PATH} pacman -Sy
-# switch off signature for now in installed pacman
-sed -i 's/^SigLevel.*/SigLevel = Never/g' ${MOUNT_PATH}/etc/pacman.conf
+echo "Installing boot loader.."
-arch-chroot ${MOUNT_PATH} pacman --noconfirm -S grub-bios sed
-mkdir ${MOUNT_PATH}/boot/grub/locale/
-cp ${MOUNT_PATH}/usr/share/locale/en@quot/LC_MESSAGES/grub.mo ${MOUNT_PATH}/boot/grub/locale/en.mo
-# disable quiet mode, set text mode instead of graphical mode
-# also ban cirrus KVM
-# set correct path of systemd binary (symlink /sbin/init has gone)
-sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="modprobe.blacklist=cirrus init=\/usr\/lib\/systemd\/systemd console=ttyS0,9600n8"/g' ${MOUNT_PATH}/etc/default/grub
-sed -i 's/GRUB_GFXMODE=auto/GRUB_GFXMODE=text/g' ${MOUNT_PATH}/etc/default/grub
-sed -i 's/GRUB_TERMINAL_INPUT=console/GRUB_TERMINAL_INPUT=serial/g' ${MOUNT_PATH}/etc/default/grub
-sed -i 's/#GRUB_TERMINAL_OUTPUT=console/GRUB_TERMINAL_OUTPUT=serial/g' ${MOUNT_PATH}/etc/default/grub
-echo 'GRUB_SERIAL_COMMAND="serial --speed=9600 --unit=0 --word=8 --parity=no --stop=1"' >> ${MOUNT_PATH}/etc/default/grub
+genfstab -p ${MOUNT_PATH} > ${MOUNT_PATH}/etc/fstab
+
+arch-chroot ${MOUNT_PATH} pacman --noconfirm -S grub
+sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT.*/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/g' ${MOUNT_PATH}/etc/default/grub
arch-chroot ${MOUNT_PATH} grub-mkconfig -o /boot/grub/grub.cfg
-arch-chroot ${MOUNT_PATH} grub-install --target=i386-pc --recheck ${INSTALL_DRIVE}
+arch-chroot ${MOUNT_PATH} grub-install --force /dev/vda
-genfstab -p ${MOUNT_PATH} >> ${MOUNT_PATH}/etc/fstab
+echo "Configuring base system.."
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' ${MOUNT_PATH}/etc/locale.gen
arch-chroot ${MOUNT_PATH} locale-gen
@@ -91,50 +60,27 @@ echo LANG=en_US.UTF-8 > ${MOUNT_PATH}/etc/locale.conf
ln -s /usr/share/zoneinfo/Europe/Zurich ${MOUNT_PATH}/etc/localtime
arch-chroot ${MOUNT_PATH} hwclock --systohc --utc
-echo "archiso" > ${MOUNT_PATH}/etc/hostname
+echo ${HOSTNAME} > ${MOUNT_PATH}/etc/hostname
arch-chroot ${MOUNT_PATH} systemctl enable dhcpcd@ens3.service
-arch-chroot ${MOUNT_PATH} sh -c "echo 'root:123qwe' | chpasswd"
+arch-chroot ${MOUNT_PATH} sh -c "echo 'root:xx' | chpasswd"
-# synchronized time is a requirement, install and configure ntp
-# we use a standard NTP server, later we can change that via cfengine
-# we don't have a network here (yet, still chrooted)
arch-chroot ${MOUNT_PATH} pacman --noconfirm -S ntp
-#while ! ping -c1 0.pool.ntp.org &>/dev/null; do :; done
-#arch-chroot ${MOUNT_PATH} ntpdate 0.pool.ntp.org
-arch-chroot ${MOUNT_PATH} systemctl enable ntpd.service
-# monitord needs netstat
-arch-chroot ${MOUNT_PATH} pacman --noconfirm -S net-tools
+arch-chroot ${MOUNT_PATH} ntpdate ${NTP_SERVER}
-# we use 'git' to manage our promises
-arch-chroot ${MOUNT_PATH} pacman --noconfirm -S git
+sed -i 's/^server/#server/g' ${MOUNT_PATH}/etc/ntp.conf
+echo "server ${NTP_SERVER}" >> ${MOUNT_PATH}/etc/ntp.conf
-arch-chroot ${MOUNT_PATH} pacman --noconfirm -S cfengine
-
-# install rules for the machine from git
-# no net, must be done as cfengine rule, anyway, rule distribution should
-# happen only on generated cfengine masters
-#arch-chroot ${MOUNT_PATH} git clone ${GIT_REPO} /srv/cfengine/masterfiles
-
-# enable cfengine
-arch-chroot ${MOUNT_PATH} systemctl enable cf-execd.service
-arch-chroot ${MOUNT_PATH} systemctl enable cf-monitord.service
-arch-chroot ${MOUNT_PATH} systemctl enable cf-serverd.service
+arch-chroot ${MOUNT_PATH} systemctl enable ntpd.service
-# for debugging
-#echo "Installation.. press any key to reboot."
-#read
+echo "Unmounting.."
-echo "Unmounting installation mount points.."
-#umount ${MOUNT_PATH}/boot
+umount ${MOUNT_PATH}/boot
umount ${MOUNT_PATH}
-echo "Done.. Rebooting system.."
-sleep 3
-
-systemctl reboot
+echo "Powering off.."
-} 2>&1 | tee -a /dev/ttyS0
-
+sleep 10
+systemctl poweroff
diff --git a/copy_local_packages.sh b/copy_local_packages.sh
index 776d74a..c7110d7 100755
--- a/copy_local_packages.sh
+++ b/copy_local_packages.sh
@@ -17,7 +17,7 @@ for p in `cat archiso/arch/pkglist.x86_64.txt`; do
esac
done
-ADDITIONAL_PKGS="libunistring-0.9.3-6 ntp-4.2.7.p441-1 joe-3.7-4 git-1.9.2-1 perl-error-0.17022-1 libxml2-2.9.1-5"
+ADDITIONAL_PKGS="ntp-4.2.8.p8-1"
for pkgname in $ADDITIONAL_PKGS; do
if test -f /var/cache/pacman/pkg/$pkgname*x86_64.pkg.tar.xz; then
cp /var/cache/pacman/pkg/$pkgname*x86_64.pkg.tar.xz core/os/x86_64/.
diff --git a/createvm.sh b/createvm.sh
new file mode 100755
index 0000000..0edf671
--- /dev/null
+++ b/createvm.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+vm_is_running() {
+ if [ "$(virsh domstate $1 2>/dev/null)" == "running" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+wait_for_vm_to_stop() {
+ while vm_is_running $1; do
+ sleep 1
+ done
+}
+
+NAME=archlinux
+
+mount -o loop,ro archlive/out/archlinux-2016.09.30-dual.iso archiso
+
+darkhttpd . --port 8080 &
+
+virt-install --name ${NAME} -r 1024 --vcpus=1 --os-type=linux --os-variant=virtio26 \
+ --disk pool=local,size=2,format=qcow2 --network network=virt0,model=virtio \
+ --vnc --vncport=5901 --noreboot --noautoconsole \
+ --boot kernel=vmlinuz,initrd=archiso.img,kernel_args="archisobasedir=archiso/arch archiso_http_srv=http://eurobuild3.lan:8080/ script=http://eurobuild3.lan:8080/archauto.sh ip=dhcp" &
+
+sleep 5
+
+virsh start ${NAME}
+
+sleep 5
+
+wait_for_vm_to_stop ${NAME}
+
+virsh dumpxml ${NAME} > ${NAME}.xml
+
+xmlstarlet ed -d '/domain/os/kernel' ${NAME}.xml | xmlstarlet ed -d '/domain/os/initrd' | xmlstarlet ed -d '/domain/os/cmdline' > ${NAME}-new.xml
+
+virsh define ${NAME}-new.xml
+
+virsh start ${NAME}
+
+rm -f ${NAME}-new.xml ${NAME}.xml
+
+pkill darkhttpd
+umount archiso