diff --git a/check_process b/check_process index ad61262..71b65a9 100644 --- a/check_process +++ b/check_process @@ -5,7 +5,6 @@ ;; Test complet ; Manifest - password="pass" ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/conf/squid.conf b/conf/squid.conf index 99bdcdb..29c1b6f 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/basic_ldap_auth -b dc=yunohost,dc=org -h 127.0.0.1 -D cn=admin,dc=yunohost,dc=org -w __ADMIN_PASS__ -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 10000 16 256 +cache_dir aufs /var/spool/squid3 10000 16 256 hierarchy_stoplist cgi-bin ? -access_log /var/log/squid/access.log squid +access_log /var/log/squid3/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.json b/manifest.json index 9182bda..66c4691 100644 --- a/manifest.json +++ b/manifest.json @@ -18,18 +18,6 @@ "multi_instance": false, "services": [], "arguments": { - "install" : [ - { - "name": "password", - "type": "password", - "ask": { - "en": "Your Yunohost admin password (The password you use for the web-admin for Yunohost) " - }, - "help": { - "en": "The admin password is required to give all registered user access to Squid" - }, - "example": "Choose a password" - } - ] + "install" : [] } } diff --git a/scripts/_common.sh b/scripts/_common.sh index 5923725..3c894b7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,22 +12,47 @@ ynh_delete_file_checksum () { ynh_app_setting_delete $app $checksum_setting_name } -#================================================= - # Send an email to inform the administrator # # usage: ynh_send_readme_to_admin app_message [recipients] -# | arg: -m --app_message= - The message to send to the administrator. -# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root +# | arg: app_message - The message to send to the administrator. +# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root # example: "root admin@domain" # If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you # example: "root admin@domain user1 user2" ynh_send_readme_to_admin() { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [m]=app_message= [r]=recipients= ) - local app_message - local recipients - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - local app_message="${app_message:-...No specific information...}" -local recipients="${recipients:-root}" + local app_message="${1:-...No specific information...}" + local recipients="${2:-root}" + + # Retrieve the email of users + find_mails () { + local list_mails="$1" + local mail + local recipients=" " + # Read each mail in argument + for mail in $list_mails + do + # Keep root or a real email address as it is + if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" + then + recipients="$recipients $mail" + else + # But replace an user name without a domain after by its email + if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) + then + recipients="$recipients $mail" + fi + fi + done + echo "$recipients" + } + recipients=$(find_mails "$recipients") + + local mail_subject="☁️🆈🅽🅷☁️: Yunohost \`$app\` message" + + local mail_message="This is an automated message from your beloved YunoHost server. +Specific information for the application $app. +$app_message +--- +Automatic diagnosis data from YunoHost +$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" diff --git a/scripts/install b/scripts/install index 840fac4..4ed356d 100755 --- a/scripts/install +++ b/scripts/install @@ -24,28 +24,8 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -admin_pass_yuno=$YNH_APP_ARG_PASSWORD - - -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME - - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -74,7 +54,7 @@ ynh_app_setting_set $app port $port ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script -ynh_install_app_dependencies squid3 +ynh_install_app_dependencies squid3 mailutils #================================================= @@ -111,15 +91,15 @@ ynh_store_file_checksum "/etc/squid3/squid.conf" ### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script ### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script -yunohost service add squid3 --log "/var/log/squid/access.log" +yunohost service add squid3 --log "/var/log/squid3/access.log" #================================================= -# RESTART SQUID'S SERVICE +# RESTART SQUID'S SERVICE and SSOWATCONF #================================================= service squid3 restart - +yunohost app ssowatconf #================================================= # SEND A README FOR THE ADMIN diff --git a/scripts/remove b/scripts/remove index 6bfcaf3..b003512 100755 --- a/scripts/remove +++ b/scripts/remove @@ -32,6 +32,7 @@ fi # Remove metapackage and its dependencies apt-get -y purge squid3 +yunohost app ssowatconf #================================================= # CLOSE A PORT diff --git a/scripts/restore b/scripts/restore index 7e7db62..331b944 100755 --- a/scripts/restore +++ b/scripts/restore @@ -34,7 +34,7 @@ port=$(ynh_app_setting_get $app port) # REINSTALL DEPENDENCIES #================================================= -ynh_install_app_dependencies squid3 +ynh_install_app_dependencies squid3 mailutils #================================================= # SPECIFIC RESTORE @@ -50,11 +50,12 @@ yunohost firewall allow --no-upnp TCP $port ynh_secure_remove "/etc/squid3/squid.conf" ynh_restore_file "/etc/squid3/squid.conf" service squid3 restart +yunohost app ssowatconf #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add squid3 --log "/var/log/squid/access.log" +yunohost service add squid3 --log "/var/log/squid3/access.log" #=================================================