mirror of
https://github.com/YunoHost-Apps/samba_ynh.git
synced 2024-09-03 20:16:27 +02:00
71 lines
2.6 KiB
Bash
Executable file
71 lines
2.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STORE SETTINGS FROM MANIFEST
|
|
#=================================================
|
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
|
|
|
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=''
|
|
|
|
#=================================================
|
|
# CREATE DATA DIRECTORY
|
|
#=================================================
|
|
ynh_script_progression --message="Creating a data directory..." --weight=1
|
|
|
|
chmod 750 "$data_dir/share"
|
|
chmod -R o-rwx "$data_dir/share"
|
|
chown -R root:root "$data_dir/share"
|
|
setfacl -R -m g:samba.share:rwx,d:g:samba.share:rwx $data_dir/share
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
mkdir -p $install_dir/smb.conf.d
|
|
ynh_add_config --template="global-smb.conf" --destination="$install_dir/smb.conf.d/0-global.conf"
|
|
ynh_add_config --template="share-smb.conf" --destination="$install_dir/smb.conf.d/share.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
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
|
|
yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports $port
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=10
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name=smbd --action="start"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|