diff --git a/README_es.md b/README_es.md
new file mode 100644
index 0000000..9772bee
--- /dev/null
+++ b/README_es.md
@@ -0,0 +1,49 @@
+
+
+# Samba para Yunohost
+
+[](https://dash.yunohost.org/appci/app/samba)  
+
+[](https://install-app.yunohost.org/?app=samba)
+
+*[Leer este README en otros idiomas.](./ALL_README.md)*
+
+> *Este paquete le permite instalarSamba rapidamente y simplement en un servidor YunoHost.*
+> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
+
+## Descripción general
+
+This package allows you to create directories reachable on a private network.
+
+### Features
+
+- Create and name your directories;
+- Configure permissions for your directories thanks to the yunohost permission view;
+- Define readonly directories
+
+
+**Versión actual:** 4.13.13~ynh2
+## Documentaciones y recursos
+
+- Sitio web oficial:
+- Documentación administrador oficial:
+- Repositorio del código fuente oficial de la aplicación :
+- Catálogo YunoHost:
+- Reportar un error:
+
+## Información para desarrolladores
+
+Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/samba_ynh/tree/testing
+
+Para probar la rama `testing`, sigue asÍ:
+
+```bash
+sudo yunohost app install https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
+o
+sudo yunohost app upgrade samba -u https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
+```
+
+**Mas informaciones sobre el empaquetado de aplicaciones:**
diff --git a/README_eu.md b/README_eu.md
new file mode 100644
index 0000000..e729211
--- /dev/null
+++ b/README_eu.md
@@ -0,0 +1,49 @@
+
+
+# Samba YunoHost-erako
+
+[](https://dash.yunohost.org/appci/app/samba)  
+
+[](https://install-app.yunohost.org/?app=samba)
+
+*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
+
+> *Pakete honek Samba YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*
+> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
+
+## Aurreikuspena
+
+This package allows you to create directories reachable on a private network.
+
+### Features
+
+- Create and name your directories;
+- Configure permissions for your directories thanks to the yunohost permission view;
+- Define readonly directories
+
+
+**Paketatutako bertsioa:** 4.13.13~ynh2
+## Dokumentazioa eta baliabideak
+
+- Aplikazioaren webgune ofiziala:
+- Administratzaileen dokumentazio ofiziala:
+- Jatorrizko aplikazioaren kode-gordailua:
+- YunoHost Denda:
+- Eman errore baten berri:
+
+## Garatzaileentzako informazioa
+
+Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/samba_ynh/tree/testing).
+
+`testing` abarra probatzeko, ondorengoa egin:
+
+```bash
+sudo yunohost app install https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
+edo
+sudo yunohost app upgrade samba -u https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
+```
+
+**Informazio gehiago aplikazioaren paketatzeari buruz:**
diff --git a/README_zh_Hans.md b/README_zh_Hans.md
new file mode 100644
index 0000000..b047e55
--- /dev/null
+++ b/README_zh_Hans.md
@@ -0,0 +1,49 @@
+
+
+# YunoHost 上的 Samba
+
+[](https://dash.yunohost.org/appci/app/samba)  
+
+[](https://install-app.yunohost.org/?app=samba)
+
+*[阅读此 README 的其它语言版本。](./ALL_README.md)*
+
+> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 Samba。*
+> *如果您还没有 YunoHost,请参阅[指南](https://yunohost.org/install)了解如何安装它。*
+
+## 概况
+
+This package allows you to create directories reachable on a private network.
+
+### Features
+
+- Create and name your directories;
+- Configure permissions for your directories thanks to the yunohost permission view;
+- Define readonly directories
+
+
+**分发版本:** 4.13.13~ynh2
+## 文档与资源
+
+- 官方应用网站:
+- 官方管理文档:
+- 上游应用代码库:
+- YunoHost 商店:
+- 报告 bug:
+
+## 开发者信息
+
+请向 [`testing` 分支](https://github.com/YunoHost-Apps/samba_ynh/tree/testing) 发送拉取请求。
+
+如要尝试 `testing` 分支,请这样操作:
+
+```bash
+sudo yunohost app install https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
+或
+sudo yunohost app upgrade samba -u https://github.com/YunoHost-Apps/samba_ynh/tree/testing --debug
+```
+
+**有关应用打包的更多信息:**
diff --git a/config_panel.toml b/config_panel.toml
index 868ea8b..b1201cc 100644
--- a/config_panel.toml
+++ b/config_panel.toml
@@ -2,7 +2,7 @@ version = "1.0"
[main]
name = "shared directory"
-services = ["samba"]
+services = ["smbd"]
[main.main]
name = ""
diff --git a/scripts/config b/scripts/config
index 8232a73..55f35ed 100644
--- a/scripts/config
+++ b/scripts/config
@@ -1,10 +1,10 @@
#!/bin/bash
-# In simple cases, you don't need a config script.
+# In simple cases, you don't need a config script.
-# With a simple config_panel.toml, you can write in the app settings, in the
+# With a simple config_panel.toml, you can write in the app settings, in the
# upstream config file or replace complete files (logo ...) and restart services.
-# The config scripts allows you to go further, to handle specific cases
+# The config scripts allows you to go further, to handle specific cases
# (validation of several interdependent fields, specific getter/setter for a value,
# display dynamic informations or choices, pre-loading of config type .cube... ).
@@ -18,40 +18,30 @@ source /usr/share/yunohost/helpers
ynh_abort_if_errors
-datadir=$(ynh_app_setting_get --app=$app --key=datadir)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
+data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
+install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
-# SPECIFIC GETTERS FOR TOML SHORT KEY
+# recreate the smb.conf from smb.conf.d
#=================================================
-get__readonly_dir() {
- local directories=$(ynh_app_setting_get $app directories)
- if [[ "$directories" == "" ]]
- then
- echo "choices: []"
- else
- echo "choices:"
- for directory in $(echo $directories | sed "s/,/ /g")
- do
- echo " $directory: $directory"
- done
- fi
+write_smb_conf() {
+ cat > $install_dir/smb.conf <> $install_dir/smb.conf
}
-get__unbrowseable() {
- get__readonly_dir
-}
-
-#=================================================
-# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
-#=================================================
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__directories() {
- mkdir -p $final_path/smb.conf.d
+ mkdir -p $install_dir/smb.conf.d
#---------------------------------------------
# IMPORTANT: setter are trigger only if a change is detected
@@ -59,25 +49,25 @@ set__directories() {
for directory in $(echo $directories | sed "s/,/ /g"); do
# Create yunohost permission
- if ! ynh_permission_exists --permission=$directory ; then
+ if ! ynh_permission_exists --permission=$directory ; then
ynh_permission_create --permission="$directory" --allowed=all_users --show_tile=false
fi
-
+
# Create the directory
- mkdir -p $datadir/$directory
+ mkdir -p $data_dir/$directory
- chmod 750 "$datadir/$directory"
- chmod -R o-rwx "$datadir/$directory"
- chown -R root:root "$datadir/$directory"
- setfacl -R -m g:samba.$directory:rwx,d:g:samba.$directory:rwx $datadir/$directory
+ chmod 750 "$data_dir/$directory"
+ chmod -R o-rwx "$data_dir/$directory"
+ chown -R root:root "$data_dir/$directory"
+ setfacl -R -m g:samba.$directory:rwx,d:g:samba.$directory:rwx $data_dir/$directory
-
- # Add the configuration in /etc/samba/smb.conf if needed
- cat > $final_path/smb.conf.d/$directory.conf < $install_dir/smb.conf.d/$directory.conf < $final_path/smb.conf <> $final_path/smb.conf
-
#---------------------------------------------
# IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too
#---------------------------------------------
- ynh_app_setting_set $app directories $directories
+ ynh_app_setting_set $app directories "$directories"
}
set__readonly_dir() {
local value
- for directory in $directories; do
+ for directory in $(echo $directories | sed "s/,/ /g"); do
value="no"
- if [[ $directory =~ $(echo "^($(echo $readonly_dir | sed s/ /|/g))$") ]]; then
+ if [[ -n "$readonly_dir" && $directory =~ $(echo "^($(echo $readonly_dir | sed 's/,\| /|/g'))$") ]]; then
value="yes"
fi
- ynh_write_var_in_file --file=$final_path/smb.conf.d/$directory.conf --key="read only" --value="$value"
+ ynh_write_var_in_file --file=$install_dir/smb.conf.d/$directory.conf --key=read[[:space:]]only --value="$value"
done
- ynh_app_setting_set $app readonly_dir $readonly_dir
+ ynh_app_setting_set $app readonly_dir "$readonly_dir"
+ write_smb_conf
}
set__unbrowseable() {
local value
- for directory in $directories; do
+ for directory in $(echo $directories | sed "s/,/ /g"); do
value="yes"
- if [[ $directory =~ $(echo "^($(echo $unbrowseable | sed s/ /|/g))$") ]]; then
+ if [[ -n "$unbrowseable" && $directory =~ $(echo "^($(echo $unbrowseable | sed 's/,\| /|/g'))$") ]]; then
value="no"
fi
- ynh_write_var_in_file --file=$final_path/smb.conf.d/$directory.conf --key="browsable" --value="$value"
+ ynh_write_var_in_file --file=$install_dir/smb.conf.d/$directory.conf --key="browsable" --value="$value"
done
- ynh_app_setting_set $app unbrowseable $unbrowseable
-
+ ynh_app_setting_set $app unbrowseable "$unbrowseable"
+ write_smb_conf
}
+
#=================================================
# GENERIC FINALIZATION
#=================================================
diff --git a/scripts/install b/scripts/install
index 3c2b913..4edf583 100755
--- a/scripts/install
+++ b/scripts/install
@@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
-ynh_app_setting_set --app=$app --key=directories --value=shared
+ynh_app_setting_set --app=$app --key=directories --value=share
ynh_app_setting_set --app=$app --key=advanced --value=0
ynh_app_setting_set --app=$app --key=readonly_dir --value=''
ynh_app_setting_set --app=$app --key=unbrowseable --value=''