Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/mkarchiso486
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2021-06-20 17:17:51 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2021-06-20 17:17:51 +0200
commit1854e6dc11b0a74223a947dc9ae7f8c3c79202b1 (patch)
treec2d5d0c0b9f43cf2660f3939ddb469d8d7e532c8 /mkarchiso486
parent53ea7b33edafcd06bcb1db44879b6b35eceb8624 (diff)
added initial version of mkarchiso486
Diffstat (limited to 'mkarchiso486')
-rwxr-xr-xmkarchiso48692
1 files changed, 92 insertions, 0 deletions
diff --git a/mkarchiso486 b/mkarchiso486
new file mode 100755
index 0000000..7168795
--- /dev/null
+++ b/mkarchiso486
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+BASE=/data/arch32/i486iso
+ROOTFS="$BASE/airootfs"
+ROOTMNT="$BASE/mnt"
+
+umount "$ROOTMNT"
+rm -rf "$ROOTFS"
+rm -f "$BASE/pacman-i486.conf"
+rm -f "$BASE/mirrorlist32"
+
+# get and patch mirrorlist for Archlinux32
+if test ! -d "$ROOTFS"; then
+ mkdir "$ROOTFS"
+fi
+
+if test ! -f "$BASE/mirrorlist32"; then
+ wget -O "$BASE/mirrorlist32" "https://www.archlinux32.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&ip_version=6"
+ sed -i '/https.*mirror.archlinux32.org/s/#Server/Server/' "$BASE/mirrorlist32"
+fi
+
+echo "Patch host pacman.conf for installation of i486 chroot.."
+cp /etc/pacman.conf "$BASE/pacman-i486.conf"
+sed -i 's/^Architecture.*=.*/Architecture = i486/' "$BASE/pacman-i486.conf"
+sed -i "s|/etc/pacman.d/mirrorlist|$BASE/mirrorlist32|" "$BASE/pacman-i486.conf"
+
+pacstrap -C "$BASE/pacman-i486.conf" -G -M "$ROOTFS" base linux
+
+echo "Cleaning up root filesystem to fit to an ISO.."
+rm -rf "$ROOTFS/var/cache/pacman/pkg/"*
+
+echo "Patching pacman.conf and mirrorlist on the ISO.."
+sed -i 's/^Architecture.*=.*/Architecture = i486/' "$ROOTFS/etc/pacman.conf"
+sed -i 's/^#\(Server.*=.*https:\/\/.*mirror\.archlinux32.org.*\)/\1/' "$ROOTFS/etc/pacman.d/mirrorlist"
+
+mount --bind "$ROOTFS" "$ROOTMNT"
+
+echo "Preparing keyring inside chroot.."
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'pacman-key --init'
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'pacman-key --populate archlinux'
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'pacman-key --populate archlinux32'
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'pacman -Syyu --noconfirm syslinux dhclient dhcpcd pciutils nano joe vi arch-install-scripts openssh'
+
+echo "Install configuration.."
+for i in 1 2 3 4; do
+ mkdir -p "$ROOTFS"/etc/systemd/system/getty@tty$i.service.d
+ cp $BASE/autologin.conf "$ROOTFS"/etc/systemd/system/getty@tty$i.service.d/.
+done
+cp $BASE/resolv.conf "$ROOTFS"/etc/resolv.conf
+cp $BASE/sshd_config "$ROOTFS"/etc/ssh/sshd_config
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'ssh-keygen -b 2048 -t rsa -f etc/ssh/ssh_host_rsa_key -N ""'
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'ssh-keygen -b 1024 -t dsa -f etc/ssh/ssh_host_dsa_key -N ""'
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'ssh-keygen -b 521 -t ecdsa -f etc/ssh/ssh_host_ecdsa_key -N ""'
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'ssh-keygen -b 2048 -t ed25519 -f etc/ssh/ssh_host_ed25519_key -N ""'
+chmod 0400 "$ROOTFS"/etc/ssh/ssh_host_*_key
+cp $BASE/motd "$ROOTFS"/etc/motd
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'echo "root:arch" | /usr/bin/chpasswd'
+cp $BASE/system-login "$ROOTMNT"/etc/pam.d/system-login
+
+echo "Installining syslinux (isolinux).."
+if test ! -d "$ROOTFS/isolinux"; then
+ mkdir "$ROOTFS/isolinux"
+fi
+cp "$ROOTFS"/usr/lib/syslinux/bios/isolinux.bin "$ROOTFS/isolinux"
+cp "$ROOTFS"/usr/lib/syslinux/bios/ldlinux.c32 "$ROOTFS/isolinux"
+cp "$BASE"/isolinux-i486.cfg "$ROOTFS/isolinux/isolinux.cfg"
+
+echo "Creating ramdisk for ISO.."
+cp "$BASE"/mkinitcpio-i486.conf "$ROOTFS/etc/mkinitcpio.conf"
+linux32 arch-chroot "$ROOTMNT" /bin/bash -c 'mkinitcpio -P'
+
+umount "$ROOTMNT"
+
+echo "Creating ISO.."
+TODAY=`date +'%Y.%m.%d'`
+cd "$ROOTFS"
+iso_label="ARCH_$(date +%Y%m)"
+iso_publisher="Arch Linux <http://www.archlinux32.org>"
+iso_application="ArchLinux32 i486 Live/Rescue CD"
+mkisofs -o "$BASE/archlinux32-$TODAY-i486.iso" \
+ -b "isolinux/isolinux.bin" \
+ -c "isolinux/boot.cat" \
+ -volid "${iso_label}" \
+ -appid "${iso_application}" \
+ -publisher "${iso_publisher}" \
+ -preparer "prepared by mkarchiso" \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ -R -full-iso9660-filenames -iso-level 3 \
+ "."
+cd ..
+
+echo "Done."