archlinux: keep downloaded files in $CACHEDIR (new variable)
Do not download anything directly in template-builder root. Also do not download and extract archlinux iso if existing file is current.
This commit is contained in:
parent
4123d2fdec
commit
afc68b641c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
||||
*~
|
||||
appmenus
|
||||
build_timestamp
|
||||
cache_*
|
||||
mnt_*
|
||||
*.iso
|
||||
*.fs
|
||||
|
@ -19,4 +19,6 @@ else
|
||||
SCRIPTSDIR="scripts_$DISTRIBUTION"
|
||||
fi
|
||||
|
||||
export SCRIPTSDIR
|
||||
CACHEDIR=cache_$DIST
|
||||
|
||||
export SCRIPTSDIR CACHEDIR
|
||||
|
@ -1,22 +1,25 @@
|
||||
#!/bin/sh
|
||||
ISO_VERSION=2013.02.01
|
||||
|
||||
mkdir -p $CACHEDIR
|
||||
|
||||
echo "Downloading Archlinux dvd..."
|
||||
wget -O "archlinux-$ISO_VERSION-dual.iso" "http://mir.archlinux.fr/iso/$ISO_VERSION/archlinux-$ISO_VERSION-dual.iso" --continue
|
||||
wget -N -P $CACHEDIR "http://mir.archlinux.fr/iso/$ISO_VERSION/archlinux-$ISO_VERSION-dual.iso"
|
||||
|
||||
echo "Verifying dvd..."
|
||||
echo "If verification fails, ensure that you imported and verified the archlinux key"
|
||||
echo "eg: gpg --recv-keys 9741E8AC"
|
||||
|
||||
gpg --verify "./scripts_archlinux/archlinux-$ISO_VERSION-dual.iso.sig" "archlinux-$ISO_VERSION-dual.iso" || exit
|
||||
gpg --verify "$SCRIPTSDIR/archlinux-$ISO_VERSION-dual.iso.sig" "$CACHEDIR/archlinux-$ISO_VERSION-dual.iso" || exit
|
||||
|
||||
echo "Extracting squash filesystem from DVD..."
|
||||
mkdir archlinux_dvd
|
||||
sudo mount -o loop "archlinux-$ISO_VERSION-dual.iso" archlinux_dvd
|
||||
cp archlinux_dvd/arch/x86_64/root-image.fs.sfs .
|
||||
sudo umount archlinux_dvd
|
||||
sudo mount -o loop root-image.fs.sfs archlinux_dvd
|
||||
cp archlinux_dvd/root-image.fs .
|
||||
sudo umount archlinux_dvd
|
||||
rm root-image.fs.sfs
|
||||
if [ "$CACHEDIR/archlinux-$ISO_VERSION-dual.iso" -nt $CACHEDIR/root-image.fs ]; then
|
||||
echo "Extracting squash filesystem from DVD..."
|
||||
mkdir mnt_archlinux_dvd
|
||||
sudo mount -o loop "cache_$DIST/archlinux-$ISO_VERSION-dual.iso" mnt_archlinux_dvd
|
||||
cp mnt_archlinux_dvd/arch/x86_64/root-image.fs.sfs $CACHEDIR/
|
||||
sudo umount mnt_archlinux_dvd
|
||||
sudo mount -o loop cache_$DIST/root-image.fs.sfs mnt_archlinux_dvd
|
||||
cp mnt_archlinux_dvd/root-image.fs $CACHEDIR/
|
||||
sudo umount mnt_archlinux_dvd
|
||||
rm $CACHEDIR/root-image.fs.sfs
|
||||
fi
|
||||
|
@ -1,23 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Mounting archlinux install system into archlinux_dvd..."
|
||||
sudo mount root-image.fs archlinux_dvd
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
|
||||
echo "Creating chroot bootstrap environment"
|
||||
|
||||
sudo mount --bind $INSTALLDIR archlinux_dvd/mnt
|
||||
sudo cp /etc/resolv.conf archlinux_dvd/etc
|
||||
sudo mount --bind $INSTALLDIR mnt_archlinux_dvd/mnt
|
||||
sudo cp /etc/resolv.conf mnt_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
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot mnt_archlinux_dvd/ pacman-key --init
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot mnt_archlinux_dvd/ pacman-key --populate
|
||||
|
||||
echo "-> Installing core pacman packages..."
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot archlinux_dvd/ sh -c 'pacstrap /mnt base'
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot mnt_archlinux_dvd/ sh -c 'pacstrap /mnt base'
|
||||
|
||||
echo "-> Cleaning up bootstrap environment"
|
||||
sudo umount archlinux_dvd/mnt
|
||||
sudo umount mnt_archlinux_dvd/mnt
|
||||
|
||||
sudo umount archlinux_dvd
|
||||
sudo umount mnt_archlinux_dvd
|
||||
|
||||
cp scripts_"${DIST}"/resolv.conf $INSTALLDIR/etc
|
||||
cp $SCRIPTSDIR/resolv.conf $INSTALLDIR/etc
|
||||
|
@ -1,13 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Mounting archlinux install system into archlinux_dvd..."
|
||||
sudo mount root-image.fs archlinux_dvd
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
|
||||
PKGGROUPS=`cat $SCRIPTSDIR/packages.list`
|
||||
|
||||
echo "-> Installing archlinux package groups..."
|
||||
echo "-> Selected packages:"
|
||||
echo "$PKGGROUPS"
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --needed --noconfirm -S $PKGGROUPS
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --needed --noconfirm -S $PKGGROUPS
|
||||
|
||||
sudo umount archlinux_dvd
|
||||
sudo umount mnt_archlinux_dvd
|
||||
|
@ -1,38 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Mounting archlinux install system into archlinux_dvd..."
|
||||
sudo mount root-image.fs archlinux_dvd
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
|
||||
echo "--> Installing make dependencies..."
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c 'pacman -S --asdeps --needed --noconfirm binutils yajl gcc make'
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c 'pacman -S --asdeps --needed --noconfirm binutils yajl gcc make'
|
||||
|
||||
#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'
|
||||
#sudo ./mnt_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 ./mnt_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
|
||||
sudo sed 's:-t tmpfs -o mode=1777,strictatime,nodev,:-t tmpfs -o size=700M,mode=1777,strictatime,nodev,:' -i ./mnt_archlinux_dvd/usr/bin/arch-chroot
|
||||
sudo cp ./scripts_archlinux/build_package.sh $INSTALLDIR/etc/
|
||||
sudo cp ./scripts_archlinux/CF8D4BBE.pub $INSTALLDIR/etc/
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "gpg --import /etc/CF8D4BBE.pub"
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "gpg --import /etc/CF8D4BBE.pub"
|
||||
|
||||
# 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"
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -Sy"
|
||||
|
||||
echo "--> Compiling and installing qubes-packages..."
|
||||
sudo cp ./scripts_archlinux/qubes-vm-xen.tar.gz.sig $INSTALLDIR/etc/package.sig
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-xen
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-xen
|
||||
sudo cp ./scripts_archlinux/qubes-vm-core.tar.gz.sig $INSTALLDIR/etc/package.sig
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-core
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-core
|
||||
sudo cp ./scripts_archlinux/qubes-vm-gui.tar.gz.sig $INSTALLDIR/etc/package.sig
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-gui
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-gui
|
||||
sudo cp ./scripts_archlinux/qubes-vm-kernel-modules.tar.gz.sig $INSTALLDIR/etc/package.sig
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-kernel-modules
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR bash /etc/build_package.sh qubes-vm-kernel-modules
|
||||
|
||||
echo "--> Updating template fstab file..."
|
||||
sudo su -c "echo '/dev/mapper/dmroot / ext4 defaults,noatime 1 1' >> $INSTALLDIR/etc/fstab"
|
||||
@ -41,4 +41,4 @@ sudo su -c "echo '/dev/xvdc1 swap swap defaults 0 0' >> $INSTALLDIR/etc/fstab"
|
||||
sudo su -c "echo '/rw/home /home none noauto,bind,defaults 0 0' >> $INSTALLDIR/etc/fstab"
|
||||
sudo su -c "echo '/dev/xvdd /usr/lib/modules ext3 defaults,noatime 0 0' >> $INSTALLDIR/etc/fstab"
|
||||
|
||||
sudo umount archlinux_dvd
|
||||
sudo umount mnt_archlinux_dvd
|
||||
|
@ -1,22 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Mounting archlinux install system into archlinux_dvd..."
|
||||
sudo mount root-image.fs archlinux_dvd
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_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
|
||||
cleanuppkgs=`sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman -Qdt | cut -d " " -f 1`
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc $cleanuppkgs
|
||||
|
||||
# Clean pacman cache
|
||||
sudo ./archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Scc
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Scc
|
||||
|
||||
# Remove build data
|
||||
rm $INSTALLDIR/etc/build_package.sh
|
||||
rm $INSTALLDIR/etc/CF8D4BBE.pub
|
||||
rm $INSTALLDIR/etc/package.sig
|
||||
|
||||
sudo umount archlinux_dvd
|
||||
sudo umount mnt_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
|
||||
|
Loading…
Reference in New Issue
Block a user