Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/iso/mkarchiso486
diff options
context:
space:
mode:
Diffstat (limited to 'iso/mkarchiso486')
-rwxr-xr-xiso/mkarchiso48699
1 files changed, 99 insertions, 0 deletions
diff --git a/iso/mkarchiso486 b/iso/mkarchiso486
new file mode 100755
index 0000000..1d12302
--- /dev/null
+++ b/iso/mkarchiso486
@@ -0,0 +1,99 @@
+#!/bin/sh
+
+BASE=/root/archi486
+ROOTFS="$BASE/airootfs"
+ROOTMNT="$BASE/mnt"
+
+umount "$ROOTMNT"
+rm -rf "$ROOTFS"
+rm -f "$BASE/pacman-i486.conf"
+rm -f "$BASE/mirrorlist32"
+
+if test ! -d "$ROOTMNT"; then
+ mkdir "$ROOTMNT"
+fi
+
+# 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"
+sed -i 's|.*ParallelDownloads.*|ParallelDownloads = 1|' "$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"
+sed -i 's|.*ParallelDownloads.*|ParallelDownloads = 1|' "$ROOTFS/etc/pacman.conf"
+
+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
+for file in isolinux.bin ldlinux.c32; do
+ cp "$ROOTFS"/usr/lib/syslinux/bios/"$file" "$ROOTFS/isolinux"
+done
+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."