archlinux: do not use additional sudo inside scripts_archlinux/*
The whole build process is started as root (check Makefile), so there is no need for additional sudo. This makes some things much simpler (for example appending to some files).
This commit is contained in:
parent
75a63613bc
commit
d13a4eff88
@ -14,11 +14,11 @@ gpg --verify "$SCRIPTSDIR/archlinux-$ISO_VERSION-dual.iso.sig" "$CACHEDIR/archli
|
||||
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 "$CACHEDIR/archlinux-$ISO_VERSION-dual.iso" mnt_archlinux_dvd
|
||||
mount -o loop "$CACHEDIR/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 $CACHEDIR/root-image.fs.sfs mnt_archlinux_dvd
|
||||
umount mnt_archlinux_dvd
|
||||
mount -o loop $CACHEDIR/root-image.fs.sfs mnt_archlinux_dvd
|
||||
cp mnt_archlinux_dvd/root-image.fs $CACHEDIR/
|
||||
sudo umount mnt_archlinux_dvd
|
||||
umount mnt_archlinux_dvd
|
||||
rm $CACHEDIR/root-image.fs.sfs
|
||||
fi
|
||||
|
@ -4,23 +4,23 @@ set -e
|
||||
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
mkdir -p mnt_archlinux_dvd
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
|
||||
echo "Creating chroot bootstrap environment"
|
||||
|
||||
sudo mount --bind $INSTALLDIR mnt_archlinux_dvd/mnt
|
||||
sudo cp /etc/resolv.conf mnt_archlinux_dvd/etc
|
||||
mount --bind $INSTALLDIR mnt_archlinux_dvd/mnt
|
||||
cp /etc/resolv.conf mnt_archlinux_dvd/etc
|
||||
|
||||
echo "-> Initializing pacman keychain"
|
||||
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
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot mnt_archlinux_dvd/ pacman-key --init
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot mnt_archlinux_dvd/ pacman-key --populate
|
||||
|
||||
echo "-> Installing core pacman packages..."
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot mnt_archlinux_dvd/ sh -c 'pacstrap /mnt base'
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot mnt_archlinux_dvd/ sh -c 'pacstrap /mnt base'
|
||||
|
||||
echo "-> Cleaning up bootstrap environment"
|
||||
sudo umount mnt_archlinux_dvd/mnt
|
||||
umount mnt_archlinux_dvd/mnt
|
||||
|
||||
sudo umount mnt_archlinux_dvd
|
||||
umount mnt_archlinux_dvd
|
||||
|
||||
cp $SCRIPTSDIR/resolv.conf $INSTALLDIR/etc
|
||||
|
@ -3,13 +3,13 @@
|
||||
set -e
|
||||
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
|
||||
PKGGROUPS=`cat $SCRIPTSDIR/packages.list`
|
||||
|
||||
echo "-> Installing archlinux package groups..."
|
||||
echo "-> Selected packages:"
|
||||
echo "$PKGGROUPS"
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --needed --noconfirm -S $PKGGROUPS
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --needed --noconfirm -S $PKGGROUPS
|
||||
|
||||
sudo umount mnt_archlinux_dvd
|
||||
umount mnt_archlinux_dvd
|
||||
|
@ -4,7 +4,7 @@ set -e
|
||||
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
mkdir -p mnt_archlinux_dvd
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
|
||||
# Note: Enable x86 repos
|
||||
su -c "echo '[multilib]' >> $INSTALLDIR/etc/pacman.conf"
|
||||
@ -13,34 +13,36 @@ su -c "echo 'Include = /etc/pacman.d/mirrorlist' >> $INSTALLDIR/etc/pacman.conf"
|
||||
|
||||
echo "--> Registering Qubes custom repository"
|
||||
|
||||
sudo tee -a $INSTALLDIR/etc/pacman.conf <<EOF
|
||||
cat >> $INSTALLDIR/etc/pacman.conf <<EOF
|
||||
[qubes]
|
||||
SigLevel = Optional TrustAll
|
||||
Server = file:///mnt/qubes-rpms-mirror-repo/pkgs
|
||||
EOF
|
||||
|
||||
export CUSTOMREPO=$PWD/yum_repo_qubes/archlinux
|
||||
sudo mkdir -p $INSTALLDIR/mnt/qubes-rpms-mirror-repo
|
||||
sudo mount --bind $CUSTOMREPO $INSTALLDIR/mnt/qubes-rpms-mirror-repo
|
||||
mkdir -p $INSTALLDIR/mnt/qubes-rpms-mirror-repo
|
||||
mount --bind $CUSTOMREPO $INSTALLDIR/mnt/qubes-rpms-mirror-repo
|
||||
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "cd /mnt/qubes-rpms-mirror-repo/;repo-add pkgs/qubes.db.tar.gz pkgs/*.pkg.tar.xz"
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "cd /mnt/qubes-rpms-mirror-repo/;repo-add pkgs/qubes.db.tar.gz pkgs/*.pkg.tar.xz"
|
||||
|
||||
chown -R --reference=$CUSTOMREPO $CUSTOMREPO
|
||||
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -Sy"
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -Sy"
|
||||
|
||||
echo "--> Installing qubes-packages..."
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -S --noconfirm qubes-vm-xen"
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -S --noconfirm qubes-vm-core"
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -S --noconfirm qubes-vm-gui"
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -S --noconfirm qubes-vm-xen"
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -S --noconfirm qubes-vm-core"
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR sh -c "pacman -S --noconfirm qubes-vm-gui"
|
||||
|
||||
echo "--> Updating template fstab file..."
|
||||
sudo su -c "echo '/dev/mapper/dmroot / ext4 defaults,noatime 1 1' >> $INSTALLDIR/etc/fstab"
|
||||
sudo su -c "echo '/dev/xvdb /rw ext4 defaults,noatime 1 2' >> $INSTALLDIR/etc/fstab"
|
||||
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"
|
||||
cat >> $INSTALLDIR/etc/fstab <<EOF
|
||||
/dev/mapper/dmroot / ext4 defaults,noatime 1 1
|
||||
/dev/xvdb /rw ext4 defaults,noatime 1 2
|
||||
/dev/xvdc1 swap swap defaults 0 0
|
||||
/rw/home /home none noauto,bind,defaults 0 0
|
||||
/dev/xvdd /usr/lib/modules ext3 defaults,noatime 0 0
|
||||
EOF
|
||||
|
||||
echo "--> Cleaning up..."
|
||||
sudo umount $INSTALLDIR/mnt/qubes-rpms-mirror-repo
|
||||
sudo umount mnt_archlinux_dvd
|
||||
umount $INSTALLDIR/mnt/qubes-rpms-mirror-repo
|
||||
umount mnt_archlinux_dvd
|
||||
|
@ -3,25 +3,25 @@
|
||||
set -e
|
||||
|
||||
echo "Mounting archlinux install system into mnt_archlinux_dvd..."
|
||||
sudo mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
mount $CACHEDIR/root-image.fs mnt_archlinux_dvd
|
||||
|
||||
echo "--> Starting cleanup actions"
|
||||
# Remove unused packages and their dependencies (make dependencies)
|
||||
cleanuppkgs=`sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman -Qdt | cut -d " " -f 1`
|
||||
cleanuppkgs=`./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman -Qdt | cut -d " " -f 1`
|
||||
echo "--> Packages that can be cleaned up: $cleanuppkgs"
|
||||
if [ -n "$cleanuppkgs" ] ; then
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc $cleanuppkgs
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc $cleanuppkgs
|
||||
fi
|
||||
|
||||
# Remove non required linux kernel
|
||||
echo "--> Cleaning up linux kernel"
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc linux
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -S linux-firmware
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Rsc linux
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -S linux-firmware
|
||||
|
||||
# Clean pacman cache
|
||||
sudo ./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Scc
|
||||
./mnt_archlinux_dvd/usr/bin/arch-chroot $INSTALLDIR pacman --noconfirm -Scc
|
||||
|
||||
sudo umount mnt_archlinux_dvd
|
||||
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
|
||||
|
@ -9,4 +9,4 @@ yum install -c $PWD/yum.conf $YUM_OPTS -y --installroot=$(pwd)/mnt @qubes-vm
|
||||
echo "--> Installing 3rd party apps"
|
||||
$SCRIPTSDIR/add_3rd_party_software.sh
|
||||
|
||||
sudo umount $PWD/mnt/proc
|
||||
umount $PWD/mnt/proc
|
||||
|
Loading…
Reference in New Issue
Block a user