1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/squid3_ynh.git synced 2024-09-03 20:26:11 +02:00

Remove support for squid3

This commit is contained in:
Félix Piédallu 2024-02-01 11:54:07 +01:00 committed by Félix Piédallu
parent da7c60f602
commit c3262679ab
7 changed files with 22 additions and 50 deletions

View file

@ -21,7 +21,7 @@ acl purge method PURGE
acl CONNECT method CONNECT acl CONNECT method CONNECT
###Directive pour nautoriser que les comptes enregistrés dans le LDAP de Yunohost ###Directive pour nautoriser que les comptes enregistrés dans le LDAP de Yunohost
auth_param basic program /usr/lib/__SQUID_NAME__/basic_ldap_auth -b dc=yunohost,dc=org -h 127.0.0.1 -f "uid=%s" auth_param basic program /usr/lib/squid/basic_ldap_auth -b dc=yunohost,dc=org -h 127.0.0.1 -f "uid=%s"
auth_param basic children 50 auth_param basic children 50
auth_param basic realm Web-Proxy auth_param basic realm Web-Proxy
@ -44,9 +44,9 @@ dns_nameservers 127.0.0.1
##Port d'écoute du Proxy ##Port d'écoute du Proxy
http_port __PORT__ http_port __PORT__
forwarded_for off ### mode transparant, la vrai IP est cachée forwarded_for off ### mode transparant, la vrai IP est cachée
cache_dir aufs /var/spool/__SQUID_NAME__ 10000 16 256 cache_dir aufs /var/spool/squid 10000 16 256
hierarchy_stoplist cgi-bin ? hierarchy_stoplist cgi-bin ?
access_log /var/log/__SQUID_NAME__/access.log squid access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0

View file

@ -8,23 +8,6 @@
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
find_squid_version() {
# See if squid3 folder exits
if [ -d "/etc/squid3" ]; then
squid_name="squid3"
# If squid3 folder is not found look for squid folder
elif [ -d "/etc/squid" ]; then
squid_name="squid"
# If both folders are not found then call ynh_die
else
ynh_die --message="No squid folder found in /etc. Looks like squid3 package is not installed. Try installing it manually."
fi
ynh_app_setting_set --app="$app" --key="squid_name" --value="$squid_name"
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -14,9 +14,9 @@ source /usr/share/yunohost/helpers
# BACKUP VARIOUS FILES # BACKUP VARIOUS FILES
#================================================= #=================================================
ynh_backup --src_path="/etc/$squid_name/squid.conf" ynh_backup --src_path="/etc/squid/squid.conf"
ynh_backup --src_path="/var/log/$squid_name" ynh_backup --src_path="/var/log/squid"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -9,12 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
find_squid_version
#================================================= #=================================================
# APP INITIAL CONFIGURATION # APP INITIAL CONFIGURATION
#================================================= #=================================================
@ -22,14 +16,14 @@ find_squid_version
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="squid.conf" --destination="/etc/$squid_name/squid.conf" ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
yunohost service add "$squid_name" --description "Squid3 a web proxy service" --log="/var/log/$squid_name/access.log" --needs_exposed_ports "$port" yunohost service add "squid" --description "Squid3 a web proxy service" --log="/var/log/squid/access.log" --needs_exposed_ports "$port"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -37,7 +31,7 @@ yunohost service add "$squid_name" --description "Squid3 a web proxy service" --
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name="$squid_name" --action="restart" --log_path="/var/log/$squid_name/cache.log" ynh_systemd_action --service_name="squid" --action="restart" --log_path="/var/log/squid/cache.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -15,8 +15,8 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status "$squid_name" >/dev/null; then if ynh_exec_warn_less yunohost service status "squid" >/dev/null; then
yunohost service remove "$squid_name" yunohost service remove "squid"
fi fi
#================================================= #=================================================
@ -24,10 +24,10 @@ fi
#================================================= #=================================================
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/$squid_name/" ynh_secure_remove --file="/etc/squid/"
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$squid_name" ynh_secure_remove --file="/var/log/squid"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -15,17 +15,15 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." ynh_script_progression --message="Adding a configuration file..."
find_squid_version ynh_secure_remove --file="/etc/squid/squid.conf"
ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf"
ynh_secure_remove --file="/etc/$squid_name/squid.conf"
ynh_add_config --template="squid.conf" --destination="/etc/$squid_name/squid.conf"
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
yunohost service add "$squid_name" --description "Squid3 a web proxy service" --log="/var/log/$squid_name/access.log" --needs_exposed_ports "$port" yunohost service add "squid" --description "Squid3 a web proxy service" --log="/var/log/squid/access.log" --needs_exposed_ports "$port"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -33,7 +31,7 @@ yunohost service add "$squid_name" --description "Squid3 a web proxy service" --
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name="$squid_name" --action="restart" --log_path="/var/log/$squid_name/cache.log" ynh_systemd_action --service_name="squid" --action="restart" --log_path="/var/log/squid/cache.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -15,13 +15,10 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
if [[ -n "${squid:-}" ]]; then if [[ -n "${squid:-}" ]]; then
squid_name="$squid"
ynh_app_setting_set --app="$app" --key="squid_name" --value="$squid_name"
ynh_app_setting_delete --app="$app" --key="squid" ynh_app_setting_delete --app="$app" --key="squid"
fi fi
if [[ -n "${squid_name:-}" ]]; then
if [[ -z "${squid_name:-}" ]]; then ynh_app_setting_delete --app="$app" --key="squid_name"
find_squid_version
fi fi
#================================================= #=================================================
@ -31,7 +28,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name="$squid_name" --action="stop" --log_path="/var/log/$squid_name/cache.log" ynh_systemd_action --service_name="squid" --action="stop" --log_path="/var/log/squid/cache.log"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
@ -40,21 +37,21 @@ ynh_script_progression --message="Updating a configuration file..."
find_squid_version find_squid_version
ynh_add_config --template="squid.conf" --destination="/etc/$squid_name/squid.conf" ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
yunohost service add "$squid_name" --description "Squid3 a web proxy service" --log="/var/log/$squid_name/access.log" --needs_exposed_ports "$port" yunohost service add "squid" --description "Squid3 a web proxy service" --log="/var/log/squid/access.log" --needs_exposed_ports "$port"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name="$squid_name" --action="restart" --log_path="/var/log/$squid_name/cache.log" ynh_systemd_action --service_name="squid" --action="restart" --log_path="/var/log/squid/cache.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT