summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-07-18 14:35:53 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2019-07-18 14:35:53 +0200
commitff449bdafaf5c67e4e9882bd87e7dea1d8728c46 (patch)
tree719ba41d979abf578c97c8471bf09b71192fbf6c
parent879798d7e4b70c1fdc8040f4798a6cdeaf6e6d21 (diff)
downloadarchauto-master.tar.gz
archauto-master.tar.bz2
-rw-r--r--README4
-rwxr-xr-xarchauto.sh16
-rwxr-xr-xcopy_host_packages_to_mirror.sh21
-rwxr-xr-xcreatevm.sh31
4 files changed, 51 insertions, 21 deletions
diff --git a/README b/README
index 4a76723..13aca20 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
Requirements
------------
-pacman -S archiso qemu syslinux darkhttpd
+pacman -S archiso qemu syslinux darkhttpd xmlstarlet
or
-pacman -S libvirt qemu qemu-arch-extra
+pacman -S libvirt qemu qemu-arch-extra xmlstarlet
ArchISO and optional local cache
--------------------------------
diff --git a/archauto.sh b/archauto.sh
index d223af4..f7b2eb8 100755
--- a/archauto.sh
+++ b/archauto.sh
@@ -7,7 +7,7 @@ PARTITION_BOOT=1
PARTITION_ROOT=2
LABEL_ROOT=ROOT
MOUNT_PATH=/mnt
-HTTP_SERVER=http://eurobuild3.lan:8080
+HTTP_SERVER=http://192.168.130.1:8088
HOSTNAME=archlinux
NTP_SERVER=192.168.1.1
@@ -28,18 +28,18 @@ echo "Installing minimalistic base system.."
sed -i 's/^SigLevel.*/SigLevel = Never/g' /etc/pacman.conf
-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
+sed -i "/\[core\]/aServer = ${HTTP_SERVER}/\$arch/\$repo" /etc/pacman.conf
+sed -i "/\[extra\]/aServer = ${HTTP_SERVER}/\$arch/\$repo" /etc/pacman.conf
+sed -i "/\[community\]/aServer = ${HTTP_SERVER}/\$arch/\$repo" /etc/pacman.conf
pacstrap ${MOUNT_PATH} filesystem grep findutils coreutils glibc bash pacman mkinitcpio linux dhcpcd systemd sed systemd-sysvcompat
sed -i 's/^SigLevel.*/SigLevel = Never/g' ${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
-printf "\n[myrepo]\nServer = ${HTTP_SERVER}/\$repo/os/\$arch\n" >> ${MOUNT_PATH}/etc/pacman.conf
+sed -i "/\[core\]/aServer = ${HTTP_SERVER}/\$arch/\$repo" ${MOUNT_PATH}/etc/pacman.conf
+sed -i "/\[extra\]/aServer = ${HTTP_SERVER}/\$arch/\$repo" ${MOUNT_PATH}/etc/pacman.conf
+sed -i "/\[community\]/aServer = ${HTTP_SERVER}/\$arch/\$repo" ${MOUNT_PATH}/etc/pacman.conf
+printf "\n[myrepo]\nServer = ${HTTP_SERVER}/\$arch/\$repo\n" >> ${MOUNT_PATH}/etc/pacman.conf
arch-chroot ${MOUNT_PATH} pacman -Sy
diff --git a/copy_host_packages_to_mirror.sh b/copy_host_packages_to_mirror.sh
new file mode 100755
index 0000000..aff7535
--- /dev/null
+++ b/copy_host_packages_to_mirror.sh
@@ -0,0 +1,21 @@
+#!/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
+ pkgname=`echo $p | cut -f 2 -d " "`
+ if test -f "/var/cache/pacman/pkg/$pkgname"*"x86_64.pkg.tar.xz"; then
+ cp -v "/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 -v "/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/createvm.sh b/createvm.sh
index 0edf671..747e4f6 100755
--- a/createvm.sh
+++ b/createvm.sh
@@ -1,5 +1,13 @@
#!/bin/bash
+# configuration
+
+NAME=arch64
+HOST=192.168.130.1
+NETMASK=255.255.255.0
+PREFIX=24
+CLIENT=192.168.130.3
+
vm_is_running() {
if [ "$(virsh domstate $1 2>/dev/null)" == "running" ]; then
return 0
@@ -14,22 +22,23 @@ wait_for_vm_to_stop() {
done
}
-NAME=archlinux
-
-mount -o loop,ro archlive/out/archlinux-2016.09.30-dual.iso archiso
+mount -o loop,ro archlinux-2019.07.01-x86_64.iso archiso
-darkhttpd . --port 8080 &
+#cp archiso/arch/boot/x86_64/vmlinuz .
+#cp archiso/arch/boot/x86_64/archiso.img .
-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" &
+#darkhttpd . --port 8088 &
-sleep 5
+virt-install --name ${NAME} -r 1536 --vcpus=1 --os-type=linux --os-variant=fedora29 \
+ --disk pool=default,size=4,format=qcow2 --network bridge=br0,model=virtio \
+ --vnc --vncport=5901 --noreboot \
+ --boot kernel=archiso/arch/boot/x86_64/vmlinuz,initrd=archiso/arch/boot/x86_64/archiso.img,kernel_args="archisobasedir=archiso/arch archiso_http_srv=http://${HOST}:8088/ script=http://${HOST}:8088/archauto.sh ip=${CLIENT}:::${NETMASK}:${NAME}::off nomodeset i915.modeset=0" &
+# --noautoconsole
+sleep 15
virsh start ${NAME}
-sleep 5
+sleep 15
wait_for_vm_to_stop ${NAME}
@@ -43,5 +52,5 @@ virsh start ${NAME}
rm -f ${NAME}-new.xml ${NAME}.xml
-pkill darkhttpd
+#pkill darkhttpd
umount archiso