diff --git a/README.md b/README.md
index e92c4d0..ed24e66 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It r
Thanks to **Fred** to write the instruction to configure Squid for YunoHost. French:
-**Shipped version:** 4.13~ynh2
+**Shipped version:** 4.13~ynh3
## Documentation and resources
- Official app website:
diff --git a/README_eu.md b/README_eu.md
index e6683a5..b82c937 100644
--- a/README_eu.md
+++ b/README_eu.md
@@ -25,7 +25,7 @@ Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It r
Thanks to **Fred** to write the instruction to configure Squid for YunoHost. French:
-**Paketatutako bertsioa:** 4.13~ynh2
+**Paketatutako bertsioa:** 4.13~ynh3
## Dokumentazioa eta baliabideak
- Aplikazioaren webgune ofiziala:
diff --git a/README_fr.md b/README_fr.md
index 2994501..6320a9f 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -25,7 +25,7 @@ Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It r
Thanks to **Fred** to write the instruction to configure Squid for YunoHost. French:
-**Version incluse :** 4.13~ynh2
+**Version incluse :** 4.13~ynh3
## Documentations et ressources
- Site officiel de l’app :
diff --git a/README_gl.md b/README_gl.md
index e6b30f2..3939f99 100644
--- a/README_gl.md
+++ b/README_gl.md
@@ -25,7 +25,7 @@ Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It r
Thanks to **Fred** to write the instruction to configure Squid for YunoHost. French:
-**Versión proporcionada:** 4.13~ynh2
+**Versión proporcionada:** 4.13~ynh3
## Documentación e recursos
- Web oficial da app:
diff --git a/README_zh_Hans.md b/README_zh_Hans.md
index 97d1578..d771bd8 100644
--- a/README_zh_Hans.md
+++ b/README_zh_Hans.md
@@ -25,7 +25,7 @@ Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It r
Thanks to **Fred** to write the instruction to configure Squid for YunoHost. French:
-**分发版本:** 4.13~ynh2
+**分发版本:** 4.13~ynh3
## 文档与资源
- 官方应用网站:
diff --git a/conf/squid.conf b/conf/squid.conf
index 6c46586..f4be7d4 100644
--- a/conf/squid.conf
+++ b/conf/squid.conf
@@ -21,7 +21,7 @@ acl purge method PURGE
acl CONNECT method CONNECT
###Directive pour n’autoriser 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 realm Web-Proxy
@@ -44,9 +44,9 @@ dns_nameservers 127.0.0.1
##Port d'écoute du Proxy
http_port __PORT__
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 ?
-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 ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
diff --git a/manifest.toml b/manifest.toml
index 1a4377e..8672690 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -7,7 +7,7 @@ name = "squid3"
description.en = "Caching proxy for the Web supporting HTTP, HTTPS, FTP and more."
description.fr = "Proxy cache pour le web, compatible HTTP, HTTPS, FTP et plus encore."
-version = "4.13~ynh2"
+version = "4.13~ynh3"
maintainers = ["Anmol Sharma"]
@@ -40,4 +40,12 @@ ram.runtime = "50M"
main.exposed = "TCP"
[resources.apt]
- packages = ["squid3", "mailutils"]
+ packages = ["mailutils"]
+
+ packages_from_raw_bash = """
+ if [[ $YNH_DEBIAN_VERSION == "bullseye" ]]; then
+ echo "squid3";
+ elif [[ $YNH_DEBIAN_VERSION == "bookworm" ]]; then
+ echo "squid";
+ fi
+ """
diff --git a/scripts/_common.sh b/scripts/_common.sh
index dca1276..944a65e 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -8,23 +8,6 @@
# 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
#=================================================
diff --git a/scripts/backup b/scripts/backup
index 0ea571a..67eb21c 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -14,9 +14,9 @@ source /usr/share/yunohost/helpers
# 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
diff --git a/scripts/install b/scripts/install
index 6d1be0d..7fe5059 100755
--- a/scripts/install
+++ b/scripts/install
@@ -9,12 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# INITIALIZE AND STORE SETTINGS
-#=================================================
-
-find_squid_version
-
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
@@ -22,14 +16,14 @@ find_squid_version
#=================================================
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
#=================================================
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
@@ -37,7 +31,7 @@ yunohost service add "$squid_name" --description "Squid3 a web proxy service" --
ynh_script_progression --message="Starting 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
diff --git a/scripts/remove b/scripts/remove
index b39b21d..4e7078f 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -15,8 +15,8 @@ source /usr/share/yunohost/helpers
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`)
-if ynh_exec_warn_less yunohost service status "$squid_name" >/dev/null; then
- yunohost service remove "$squid_name"
+if ynh_exec_warn_less yunohost service status "squid" >/dev/null; then
+ yunohost service remove "squid"
fi
#=================================================
@@ -24,10 +24,10 @@ fi
#=================================================
# Remove a directory securely
-ynh_secure_remove --file="/etc/$squid_name/"
+ynh_secure_remove --file="/etc/squid/"
# Remove the log files
-ynh_secure_remove --file="/var/log/$squid_name"
+ynh_secure_remove --file="/var/log/squid"
#=================================================
# END OF SCRIPT
diff --git a/scripts/restore b/scripts/restore
index a84b9b3..a0907fa 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -15,17 +15,15 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Adding a configuration file..."
-find_squid_version
-
-ynh_secure_remove --file="/etc/$squid_name/squid.conf"
-ynh_add_config --template="squid.conf" --destination="/etc/$squid_name/squid.conf"
+ynh_secure_remove --file="/etc/squid/squid.conf"
+ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
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
@@ -33,7 +31,7 @@ yunohost service add "$squid_name" --description "Squid3 a web proxy service" --
ynh_script_progression --message="Starting 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
diff --git a/scripts/upgrade b/scripts/upgrade
index ddd91fa..4eb33ad 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -15,13 +15,10 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Ensuring downward compatibility..."
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"
fi
-
-if [[ -z "${squid_name:-}" ]]; then
- find_squid_version
+if [[ -n "${squid_name:-}" ]]; then
+ ynh_app_setting_delete --app="$app" --key="squid_name"
fi
#=================================================
@@ -31,30 +28,28 @@ fi
#=================================================
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
#=================================================
ynh_script_progression --message="Updating a configuration file..."
-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
#=================================================
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
#=================================================
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