From 13c8c08d29136246c2186ffd5344e729d8fbee4d Mon Sep 17 00:00:00 2001 From: Olivier Medoc Date: Fri, 25 Jan 2013 09:07:01 +0100 Subject: [PATCH] template-builder: creation of script for archlinux template building. Note: the template build successfully but has not been tested. Note: the livecd should be verified before building the template (Checksum/PGP) --- scripts_archlinux/00_prepare.sh | 10 ++++++++ scripts_archlinux/01_install_core.sh | 23 +++++++++++++++++++ scripts_archlinux/02_install_groups.sh | 11 +++++++++ scripts_archlinux/04_install_qubes.sh | 28 +++++++++++++++++++++++ scripts_archlinux/09_cleanup.sh | 24 +++++++++++++++++++ scripts_archlinux/clean-volatile.img.tar | Bin 0 -> 10240 bytes scripts_archlinux/network | 1 + scripts_archlinux/packages.list | 18 +++++++++++++++ scripts_archlinux/part.bin | Bin 0 -> 512 bytes scripts_archlinux/resolv.conf | 1 + 10 files changed, 116 insertions(+) create mode 100755 scripts_archlinux/00_prepare.sh create mode 100755 scripts_archlinux/01_install_core.sh create mode 100755 scripts_archlinux/02_install_groups.sh create mode 100755 scripts_archlinux/04_install_qubes.sh create mode 100755 scripts_archlinux/09_cleanup.sh create mode 100644 scripts_archlinux/clean-volatile.img.tar create mode 100644 scripts_archlinux/network create mode 100644 scripts_archlinux/packages.list create mode 100644 scripts_archlinux/part.bin create mode 100644 scripts_archlinux/resolv.conf diff --git a/scripts_archlinux/00_prepare.sh b/scripts_archlinux/00_prepare.sh new file mode 100755 index 0000000..5fd3141 --- /dev/null +++ b/scripts_archlinux/00_prepare.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +echo "Downloading Archlinux dvd..." +wget -O "archlinux.iso" "http://mir.archlinux.fr/iso/latest/arch/x86_64/root-image.fs.sfs" --continue + +echo "Extracting squash filesystem from DVD..." +mkdir archlinux_dvd +sudo mount -o loop archlinux.iso archlinux_dvd +cp archlinux_dvd/root-image.fs . +sudo umount archlinux_dvd diff --git a/scripts_archlinux/01_install_core.sh b/scripts_archlinux/01_install_core.sh new file mode 100755 index 0000000..eb811a2 --- /dev/null +++ b/scripts_archlinux/01_install_core.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +echo "Mounting archlinux install system into archlinux_dvd..." +sudo mount root-image.fs archlinux_dvd + +echo "Creating chroot bootstrap environment" + +sudo mount --bind $INSTALLDIR archlinux_dvd/mnt +sudo cp /etc/resolv.conf archlinux_dvd/etc + +echo "-> Initializing pacman keychain" +sudo ./archlinux_dvd/usr/bin/arch-chroot archlinux_dvd/ pacman-key --init +sudo ./archlinux_dvd/usr/bin/arch-chroot archlinux_dvd/ pacman-key --populate + +echo "-> Installing core pacman packages..." +sudo ./archlinux_dvd/usr/bin/arch-chroot archlinux_dvd/ sh -c 'pacstrap /mnt base' + +echo "-> Cleaning up bootstrap environment" +sudo umount archlinux_dvd/mnt + +sudo umount archlinux_dvd + +cp scripts_"${DIST}"/resolv.conf $INSTALLDIR/etc diff --git a/scripts_archlinux/02_install_groups.sh b/scripts_archlinux/02_install_groups.sh new file mode 100755 index 0000000..3d5b132 --- /dev/null +++ b/scripts_archlinux/02_install_groups.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "Mounting archlinux install system into archlinux_dvd..." +sudo mount root-image.fs archlinux_dvd + +echo "-> Installing archlinux package groups..." +echo "-> Selected packages:" +echo "$PKGGROUPS" +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --needed --noconfirm -S $PKGGROUPS + +sudo umount archlinux_dvd diff --git a/scripts_archlinux/04_install_qubes.sh b/scripts_archlinux/04_install_qubes.sh new file mode 100755 index 0000000..cc97c16 --- /dev/null +++ b/scripts_archlinux/04_install_qubes.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +echo "Mounting archlinux install system into archlinux_dvd..." +sudo mount root-image.fs archlinux_dvd + +echo $INSTALLDIR + +echo "--> Installing yaourt..." +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c 'cd tmp && wget https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz && tar xzvf package-query.tar.gz && cd package-query && makepkg --asroot && pacman --noconfirm -U package-query-*.pkg.tar.xz' +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c 'cd tmp && wget https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz && tar xzvf yaourt.tar.gz && cd yaourt && makepkg --asroot && pacman --noconfirm -U yaourt-*.pkg.tar.xz' + +echo "--> Preparing build environment inside the chroot..." +# Notes for qubes-vm-xen +# Note: we need more ram for /tmp (at least 700M of disk space for compiling XEN because of the sources...) +sudo sed 's:-t tmpfs -o mode=1777,strictatime,nodev,:-t tmpfs -o size=700M,mode=1777,strictatime,nodev,:' -i ./archlinux_dvd/usr/bin/arch-chroot + +# Note: Enable x86 repos +su -c "echo '[multilib]' >> $INSTALLDIR/etc/pacman.conf" +su -c "echo 'SigLevel = PackageRequired' >> $INSTALLDIR/etc/pacman.conf" +su -c "echo 'Include = /etc/pacman.d/mirrorlist' >> $INSTALLDIR/etc/pacman.conf" +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -Sy" + +echo "--> Compiling and installing qubes-packages..." +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "yaourt --noconfirm -S qubes-vm-xen" +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "yaourt --noconfirm -S qubes-vm-core" +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "yaourt --noconfirm -S qubes-vm-gui" + +sudo umount archlinux_dvd diff --git a/scripts_archlinux/09_cleanup.sh b/scripts_archlinux/09_cleanup.sh new file mode 100755 index 0000000..70744c0 --- /dev/null +++ b/scripts_archlinux/09_cleanup.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +echo "Mounting archlinux install system into archlinux_dvd..." +sudo mount root-image.fs archlinux_dvd + +echo "--> Starting cleanup actions" +# Remove unused packages and their dependencies (make dependencies) +cleanuppkgs=`sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman -Qdt | cut -d " " -f 1` +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc $cleanuppkgs + +# Remove yaourt dependencies +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc binutils yajl gcc make + +# Clean pacman cache +sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Scc + +sudo umount archlinux_dvd + +#rm -f $INSTALLDIR/var/lib/rpm/__db.00* $INSTALLDIR/var/lib/rpm/.rpm.lock +#yum -c $PWD/yum.conf $YUM_OPTS clean packages --installroot=$INSTALLDIR + +# Make sure that rpm database has right format (for rpm version in template, not host) +#echo "--> Rebuilding rpm database..." +#chroot `pwd`/mnt /bin/rpm --rebuilddb 2> /dev/null diff --git a/scripts_archlinux/clean-volatile.img.tar b/scripts_archlinux/clean-volatile.img.tar new file mode 100644 index 0000000000000000000000000000000000000000..5257a1029acf7947eaa63fc2fd87054fdb5d8481 GIT binary patch literal 10240 zcmeIuze~eF6u|MPE?t~mqmwRrNz+R=sp4J;B90x36e>c~I%@=79lE(W=C5$}5AeTm z5FB)>?^28QhU(HG@O_ZnyZ2sx+~@M5-x>D$-QC{#nJg)chPAP{HStz0)%B7vY{a24 zQQanDqNri51nH9gXYRG5Y}gqDfsC^5V6Ne9{_1<<|KB>5?dR|r$)v5L%cub%kz ztLZ0KpLEsUEJS`crZe0tFK|2F$n+4wrsTzTE;V(e*d!9T=XP81Q4jIKzh<@r|s6^QB>6v@ZSg^fB*srAbF{(3|Eu8 z1>(OlLK&h#zix!15OKb1g!jOIV}v6R#Z#q9L4>LKg_lsQs&gWKw)7lI^VK;JCslPp wg%$#Duq%AXgMQYA>-B9qO)V24sKrS#M)lhb5dqaJw1523^6>Se|K>{b3dJqN-~a#s literal 0 HcmV?d00001 diff --git a/scripts_archlinux/resolv.conf b/scripts_archlinux/resolv.conf new file mode 100644 index 0000000..6e7633b --- /dev/null +++ b/scripts_archlinux/resolv.conf @@ -0,0 +1 @@ +# This file intentionally left blank