mirror of
https://github.com/YunoHost-Apps/timemachine_ynh.git
synced 2024-09-03 20:26:33 +02:00
66 lines
2.1 KiB
Bash
Executable file
66 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
password=$(ynh_app_setting_get --app=$app --key=password)
|
|
|
|
#=================================================
|
|
# RESTORE THE DATA DIRECTORY
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
|
|
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
|
|
|
chown -R $app: "$data_dir"
|
|
|
|
#=================================================
|
|
# 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
|
|
|
|
#=================================================
|
|
# RESTORE VARIOUS FILES
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
|
|
|
# Create the samba user
|
|
(echo "$password"; echo "$password") | ynh_exec_warn_less smbpasswd -s -a "$app"
|
|
|
|
samba_sysadmin_setup
|
|
|
|
ynh_restore_file --origin_path="/etc/smb/smb.d/$app.conf"
|
|
|
|
ynh_restore_file --origin_path="/etc/avahi/services/$app.service"
|
|
|
|
samba_sysadmin_update
|
|
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..."
|
|
|
|
ynh_systemd_action --service_name=smbd --action="reload"
|
|
ynh_systemd_action --service_name=avahi-daemon --action="restart"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|