mirror of
https://github.com/YunoHost-Apps/timemachine_ynh.git
synced 2024-09-03 20:26:33 +02:00
74 lines
2.5 KiB
Bash
Executable file
74 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source ynh_send_readme_to_admin__2
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
|
|
|
#=================================================
|
|
# STANDARD MODIFICATIONS
|
|
#=================================================
|
|
# OPEN PORT 445
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring firewall..." --weight=1
|
|
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP 445 # Allow SMB access
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|
|
|
samba_sysadmin_setup
|
|
ynh_add_config --template="../conf/smb.conf" --destination="/etc/smb/smb.d/$app.conf"
|
|
ynh_add_config --template="../conf/avahi-samba.service" --destination="/etc/avahi/services/$app.service"
|
|
|
|
# Create a samba user
|
|
(echo "$password"; echo "$password") | ynh_exec_warn_less smbpasswd -s -a "$app"
|
|
|
|
# Update samba configuration
|
|
samba_sysadmin_update
|
|
|
|
# Check and Add
|
|
samba_sysadmin_add
|
|
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
|
|
yunohost service add smbd --needs_exposed_ports 445
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|
|
|
ynh_exec_warn_less testparm -s
|
|
|
|
ynh_systemd_action --service_name=smbd --action="reload"
|
|
ynh_systemd_action --service_name=avahi-daemon --action="restart"
|
|
|
|
#=================================================
|
|
# SEND A README FOR THE ADMIN
|
|
#=================================================
|
|
ynh_script_progression --message="Sending a readme for the admin..."
|
|
|
|
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients="$admin_mail" --type='install'
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|