Read /etc/fstab to determine data partition

Rather than hard-code the GPT partition label into the `init-storage`
and `factory-reset` scripts, these now determine the block device by
reading `/etc/fstab` and using the device specified for `/var`.
master
Dustin 2023-03-15 20:53:02 -05:00
parent 749d5b818a
commit a4baa58563
3 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh
# vim: set sw=4 ts=4 sts=4 et :
DATAPART=PARTLABEL=dch-data
DATAPART=$(awk '$2=="/var"{print $1}' /etc/fstab)
seq 1 30

View File

@ -71,7 +71,7 @@ setup_etc() {
umount "${tmpdir}"
}
datapart=$(findfs PARTLABEL=dch-data)
datapart=$(findfs $(awk '$2=="/var"{print $1}' /etc/fstab))
if [ -b "${datapart}" ]; then
printf 'Found data partition: %s\n' "${datapart}"
else

View File

@ -45,6 +45,7 @@ files_runtime_filetrans(aimee_storinit_t, aimee_storinit_runtime_t, dir)
corecmd_exec_bin(aimee_storinit_t)
files_read_etc_files(aimee_storinit_t)
storage_raw_read_fixed_disk(aimee_storinit_t)
fstools_domtrans(aimee_storinit_t)
mount_exec(aimee_storinit_t)
@ -201,6 +202,7 @@ allow aimee_factory_reset_t self:fifo_file rw_fifo_file_perms;
corecmd_exec_bin(aimee_factory_reset_t)
dev_read_sysfs(aimee_factory_reset_t)
kernel_read_system_state(aimee_factory_reset_t)
files_read_etc_files(aimee_factory_reset_t)
fstools_exec(aimee_factory_reset_t)
fstools_manage_runtime_files(aimee_factory_reset_t)
miscfiles_read_localization(aimee_factory_reset_t)