Update livekitlib

Add support of nvme harddisks in functions init_devs() and find_data_try()
pull/63/head
codekoch 2018-12-24 13:26:32 +01:00 committed by GitHub
parent 4cd1d82c54
commit ad67aa7c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -2,7 +2,7 @@
# Functions library :: for Linux Live Kit scripts # Functions library :: for Linux Live Kit scripts
# Author: Tomas M. <http://www.linux-live.org> # Author: Tomas M. <http://www.linux-live.org>
# # Modifications: Olaf Koch <http.//mediakit.education>
# ================================================================= # =================================================================
# debug and output functions # debug and output functions
@ -189,6 +189,8 @@ init_devs()
modprobe loop 2>/dev/null modprobe loop 2>/dev/null
modprobe squashfs 2>/dev/null modprobe squashfs 2>/dev/null
modprobe fuse 2>/dev/null modprobe fuse 2>/dev/null
modprobe nvme_core 2>/dev/null
modprobe nvme 2>/dev/null
refresh_devs refresh_devs
} }
@ -503,12 +505,16 @@ find_data_try()
local DEVICE FS FROM OPTIONS MOUNT local DEVICE FS FROM OPTIONS MOUNT
mkdir -p "$1" mkdir -p "$1"
blkid | sort | cut -d: -f 1 | grep -E -v "/loop|/ram|/zram" | while read DEVICE; do ls /dev/ | egrep "sd|nvme" | while read DEVICE; do
nb=`printf $DEVICE | tail -c 1`
if [ "$nb" = "1" -o "$nb" = "2" -o "$nb" = "3" -o "$nb" = "4" -o "$nb" = "5" -o "$nb" = "6" -o "$nb" = "7" -o "$nb" = "8" -o "$nb" = "9" ]; then
DEVICE="/dev/$DEVICE"
#blkid | sort | cut -d: -f 1 | grep -E -v "/loop|/ram|/zram" | while read DEVICE; do
FROM="$2" FROM="$2"
FS="$(device_bestfs "$DEVICE")" FS="$(device_bestfs "$DEVICE")"
OPTIONS="$(fs_options $FS)" OPTIONS="$(fs_options $FS)"
MOUNT="$(mount_command $FS)" MOUNT="$(mount_command $FS)"
#echo -n "..$DEVICE.." >&2
$MOUNT "$DEVICE" "$1" $OPTIONS 2>/dev/null $MOUNT "$DEVICE" "$1" $OPTIONS 2>/dev/null
# if the FROM parameter is actual file, mount it again as loop (eg. iso) # if the FROM parameter is actual file, mount it again as loop (eg. iso)
@ -528,6 +534,7 @@ find_data_try()
# unmount twice, since there could be mounted ISO as loop too. If not, it doesn't hurt # unmount twice, since there could be mounted ISO as loop too. If not, it doesn't hurt
umount "$1" 2>/dev/null umount "$1" 2>/dev/null
umount "$1" 2>/dev/null umount "$1" 2>/dev/null
fi
done done
} }