mirror of
https://github.com/YunoHost-Apps/samba_ynh.git
synced 2024-09-03 20:16:27 +02:00
fix: write changes in smb.conf.d actualy to config file
This commit is contained in:
parent
3ae24b6dc9
commit
01521816b5
1 changed files with 18 additions and 10 deletions
|
@ -21,6 +21,19 @@ ynh_abort_if_errors
|
|||
data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
|
||||
#=================================================
|
||||
# recreate the smb.conf from smb.conf.d
|
||||
#=================================================
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
#=================================================
|
||||
|
@ -36,10 +49,10 @@ 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 $data_dir/$directory
|
||||
|
||||
|
@ -75,15 +88,8 @@ END
|
|||
fi
|
||||
done
|
||||
|
||||
cat > $install_dir/smb.conf <<EOF
|
||||
# =================================================
|
||||
# DO NOT EDIT THIS FILE
|
||||
# EDIT SUBPARTS IN /etc/samba/smb.conf.d
|
||||
# =================================================
|
||||
write_smb_conf
|
||||
|
||||
EOF
|
||||
cat $install_dir/smb.conf.d/*.conf >> $install_dir/smb.conf
|
||||
|
||||
#---------------------------------------------
|
||||
# IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too
|
||||
#---------------------------------------------
|
||||
|
@ -100,6 +106,7 @@ set__readonly_dir() {
|
|||
ynh_write_var_in_file --file=$install_dir/smb.conf.d/$directory.conf --key="read only" --value="$value"
|
||||
done
|
||||
ynh_app_setting_set $app readonly_dir $readonly_dir
|
||||
write_smb_conf
|
||||
}
|
||||
|
||||
set__unbrowseable() {
|
||||
|
@ -113,6 +120,7 @@ set__unbrowseable() {
|
|||
done
|
||||
ynh_app_setting_set $app unbrowseable $unbrowseable
|
||||
|
||||
write_smb_conf
|
||||
}
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
Loading…
Reference in a new issue