mirror of
https://github.com/YunoHost-Apps/samba_ynh.git
synced 2024-09-03 20:16:27 +02:00
64 lines
2.3 KiB
Bash
Executable file
64 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STORE SETTINGS FROM MANIFEST
|
|
#=================================================
|
|
ynh_script_progression "Storing installation settings..."
|
|
|
|
ynh_app_setting_set --key=directories --value=share
|
|
ynh_app_setting_set --key=advanced --value=0
|
|
ynh_app_setting_set --key=readonly_dir --value=''
|
|
ynh_app_setting_set --key=unbrowseable --value=''
|
|
|
|
#=================================================
|
|
# CREATE DATA DIRECTORY
|
|
#=================================================
|
|
ynh_script_progression "Creating a data directory..."
|
|
|
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | 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 "Adding $app's configuration..."
|
|
|
|
mkdir -p $install_dir/smb.conf.d
|
|
ynh_config_add --template="global-smb.conf" --destination="$install_dir/smb.conf.d/0-global.conf"
|
|
ynh_config_add --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
|
|
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression "Integrating service in YunoHost..."
|
|
|
|
yunohost service add smbd --description="Samba service" --log="/var/log/smbd/smbd.log" --needs_exposed_ports $port
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Starting $app's systemd service..."
|
|
|
|
# Start a systemd service
|
|
ynh_systemctl --service=smbd --action="start"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Installation of $app completed"
|