Local mounts

This commit is contained in:
Alexandre
2021-11-29 21:03:59 +01:00
parent 0c804310be
commit 2bd7980e75
5 changed files with 55 additions and 1 deletions

View File

@@ -1,4 +1,7 @@
- Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename
- Add local drives mounts : used localdisks with the text "sda1, sdb1" according to your needs
- Add ssl
- Add ingress
## 2.1.2-ls63

View File

@@ -3,6 +3,23 @@
"arch": ["aarch64", "amd64", "armv7", "armhf"],
"boot": "auto",
"description": "Free, lightweight and easy-to-use home server for your comics and ebooks",
"devices": [
"/dev/mmcblk0p8",
"/dev/sda1",
"/dev/sdb1",
"/dev/sdc1",
"/dev/sdd1",
"/dev/sde1",
"/dev/sdf1",
"/dev/sdg1",
"/dev/sda2",
"/dev/sdb2",
"/dev/sdc2",
"/dev/sdd2",
"/dev/sde2",
"/dev/sdf2",
"/dev/sdg2"
],
"environment": {},
"ingress": true,
"ingress_stream": true,
@@ -41,6 +58,7 @@
"networkdisks": "str?",
"cifsusername": "str?",
"cifspassword": "str?",
"localdisks": "str?",
"smbv1": "bool?",
"TZ": "str?"
},

View File

@@ -13,3 +13,4 @@ declare keyfile
port=$(bashio::addon.ingress_port)
sed -i "s|%%port%%|$port|g" /etc/nginx/servers/ingress.conf
sed -i "s|%%interface%%|$(bashio::addon.ip_address)|g" /etc/nginx/servers/ingress.conf
bashio::log.info "Ingress enabled"

View File

@@ -22,5 +22,5 @@ if bashio::config.true 'ssl'; then
sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf
sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf
sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf
bashio::log.info "Ssl enabled, please use https for connection"
bashio::log.info "Ssl enabled, please use https for connection. UI is at https://YOURIP:$(bashio::addon.port 2205)/ubooquity ; admin is at https://YOURIP:$(bashio::addon.port 2206)/ubooquity/admin"
fi

View File

@@ -0,0 +1,32 @@
#!/usr/bin/with-contenv bashio
######################
# MOUNT LOCAL SHARES #
######################
# Mount local Share if configured
if bashio::config.has_value 'localdisks'; then
MOREDISKS=$(bashio::config 'localdisks')
echo "Local Disks mounting..."
# Separate comma separated values
for disk in ${MOREDISKS//,/ }; do
# 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
# 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