add PARTUUID of root to fstab

Also fix overlay permissions again,
since it turns out that minimal and server
editions might also have polkit stuff installed.

Also do some indentation cleanup

Signed-off-by: Dan Johansen <strit@manjaro.org>
This commit is contained in:
Dan Johansen 2021-08-05 16:53:53 +02:00
parent b21b615027
commit e228cd14d8
No known key found for this signature in database
GPG Key ID: 084A7FC0035B1D49
1 changed files with 162 additions and 156 deletions

View File

@ -2,7 +2,7 @@
# Set globals # Set globals
# ***************************** # *****************************
VERSION="1.4.4" VERSION="1.4.5"
# ***************************** # *****************************
TMPDIR=/var/tmp/manjaro-arm-installer TMPDIR=/var/tmp/manjaro-arm-installer
ARCH='aarch64' ARCH='aarch64'
@ -207,11 +207,12 @@ create_install() {
sed -i s/"enable systemd-resolved.service"/"#enable systemd-resolved.service"/ $TMPDIR/root/usr/lib/systemd/system-preset/90-systemd.preset sed -i s/"enable systemd-resolved.service"/"#enable systemd-resolved.service"/ $TMPDIR/root/usr/lib/systemd/system-preset/90-systemd.preset
echo "Correcting permissions from overlay..." echo "Correcting permissions from overlay..."
chown -R root:root $ROOTFS_IMG/rootfs_$ARCH/etc chown -R root:root $TMPDIR/root/etc
chown -R root:root $ROOTFS_IMG/rootfs_$ARCH/usr/{local,share} chown -R root:root $TMPDIR/root/usr/{local,share}
if [[ "$EDITION" != "minimal" && "$EDITION" != "server" ]]; then if [[ -d $TMPDIR/root/etc/polkit-1/rules.d ]]; then
chown root:polkitd $ROOTFS_IMG/rootfs_$ARCH/etc/polkit-1/rules.d chown root:polkitd $TMPDIR/root/etc/polkit-1/rules.d
chown root:polkitd $ROOTFS_IMG/rootfs_$ARCH/usr/share/polkit-1/rules.d elif [[ -d $TMPDIR/root/usr/share/polkit-1/rules.d ]]; then
chown root:polkitd $TMPDIR/root/usr/share/polkit-1/rules.d
elif [[ "$EDITION" = "cubocore" ]]; then elif [[ "$EDITION" = "cubocore" ]]; then
cp $TMPDIR/root/usr/share/applications/corestuff.desktop $TMPDIR/root/etc/xdg/autostart/ cp $TMPDIR/root/usr/share/applications/corestuff.desktop $TMPDIR/root/etc/xdg/autostart/
fi fi
@ -368,14 +369,17 @@ cleanup () {
# edit boot files and fstab # edit boot files and fstab
# set UUID for boot partition in fstab # set UUID for boot partition in fstab
BOOT_PARTUUID=$(lsblk -o NAME,PARTUUID | grep ${DEV_NAME}${SDDEV}1 | awk '{print $2}') BOOT_PARTUUID=$(lsblk -p -o NAME,PARTUUID | grep ${DEV_NAME}${SDDEV}1 | awk '{print $2}')
sed -i "s/LABEL=BOOT_MNJRO/PARTUUID=$BOOT_PARTUUID/g" $TMPDIR/root/etc/fstab sed -i "s/LABEL=BOOT_MNJRO/PARTUUID=$BOOT_PARTUUID/g" $TMPDIR/root/etc/fstab
echo "Set boot partition to $BOOT_PARTUUID in /etc/fstab..." echo "Set boot partition to $BOOT_PARTUUID in /etc/fstab..."
# Change boot script and fstab to root partition UUID # Change boot script and fstab to root partition UUID
ROOT_PARTUUID=$(lsblk -o NAME,PARTUUID | grep ${DEV_NAME}${SDDEV}2 | awk '{print $2}') ROOT_PARTUUID=$(lsblk -p -o NAME,PARTUUID | grep ${DEV_NAME}${SDDEV}2 | awk '{print $2}')
echo "Set root partition to $ROOT_PARTUUID in the relevant boot script and /etc/fstab..."
if [ -f $TMPDIR/boot/extlinux/extlinux.conf ]; then if [ -f $TMPDIR/boot/extlinux/extlinux.conf ]; then
sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/boot/extlinux/extlinux.conf sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/boot/extlinux/extlinux.conf
elif [ -f $TMPDIR/boot/efi/extlinux/extlinux.conf ]; then
sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PART/g" $TMPDIR/boot/efi/extlinux/extlinux.conf
elif [ -f $TMPDIR/boot/boot.ini ]; then elif [ -f $TMPDIR/boot/boot.ini ]; then
sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/boot/boot.ini sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/boot/boot.ini
elif [ -f $TMPDIR/boot/uEnv.ini ]; then elif [ -f $TMPDIR/boot/uEnv.ini ]; then
@ -383,12 +387,14 @@ cleanup () {
elif [ -f $TMPDIR/boot/cmdline.txt ]; then elif [ -f $TMPDIR/boot/cmdline.txt ]; then
sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/boot/cmdline.txt sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/boot/cmdline.txt
fi fi
echo "Set root partition to $ROOT_PARTUUID in the relevant boot script..." #sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/root/etc/fstab
sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PARTUUID/g" $TMPDIR/root/etc/fstab
echo "Set root partition to $ROOT_PARTUUID in /etc/fstab if applicable..."
sync sync
if [[ "$FSTYPE" = "btrfs" ]]; then
sed -i "s/LABEL=ROOT_MNJRO/PARTUUID=$ROOT_PART/g" $TMPDIR/root/etc/fstab
else
echo "PARTUUID=$ROOT_PARTUUID / $FSTYPE defaults 0 1" >> $TMPDIR/root/etc/fstab
fi
#clean up #clean up
if [[ "$FSTYPE" = "btrfs" ]]; then if [[ "$FSTYPE" = "btrfs" ]]; then
umount $TMPDIR/root/home umount $TMPDIR/root/home
@ -401,8 +407,8 @@ cleanup () {
cryptsetup close /dev/mapper/ROOT_MNJRO cryptsetup close /dev/mapper/ROOT_MNJRO
fi fi
fi fi
partprobe $SDCARD 1> /dev/null 2>&1
partprobe $SDCARD 1> /dev/null 2>&1
info "If you get an error stating 'failed to preserve ownership ... Operation not permitted', it's expected, since the boot partition is FAT32 and does not support ownership permissions..." info "If you get an error stating 'failed to preserve ownership ... Operation not permitted', it's expected, since the boot partition is FAT32 and does not support ownership permissions..."
} }