From 349a7680c2ba05772cba6f4a9e0092b8cf83f4e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Sat, 25 Mar 2017 00:52:28 +0100 Subject: [PATCH] Switch to single btrfs data device Switch to grub2 --- config/data.conf | 10 ++++------ config/slash.conf | 6 ------ lib/install.sh | 6 +++++- lib/pattern.sh | 38 ++++++-------------------------------- 4 files changed, 15 insertions(+), 45 deletions(-) delete mode 100644 config/slash.conf diff --git a/config/data.conf b/config/data.conf index 6f0c759..271127c 100644 --- a/config/data.conf +++ b/config/data.conf @@ -1,8 +1,6 @@ -# Data luks name -DATANAME='home' -# Data luks path -DATAPATH='/home' -# Data uuid (uuidgen) +# Slash luks name +DATANAME='data' +# Slash uuid (uuidgen) DATAUUID=`uuidgen` -# Luks data uuid (uuidgen) +# Luks slash uuid (uuidgen) LUKSDATAUUID=`uuidgen` diff --git a/config/slash.conf b/config/slash.conf deleted file mode 100644 index 10b8f83..0000000 --- a/config/slash.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Slash luks name -SLASHNAME='slash' -# Slash uuid (uuidgen) -SLASHUUID=`uuidgen` -# Luks slash uuid (uuidgen) -LUKSSLASHUUID=`uuidgen` diff --git a/lib/install.sh b/lib/install.sh index 3ea2e80..cf0636b 100755 --- a/lib/install.sh +++ b/lib/install.sh @@ -29,7 +29,7 @@ fi mkdir -p "$PWD/root" # Install base config -LC_ALL=C urpmi --downloader=wget --no-verify-rpm --no-recommends --noclean --auto --root=$PWD/root filesystem basesystem-minimal rpm urpmi grub kernel-server-latest vim-enhanced wget +LC_ALL=C urpmi --downloader=wget --no-verify-rpm --no-recommends --noclean --auto --root=$PWD/root filesystem basesystem-minimal rpm urpmi grub2 grub2-mageia-theme kernel-server-latest vim-enhanced wget # Reinstall lockdev to fix missing lock group on binary LC_ALL=C urpmi --downloader=wget --no-verify-rpm --no-recommends --noclean --auto --replacepkgs --replacefiles --root=$PWD/root lockdev @@ -107,6 +107,10 @@ LC_ALL=C urpmi --downloader=wget --no-verify-rpm --no-recommends --noclean --aut xfsprogs \ zip +#XXX: to avoid boot time warning +# drakx-kbd-mouse-x11 \ +# polkit-agent-none \ + # Install locale if [ ! -z "$LOCALE_ALT" -a "$LOCALE_ALT" != 'en' ]; then LC_ALL=C urpmi --downloader=wget --no-verify-rpm --no-recommends --noclean --auto --root=$PWD/root \ diff --git a/lib/pattern.sh b/lib/pattern.sh index ed99a72..ee96dec 100755 --- a/lib/pattern.sh +++ b/lib/pattern.sh @@ -83,23 +83,19 @@ EOF fi #Fstab -#XXX: grub-legacy don't support ext4 and xfs V5 file format for /boot cat << EOF > "$PWD/root/etc/fstab" UUID=${BOOTUUID} /boot ext3 defaults,noatime 1 2 -UUID=${SLASHUUID} / btrfs defaults,relatime 1 1 +UUID=${DATAUUID} / btrfs subvol=/slash,defaults,relatime 1 1 UUID=${SWAPAUUID} none swap sw 0 0 UUID=${SWAPBUUID} none swap sw 0 0 -UUID=${DATAUUID} ${DATAPATH} btrfs defaults,relatime,nofail 1 2 +UUID=${DATAUUID} /home btrfs subvol=/home,defaults,relatime 1 1 proc /proc proc defaults 0 0 EOF -# Copy grub files -cp -f $PWD/root/lib/grub/${ARCH}-mageia/{e2fs_stage1_5,stage{1,2}} $PWD/root/boot/grub/ - #Crypttab +#XXX: Don't forget to add option nofail,noauto for every devices requiring manual unlocking cat << EOF > "$PWD/root/etc/crypttab" -${SLASHNAME} UUID=${LUKSSLASHUUID} -${DATANAME} UUID=${LUKSDATAUUID} - nofail,noauto +${DATANAME} UUID=${LUKSDATAUUID} EOF #Set resolv.conf @@ -120,30 +116,8 @@ echo -n "$ROOTPASS" | chroot $PWD/root passwd root --stdin chroot $PWD/root adduser -m "$USERLOGIN" echo -n "$USERPASS" | chroot $PWD/root passwd "$USERLOGIN" --stdin -#Grub file -cat << EOF > $PWD/root/boot/grub/menu.lst -timeout 5 -color black/cyan yellow/cyan -gfxmenu (hd0,0)/gfxmenu -default 0 - -title linux -root (hd0,0) -kernel /vmlinuz-server BOOT_IMAGE=linux root=UUID=$SLASHUUID PROFILE=default splash=verbose vga=793 -initrd /initrd-server.img - -title failsafe -root (hd0,0) -kernel /vmlinuz-server BOOT_IMAGE=failsafe root=UUID=$SLASHUUID rd.luks.uuid=$LUKSSLASHUUID failsafe -initrd /initrd-server.img -EOF -#Update grub fx menu -chroot $PWD/root grub-gfxmenu --lang fr --update-theme --update-gfxmenu - -#Grub device.map -cat << EOF > $PWD/root/boot/grub/device.map -(hd0) /dev/sda -EOF +# Fix grub config +perl -pne 's/^GRUB_TIMEOUT=[0-9]+$/GRUB_TIMEOUT=1/' -i $PWD/root/etc/default/grub #Shorewall cat << EOF >> $PWD/root/etc/shorewall/zones -- 2.41.1