mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 21:24:20 +01:00
Add new folders & clean smb addon
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Samba share",
|
||||
"version": "0.4",
|
||||
"version": "0.5",
|
||||
"slug": "samba",
|
||||
"description": "Expose HassIO folders with Samba",
|
||||
"url": "https://home-assistant.io/addons/samba/",
|
||||
@@ -9,13 +9,15 @@
|
||||
"ports": {
|
||||
"445/tcp": 445
|
||||
},
|
||||
"map": ["config:rw", "ssl:rw", "addons:rw"],
|
||||
"map": ["config:rw", "ssl:rw", "addons:rw", "share:rw", "mnt:rw"],
|
||||
"options": {
|
||||
"workgroup": "WORKGROUP",
|
||||
"guest": true,
|
||||
"map_config": true,
|
||||
"map_addons": true,
|
||||
"map_ssl": false,
|
||||
"map_share": true,
|
||||
"map_mnt": false,
|
||||
"username": "",
|
||||
"password": ""
|
||||
},
|
||||
@@ -25,6 +27,8 @@
|
||||
"map_config": "bool",
|
||||
"map_addons": "bool",
|
||||
"map_ssl": "bool",
|
||||
"map_share": "bool",
|
||||
"map_mnt": "bool",
|
||||
"username": "str",
|
||||
"password": "str"
|
||||
},
|
||||
|
||||
55
samba/run.sh
55
samba/run.sh
@@ -10,12 +10,16 @@ PASSWORD=$(jq --raw-output ".password // empty" $CONFIG_PATH)
|
||||
MAP_CONFIG=$(jq --raw-output ".map_config // empty" $CONFIG_PATH)
|
||||
MAP_ADDONS=$(jq --raw-output ".map_addons // empty" $CONFIG_PATH)
|
||||
MAP_SSL=$(jq --raw-output ".map_ssl // empty" $CONFIG_PATH)
|
||||
MAP_SHARE=$(jq --raw-output ".map_share // empty" $CONFIG_PATH)
|
||||
MAP_MNT=$(jq --raw-output ".map_mnt // empty" $CONFIG_PATH)
|
||||
|
||||
SMB_CONFIG="
|
||||
[config]
|
||||
|
||||
function write_config() {
|
||||
echo "
|
||||
[$1]
|
||||
browseable = yes
|
||||
writeable = yes
|
||||
path = /config
|
||||
path = /$1
|
||||
|
||||
#guest ok = yes
|
||||
#guest only = yes
|
||||
@@ -24,50 +28,27 @@ SMB_CONFIG="
|
||||
#valid users = $USERNAME
|
||||
#force user = root
|
||||
#force group = root
|
||||
"
|
||||
|
||||
SMB_SSL="
|
||||
[ssl]
|
||||
browseable = yes
|
||||
writeable = yes
|
||||
path = /ssl
|
||||
|
||||
#guest ok = yes
|
||||
#guest only = yes
|
||||
#public = yes
|
||||
|
||||
#valid users = $USERNAME
|
||||
#force user = root
|
||||
#force group = root
|
||||
"
|
||||
|
||||
SMB_ADDONS="
|
||||
[addons]
|
||||
browseable = yes
|
||||
writeable = yes
|
||||
path = /addons
|
||||
|
||||
#guest ok = yes
|
||||
#guest only = yes
|
||||
#public = yes
|
||||
|
||||
#valid users = $USERNAME
|
||||
#force user = root
|
||||
#force group = root
|
||||
"
|
||||
" >> /etc/smb.conf
|
||||
}
|
||||
|
||||
sed -i "s/%%WORKGROUP%%/$WORKGROUP/g" /etc/smb.conf
|
||||
|
||||
##
|
||||
# Write shares to config
|
||||
if [ "$MAP_CONFIG" == "true" ]; then
|
||||
echo "$SMB_CONFIG" >> /etc/smb.conf
|
||||
write_config "config"
|
||||
fi
|
||||
if [ "$MAP_ADDONS" == "true" ]; then
|
||||
echo "$SMB_ADDONS" >> /etc/smb.conf
|
||||
write_config "addons"
|
||||
fi
|
||||
if [ "$MAP_SSL" == "true" ]; then
|
||||
echo "$SMB_SSL" >> /etc/smb.conf
|
||||
write_config "ssl"
|
||||
fi
|
||||
if [ "$MAP_SHARE" == "true" ]; then
|
||||
write_config "share"
|
||||
fi
|
||||
if [ "$MAP_MNT" == "true" ]; then
|
||||
write_config "mnt"
|
||||
fi
|
||||
|
||||
##
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"ports": {
|
||||
"22/tcp": 22
|
||||
},
|
||||
"map": ["config:rw", "ssl:rw", "addons:rw"],
|
||||
"map": ["config:rw", "ssl:rw", "addons:rw", "share:rw", "mnt:rw"],
|
||||
"options": {
|
||||
"authorized_keys": [null]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user