mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-10 09:35:58 +02:00
allow mount by label
This commit is contained in:
@@ -28,12 +28,14 @@ comparison to installing any other Hass.io add-on.
|
||||
|
||||
Options :
|
||||
|
||||
- "download_dir": "/share/downloads" # where the files will be saved after download
|
||||
- "incomplete_dir": "/share/incomplete" # where the files are saved during download
|
||||
- "localdisks": ["sda1"] # list of devices to mount, '' if none
|
||||
- "networkdisks": "<//SERVER/SHARE>" # list of smbv2/3 servers to mount, '' if none
|
||||
- "cifsusername": "<username>" # smb username
|
||||
- "cifspassword": "<password>" # smb password
|
||||
```yaml
|
||||
download_dir: "/share/downloads" # where the files will be saved after download
|
||||
incomplete_dir: "/share/incomplete" # where the files are saved during download
|
||||
localdisks: sda1 #put the hardware name of your drive to mount separated by commas, or its label. Ex: sda1, sdb1, MYNAS...
|
||||
networkdisks: "<//SERVER/SHARE>" # list of smbv2/3 servers to mount, '' if none
|
||||
cifsusername: "<username>" # smb username
|
||||
cifspassword: "<password>" # smb password
|
||||
```
|
||||
|
||||
Complete transmission options are in /share/transmission (make sure addon is stopped before modifying it as Transmission writes its ongoing values when stopping and could erase your changes)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user