diff --git a/scripts/install b/scripts/install index 429b2c7..bd11c72 100755 --- a/scripts/install +++ b/scripts/install @@ -22,6 +22,8 @@ ynh_abort_if_errors app=$YNH_APP_INSTANCE_NAME +final_path="/etc/samba" + #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -36,6 +38,7 @@ ynh_app_setting_set --app=$app --key=directories --value=shared 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='' +ynh_app_setting_set --app=$app --key=final_path --value=$final_path #================================================= # FIND AND OPEN A PORT @@ -51,6 +54,12 @@ ynh_script_progression --message="Installing dependencies..." --time --weight=1 ynh_install_app_dependencies $pkg_dependencies +#================================================= +# SETUP SSOWAT +#================================================= + +ynh_permission_create --permission="share" --allowed=all_users + #================================================= # CREATE DATA DIRECTORY #================================================= @@ -64,18 +73,25 @@ mkdir -p $datadir/share chmod 750 "$datadir/share" chmod -R o-rwx "$datadir/share" chown -R root:root "$datadir/share" -setfacl -R -m g:all_users:rwx,d:g:all_users:rwx $datadir/share +setfacl -R -m g:samba.share:rwx,d:g:samba.share:rwx $datadir/share #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --time --weight=1 -mkdir -p /etc/samba/smb.conf.d -ynh_add_config --template="global-smb.conf" --destination="/etc/samba/smb.conf.d/0-global.conf" -ynh_add_config --template="shared-smb.conf" --destination="/etc/samba/smb.conf.d/share.conf" +mkdir -p $final_path/smb.conf.d +ynh_add_config --template="global-smb.conf" --destination="$final_path/smb.conf.d/0-global.conf" +ynh_add_config --template="share-smb.conf" --destination="$final_path/smb.conf.d/share.conf" -cat /etc/samba/smb.conf.d/*.conf > /etc/samba/smb.conf + cat > $final_path/smb.conf <> $final_path/smb.conf #================================================ # INTEGRATE SERVICE IN YUNOHOST @@ -91,11 +107,6 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight # Start a systemd service ynh_systemd_action --service_name=smbd --action="start" -#================================================= -# SETUP SSOWAT -#================================================= - -ynh_permission_create --permission="share" --allowed=all_users #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 96d9f9a..906cb51 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,9 +16,8 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE @@ -30,7 +29,7 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service integration..." --time --weight=1 - yunohost service remove $app + yunohost service remove smbd fi #================================================= @@ -50,6 +49,7 @@ if [ "${YNH_APP_PURGE:-0}" -eq 1 ] then ynh_script_progression --message="Removing app data directory..." --time --weight=1 ynh_secure_remove --file="$datadir" + ynh_secure_remove --file="$final_path" fi #=================================================