UUID based fstab
This commit is contained in:
parent
ac5d8f1645
commit
18674a4b0c
|
@ -139,9 +139,7 @@ generate_initramfs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_cmdline() {
|
get_cmdline() {
|
||||||
local rootdev="$(resolve_device_by_id "$DISK_ID_ROOT")"
|
echo -n "${DISK_DRACUT_CMDLINE[*]} root=UUID=$(get_blkid_uuid_for_id "$DISK_ID_ROOT")"
|
||||||
local rootuuid="$(get_blkid_field_by_device 'UUID' "$rootdev")"
|
|
||||||
echo -n "${DISK_DRACUT_CMDLINE[*]} root=UUID=$rootuuid"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_kernel_efi() {
|
install_kernel_efi() {
|
||||||
|
@ -221,22 +219,23 @@ install_kernel() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_fstab_entry() {
|
||||||
|
printf '%-46s %-24s %-6s %-96s %s' "$1" "$2" "$3" "$4" "$5" >> /etc/fstab \
|
||||||
|
|| die "Could not append entry to fstab"
|
||||||
|
}
|
||||||
|
|
||||||
generate_fstab() {
|
generate_fstab() {
|
||||||
einfo "Generating fstab"
|
einfo "Generating fstab"
|
||||||
install -m0644 -o root -g root "$GENTOO_INSTALL_REPO_DIR/configs/fstab" /etc/fstab \
|
install -m0644 -o root -g root "$GENTOO_INSTALL_REPO_DIR/configs/fstab" /etc/fstab \
|
||||||
|| die "Could not overwrite /etc/fstab"
|
|| die "Could not overwrite /etc/fstab"
|
||||||
echo "$(resolve_device_by_id "$DISK_ID_ROOT") / ext4 defaults,noatime,errors=remount-ro,discard 0 1" >> /etc/fstab \
|
add_fstab_entry "UUID=$(get_blkid_uuid_for_id "$DISK_ID_ROOT")" "/" "ext4" "defaults,noatime,errors=remount-ro,discard" "0 1"
|
||||||
|| die "Could not append entry to fstab"
|
|
||||||
if [[ $IS_EFI == "true" ]]; then
|
if [[ $IS_EFI == "true" ]]; then
|
||||||
echo "$(resolve_device_by_id "$DISK_ID_EFI") /boot/efi vfat defaults,noatime,fmask=0022,dmask=0022,noexec,nodev,nosuid,discard 0 2" >> /etc/fstab \
|
add_fstab_entry "UUID=$(get_blkid_uuid_for_id "$DISK_ID_EFI")" "/boot/efi" "vfat" "defaults,noatime,fmask=0022,dmask=0022,noexec,nodev,nosuid,discard" "0 2"
|
||||||
|| die "Could not append entry to fstab"
|
|
||||||
else
|
else
|
||||||
echo "$(resolve_device_by_id "$DISK_ID_BIOS") /boot vfat defaults,noatime,fmask=0022,dmask=0022,noexec,nodev,nosuid,discard 0 2" >> /etc/fstab \
|
add_fstab_entry "UUID=$(get_blkid_uuid_for_id "$DISK_ID_BIOS")" "/boot" "vfat" "defaults,noatime,fmask=0022,dmask=0022,noexec,nodev,nosuid,discard" "0 2"
|
||||||
|| die "Could not append entry to fstab"
|
|
||||||
fi
|
fi
|
||||||
if [[ -v "DISK_ID_SWAP" ]]; then
|
if [[ -v "DISK_ID_SWAP" ]]; then
|
||||||
echo "$(resolve_device_by_id "$DISK_ID_SWAP") none swap defaults,discard 0 0" >> /etc/fstab \
|
add_fstab_entry "$(resolve_device_by_id "$DISK_ID_SWAP")" "none" "swap" "defaults,discard" "0 0"
|
||||||
|| die "Could not append entry to fstab"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,12 @@ get_blkid_field_by_device() {
|
||||||
echo -n "$val"
|
echo -n "$val"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_blkid_uuid_for_id() {
|
||||||
|
local dev="$(resolve_device_by_id "$1")"
|
||||||
|
local uuid="$(get_blkid_field_by_device 'UUID' "$dev")"
|
||||||
|
echo -n "$uuid"
|
||||||
|
}
|
||||||
|
|
||||||
get_device_by_blkid_field() {
|
get_device_by_blkid_field() {
|
||||||
local blkid_field="$1"
|
local blkid_field="$1"
|
||||||
local field_value="$2"
|
local field_value="$2"
|
||||||
|
|
Loading…
Reference in New Issue