mirror of
https://github.com/YunoHost-Apps/samba_ynh.git
synced 2024-09-03 20:16:27 +02:00
commit
6b748631a6
11 changed files with 200 additions and 69 deletions
|
@ -1,6 +1,8 @@
|
|||
# All available README files by language
|
||||
|
||||
- [Read the README in English](README.md)
|
||||
- [Lee el README en español](README_es.md)
|
||||
- [Irakurri README euskaraz](README_eu.md)
|
||||
- [Lire le README en français](README_fr.md)
|
||||
- [Le o README en galego](README_gl.md)
|
||||
- [Leggi il “README” in italiano](README_it.md)
|
||||
- [阅读中文(简体)的 README](README_zh_Hans.md)
|
||||
|
|
|
@ -9,7 +9,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
[](https://install-app.yunohost.org/?app=samba)
|
||||
|
||||
*[Read this README is other languages.](./ALL_README.md)*
|
||||
*[Read this README in other languages.](./ALL_README.md)*
|
||||
|
||||
> *This package allows you to install Samba quickly and simply on a YunoHost server.*
|
||||
> *If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.*
|
||||
|
|
49
README_es.md
Normal file
49
README_es.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!--
|
||||
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
|
||||
No se debe editar a mano.
|
||||
-->
|
||||
|
||||
# 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: <https://www.samba.org/>
|
||||
- Documentación administrador oficial: <https://www.samba.org/samba/docs/>
|
||||
- Repositorio del código fuente oficial de la aplicación : <https://git.samba.org/?p=samba.git;a=summary>
|
||||
- Catálogo YunoHost: <https://apps.yunohost.org/app/samba>
|
||||
- Reportar un error: <https://github.com/YunoHost-Apps/samba_ynh/issues>
|
||||
|
||||
## 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:** <https://yunohost.org/packaging_apps>
|
49
README_eu.md
Normal file
49
README_eu.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!--
|
||||
Ohart ongi: README hau automatikoki sortu da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>ri esker
|
||||
EZ editatu eskuz.
|
||||
-->
|
||||
|
||||
# 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: <https://www.samba.org/>
|
||||
- Administratzaileen dokumentazio ofiziala: <https://www.samba.org/samba/docs/>
|
||||
- Jatorrizko aplikazioaren kode-gordailua: <https://git.samba.org/?p=samba.git;a=summary>
|
||||
- YunoHost Denda: <https://apps.yunohost.org/app/samba>
|
||||
- Eman errore baten berri: <https://github.com/YunoHost-Apps/samba_ynh/issues>
|
||||
|
||||
## 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:** <https://yunohost.org/packaging_apps>
|
49
README_zh_Hans.md
Normal file
49
README_zh_Hans.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!--
|
||||
注意:此 README 由 <https://github.com/YunoHost/apps/tree/master/tools/readme_generator> 自动生成
|
||||
请勿手动编辑。
|
||||
-->
|
||||
|
||||
# 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
|
||||
## 文档与资源
|
||||
|
||||
- 官方应用网站: <https://www.samba.org/>
|
||||
- 官方管理文档: <https://www.samba.org/samba/docs/>
|
||||
- 上游应用代码库: <https://git.samba.org/?p=samba.git;a=summary>
|
||||
- YunoHost 商店: <https://apps.yunohost.org/app/samba>
|
||||
- 报告 bug: <https://github.com/YunoHost-Apps/samba_ynh/issues>
|
||||
|
||||
## 开发者信息
|
||||
|
||||
请向 [`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
|
||||
```
|
||||
|
||||
**有关应用打包的更多信息:** <https://yunohost.org/packaging_apps>
|
|
@ -2,7 +2,7 @@ version = "1.0"
|
|||
|
||||
[main]
|
||||
name = "shared directory"
|
||||
services = ["samba"]
|
||||
services = ["smbd"]
|
||||
|
||||
[main.main]
|
||||
name = ""
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
echo "${YNH_USER_PASSWORD}
|
||||
${YNH_USER_PASSWORD}
|
||||
" | sudo smbpasswd -a $YNH_USER_USERNAME
|
||||
" | smbpasswd -a $YNH_USER_USERNAME
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
user=$1
|
||||
pdbedit -x -u $1
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
echo "${YNH_USER_PASSWORD}
|
||||
${YNH_USER_PASSWORD}
|
||||
" | sudo smbpasswd -a $YNH_USER_USERNAME
|
||||
" | smbpasswd -a $YNH_USER_USERNAME
|
||||
|
||||
|
|
105
scripts/config
105
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 <<EOF
|
||||
# =================================================
|
||||
# DO NOT EDIT THIS FILE
|
||||
# EDIT SUBPARTS IN /etc/samba/smb.conf.d
|
||||
# =================================================
|
||||
|
||||
EOF
|
||||
cat $install_dir/smb.conf.d/*.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 <<END
|
||||
# Add the configuration in /etc/samba/smb.conf.d/ if its missing
|
||||
if [ ! -f "$install_dir/smb.conf.d/$directory.conf" ]; then
|
||||
cat > $install_dir/smb.conf.d/$directory.conf <<END
|
||||
[$directory]
|
||||
comment = $directory
|
||||
read only = no
|
||||
path = $datadir/$directory
|
||||
path = $data_dir/$directory
|
||||
guest ok = no
|
||||
browsable = yes
|
||||
valid users = @samba.$directory
|
||||
|
@ -88,58 +78,51 @@ set__directories() {
|
|||
recycle:keeptree = yes
|
||||
recycle:versions = yes
|
||||
END
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# Remove configuration for unlisted directories
|
||||
pushd $final_path/smb.conf.d
|
||||
for $directory in $(ls !(0-global).conf)
|
||||
do
|
||||
if ! [[ "${directory%.conf}" =~ $(echo "^($(echo $directories | sed s/ /|/g))$") ]]; then
|
||||
ynh_secure_remove "$final_path/smb.conf.d/"
|
||||
for directory in $(find $install_dir/smb.conf.d/ -maxdepth 1 -type f -not -name '0-global.conf' -exec basename {} \;); do
|
||||
if ! [[ "${directory%.conf}" =~ $(echo "^($(echo $directories | sed 's/,\| /|/g'))$") ]]; then
|
||||
ynh_secure_remove "$install_dir/smb.conf.d/$directory"
|
||||
fi
|
||||
done
|
||||
popd
|
||||
|
||||
cat > $final_path/smb.conf <<EOF
|
||||
# =================================================
|
||||
# DO NOT EDIT THIS FILE
|
||||
# EDIT SUBPARTS IN /etc/samba/smb.conf.d
|
||||
# =================================================
|
||||
write_smb_conf
|
||||
|
||||
EOF
|
||||
cat $final_path/smb.conf.d/*.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
|
||||
#=================================================
|
||||
|
|
|
@ -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=''
|
||||
|
|
Loading…
Add table
Reference in a new issue