1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/squid3_ynh.git synced 2024-09-03 20:26:11 +02:00
squid3_ynh/scripts/restore
2018-09-14 08:50:02 +05:30

85 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get $app port)
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies squid3
#=================================================
# SPECIFIC RESTORE
#=================================================
# OPEN PORTS
#=================================================
yunohost firewall allow --no-upnp TCP $port
#=================================================
# RESTORE INOTIFY'S CONFIG
#=================================================
ynh_secure_remove "/etc/squid/squid.conf"
ynh_restore_file "/etc/squid/squid.conf"
ynh_system_reload --service_name=squid --action=restart
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add squid --log "/var/log/squid/access.log"
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
message="You can find a config file at /etc/squid/squid.conf
Squid 3 will work with your registered users. Just put the username and password when asked.
To configure on Firefox go to preferences->general->network proxy->manual proxy configuration.
Enter these value in the below feilds.
Http proxy: your any registered domain name or ip
port: $port
Tick mark use this proxy server for all protocols
No proxy for: localhost, 127.0.0.1
Save and restart borwser.
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/squid3_ynh/issues"
ynh_send_readme_to_admin --app_message="$message" --recipients="root"