allow mount by label

This commit is contained in:
Alexandre
2021-11-02 10:35:14 +01:00
parent e71ca26afc
commit 540cc43776
44 changed files with 427 additions and 117 deletions

View File

@@ -1,3 +1,4 @@
- Allow mounting local drives by label. Just pust the label instead of sda1 for example
- Allow mounting of devices up to sdg2
- Allow uploads >16mb
- Allow local mount in protected mode

View File

@@ -25,7 +25,7 @@ certfile: fullchain.pem #ssl certificate
keyfile: privkey.pem #sslkeyfile
NoAuth: true/false #Remove password. Resets database when changed.
smbv1: false # Should smbv1 be used instead of 2.1+?
localdisks: sda1 #put the hardware name of your drive to mount separated by commas. Ex: sda1, sdb1...
localdisks: sda1 #put the hardware name of your drive to mount separated by commas, or its label. Ex: sda1, sdb1, MYNAS...
networkdisks: "//SERVER/SHARE" # optional, list of smbv2/3 servers to mount, separated by commas
cifsusername: "username" # optional, smb username, same for all smb shares
cifspassword: "password" # optional, smb password, same for all smb shares)

View File

@@ -4,8 +4,6 @@
# MOUNT LOCAL SHARES #
######################
# Mount local Share if configured
if bashio::config.has_value 'localdisks'; then
@@ -14,10 +12,21 @@ if bashio::config.has_value 'localdisks'; then
# Separate comma separated values
for disk in ${MOREDISKS//,/ }; do
# Mount each disk
# Mount by device as default
devpath=/dev
# Mount as label
[ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label
# Creates dir
mkdir -p /mnt/$disk
chown -R $(id -u):$(id -g) /mnt/$disk
[ -d /share/$disk ] && mount /dev/$disk /share/$disk || true
mount /dev/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives!" && rmdir /mnt/$disk)
# Legacy mounting : mount to share if still exists (avoid breaking changes)
[ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true
# Mount
mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk)
done
fi