aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2017-07-13 15:07:51 +0100
committerMarc Zyngier <marc.zyngier@arm.com>2017-07-13 15:08:23 +0100
commit3e8d6c4f661ccd436eb7d08a5e7340d20aaa9eaf (patch)
tree31b9deb692629a13e79b86d4e53f3e5bb96e3969
parent62487b6c2da6366337a2d34ce87b67366be70196 (diff)
downloadvminstall-3e8d6c4f661ccd436eb7d08a5e7340d20aaa9eaf.tar.gz
build-cd-image: Allow generation of kickstarted Fedora images
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--anaconda-ks.cfg51
-rwxr-xr-xbuild-cd-image23
2 files changed, 70 insertions, 4 deletions
diff --git a/anaconda-ks.cfg b/anaconda-ks.cfg
new file mode 100644
index 0000000..261f735
--- /dev/null
+++ b/anaconda-ks.cfg
@@ -0,0 +1,51 @@
+#version=DEVEL
+# System authorization information
+auth --enableshadow --passalgo=sha512
+# Use text mode install
+text
+# Install from CD, and reboot once done
+install
+cdrom
+reboot
+# Run the Setup Agent on first boot
+firstboot --enable
+ignoredisk --only-use=vda
+# Keyboard layouts
+keyboard --vckeymap=gb --xlayouts=''
+# System language
+lang en_GB.UTF-8
+
+# Network information
+network --bootproto=dhcp --device=enp0s1 --ipv6=auto --activate
+network --hostname=localhost.localdomain
+# Root password
+rootpw --iscrypted $6$.bkQ04hA$3ANZyvputuKzAj2DQWMjXQMFdZj9g4BZTHsP0YQCpsHhgfotpiAnBovEgeaPxk.6BrtRftx.n1D8XaY3igFIV1
+# System services
+services --enabled="chronyd"
+# Do not configure the X Window System
+skipx
+# System timezone
+timezone Europe/London --isUtc
+# System bootloader configuration
+bootloader --location=mbr --boot-drive=vda
+autopart --type=plain
+# Partition clearing information
+clearpart --all --initlabel --drives=vda
+
+%packages
+@^server-product-environment
+@arm-tools
+@server-hardware-support
+chrony
+
+%end
+
+%addon com_redhat_kdump --disable --reserve-mb='128'
+
+%end
+
+%anaconda
+pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
+pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
+pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
+%end
diff --git a/build-cd-image b/build-cd-image
index 5605340..1b058f3 100755
--- a/build-cd-image
+++ b/build-cd-image
@@ -8,9 +8,10 @@ grubcfg=$out/boot/grub/grub.cfg
mkdir $out
vmlinuzpath=$(xorriso -dev $1 -sh_style_result on -find / -type f -name vmlinuz 2>/dev/null | cut -f2- -d '/')
+grubcfgpath=$(xorriso -dev $1 -sh_style_result on -find / -type f -name grub.cfg 2>/dev/null | cut -f2- -d '/' | tail -1)
if [ "$vmlinuzpath" != "" ]; then
- # Debian, newer Ubuntu
+ # Debian, newer Ubuntu, Fedora
kpath=/`dirname $vmlinuzpath`
kname=vmlinuz
else
@@ -19,10 +20,18 @@ else
kname=linux
fi
+if [ "$kpath" = "/images/pxeboot" ]; then
+ # Fedora
+ preseed="kickstart"
+else
+ # Debian
+ preseed="preseed"
+fi
+
xorriso -dev $1 \
-sh_style_result on \
-osirrox on \
- -extract_single /boot/grub/grub.cfg $grubcfg
+ -extract_single $grubcfgpath $grubcfg
chmod u+w $grubcfg
cat <<EOF >>$grubcfg
@@ -32,14 +41,20 @@ menuentry 'Install preseeded' --id preseed {
initrd $kpath/initrd.gz
}
-default=preseed
+menuentry 'Install kickstart' --id kickstart {
+ linux $kpath/$kname inst.stage2=hd:/dev/sr0 ks=cdrom:/ks.cfg ro
+ initrd $kpath/initrd.img
+}
+
+default=$preseed
timeout=5
EOF
xorriso -indev $1 \
-outdev $2 \
- -map $grubcfg /boot/grub/grub.cfg \
+ -map $grubcfg $grubcfgpath \
-map preseed.cfg /preseed.cfg \
+ -map anaconda-ks.cfg /ks.cfg \
-boot_image any replay
chmod -R a+rw $out