diff options
author | Kim Hagen <kim.sidney@gmail.com> | 2019-06-14 10:57:02 +0200 |
---|---|---|
committer | Kim Hagen <kim.sidney@gmail.com> | 2019-06-14 10:57:02 +0200 |
commit | 88a44d6deb1834832eb58c1819bc054d2970a729 (patch) | |
tree | 26ebffd6f8a15057c7b1fa4e822bf9e4b5219c03 /components/9990-misc-helpers.sh | |
parent | 02ebce2d26cd9d51b236c9e4087bed69a32fe70c (diff) | |
download | live-boot-88a44d6deb1834832eb58c1819bc054d2970a729.tar.gz live-boot-88a44d6deb1834832eb58c1819bc054d2970a729.zip |
do not mount unknown filesystems or raid slaves
Diffstat (limited to 'components/9990-misc-helpers.sh')
-rwxr-xr-x | components/9990-misc-helpers.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh index 605ee8a..9dd7ef5 100755 --- a/components/9990-misc-helpers.sh +++ b/components/9990-misc-helpers.sh @@ -712,6 +712,25 @@ mount_persistence_media () return 1 fi + fstype="$(get_fstype ${device})" + if [ "${fstype}" = "unknown" ] + return 1 + fi + + raid_drives=$(cat /proc/partitions | awk '{ if ($4!="name") { print $4 } }' \ + | grep "md" | egrep -v "^$") + + disks=() + for raid_drive in $raid_drives; do + disks+=`ls /sys/block/$raid_drive/slaves` + done + + for disk in ${disks[@]}; do + if [ "/dev/${disk}" = "${device}" ] + return 1 + fi + done + backing="/live/persistence/" mkdir -p "${backing}" @@ -719,6 +738,10 @@ mount_persistence_media () if [ -z "${old_backing}" ] then fstype="$(get_fstype ${device})" + if [ "${fstype}" = "unknown" ] + return 1 + fi + mount_opts="rw,noatime" if [ -n "${PERSISTENCE_READONLY}" ] then |