mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-04 06:44:06 +02:00
Address code review: use mountpoint -q for collision check, tighten NFS regex
Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
@@ -232,7 +232,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
if [[ "$disk" =~ ^nfs:// ]]; then
|
if [[ "$disk" =~ ^nfs:// ]]; then
|
||||||
FSTYPE="nfs"
|
FSTYPE="nfs"
|
||||||
disk="${disk#nfs://}"
|
disk="${disk#nfs://}"
|
||||||
elif [[ "$disk" =~ ^[^/][^:]*:/.+ ]]; then
|
elif [[ "$disk" =~ ^[^/:]+:/.+ ]]; then
|
||||||
FSTYPE="nfs"
|
FSTYPE="nfs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -246,8 +246,8 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
diskname="${diskname//\\//}"
|
diskname="${diskname//\\//}"
|
||||||
diskname="${diskname##*/}"
|
diskname="${diskname##*/}"
|
||||||
|
|
||||||
if [[ -d "/mnt/$diskname" ]]; then
|
if mountpoint -q "/mnt/$diskname" 2>/dev/null; then
|
||||||
bashio::log.warning "...... mount point /mnt/$diskname already exists (name collision for $disk). Skipping this share."
|
bashio::log.warning "...... mount point /mnt/$diskname already in use (name collision for $disk). Skipping this share."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ if bashio::config.has_value 'networkdisks'; then
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ ! "$disk" =~ ^[^:]+:/.+ ]]; then
|
if [[ ! "$disk" =~ ^[^/:]+:/.+ ]]; then
|
||||||
bashio::log.fatal "...... invalid NFS path \"$disk\". Use server:/export/path or 123.12.12.12:/export/path"
|
bashio::log.fatal "...... invalid NFS path \"$disk\". Use server:/export/path or 123.12.12.12:/export/path"
|
||||||
echo "Invalid NFS path structure: $disk" >"$ERRORCODE_FILE" || true
|
echo "Invalid NFS path structure: $disk" >"$ERRORCODE_FILE" || true
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user