- rm -rf $MNT/etc/mkinitcpio-archiso.conf
- find $MNT/usr/lib/initcpio -name 'archiso*' -type f -delete
- sed -i 's/#\(Storage=\)volatile/\1auto/' $MNT/etc/systemd/journald.conf
- find $MNT/boot -name '*-ucode.img' -delete
-
- [[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" $MNT/etc/{lsb-release,os-release}
-
- if [[ $VM ]]; then
- find $MNT/etc/X11/xorg.conf.d/ -name '*.conf' -delete
- elif lspci | grep ' VGA ' | grep -q 'Intel'; then
- echo "Creating Intel VGA Tear Free config /etc/X11/xorg.conf.d/20-intel.conf"
- cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<- EOF
- Section "Device"
- Identifier "Intel Graphics"
- Driver "intel"
- Option "TearFree" "true"
- EndSection
- EOF
- fi
-
- [[ -e /run/archiso/sfs/airootfs ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
- [[ -d /etc/netctl ]] && cp -rfv /etc/netctl $MNT/etc/
- [[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf $MNT/etc/
- [[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
-
- echo "LANG=$MYLOCALE" > $MNT/etc/locale.conf
- cp -fv $MNT/etc/locale.conf $MNT/etc/default/locale
- sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${MYLOCALE}/${MYLOCALE}/g" $MNT/etc/locale.gen
+ # archiso files
+ rm -rf "$MNT/etc/mkinitcpio-archiso.conf"
+ find "$MNT/usr/lib/initcpio" -name 'archiso*' -type f -delete
+
+ # remove/disable customizations done to airootfs during building
+ chrun "systemctl disable pacman-init.service choose-mirror.service" > /dev/null 2>&1
+ rm -f "$MNT/etc/systemd/scripts/choose-mirror"
+ rm -f "$MNT/etc/systemd/system/"{choose-mirror.service,etc-pacman.d-gnupg.mount,pacman-init.service}
+ sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf"
+ sed -i 's/#\(HandleSuspendKey=\)ignore/\1suspend/' "$MNT/etc/systemd/logind.conf"
+ sed -i 's/#\(HandleHibernateKey=\)ignore/\1hibernate/' "$MNT/etc/systemd/logind.conf"
+ sed -i 's/#\(HandleLidSwitch=\)ignore/\1suspend/' "$MNT/etc/systemd/logind.conf"
+ find "$MNT/boot" -name '*-ucode.img' -delete
+
+ # changing distro name?
+ [[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release}
+
+ # vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio
+ cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> "$ERR" 2>&1
+ errshow 1 "cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux"
+
+ # copy network settings
+ [[ -d /etc/netctl ]] && cp -rfv /etc/netctl "$MNT/etc/"
+ [[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf "$MNT/etc/"
+ [[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections "$MNT/etc/NetworkManager/"
+
+ echo "LANG=$MYLOCALE" > "$MNT/etc/locale.conf"
+ cp -fv "$MNT/etc/locale.conf" "$MNT/etc/default/locale"
+ sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${MYLOCALE}/${MYLOCALE}/g" "$MNT/etc/locale.gen"