Просмотр исходного кода

Merge pull request #110 from YunoHost-Apps/testing

Testing
Alexandre Aubin 2 лет назад
Родитель
Сommit
a22616cfe6

+ 2 - 2
.github/workflows/updater.yml

@@ -14,7 +14,7 @@ jobs:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     steps:
     steps:
       - name: Fetch the source code
       - name: Fetch the source code
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
         with:
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           token: ${{ secrets.GITHUB_TOKEN }}
       - name: Run the updater script
       - name: Run the updater script
@@ -33,7 +33,7 @@ jobs:
       - name: Create Pull Request
       - name: Create Pull Request
         id: cpr
         id: cpr
         if: ${{ env.PROCEED == 'true' }}
         if: ${{ env.PROCEED == 'true' }}
-        uses: peter-evans/create-pull-request@v3
+        uses: peter-evans/create-pull-request@v4
         with:
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           token: ${{ secrets.GITHUB_TOKEN }}
           commit-message: Update to version ${{ env.VERSION }}
           commit-message: Update to version ${{ env.VERSION }}

+ 0 - 44
CHANGELOG.md

@@ -1,44 +0,0 @@
-Changelog
-=========
-
-## Unreleased
-- Nothing for now...
-
-## [3.3.1~ynh6](https://github.com/YunoHost-Apps/pihole_ynh/pull/51) - 2020-03-29
-
-#### Added
-* [Add a changelog](https://github.com/YunoHost-Apps/pihole_ynh/pull/51/commits/7299718e45d115a9b22b1eeb59b37028a731b616)
-
-#### Changed
-- [Update to last standard](https://github.com/YunoHost-Apps/pihole_ynh/pull/51/commits/9294176a2d243d68b3095d0037466814d8efdcd5)
-- [Update helpers](https://github.com/YunoHost-Apps/pihole_ynh/pull/51/commits/3be3dbca2fb0ec2887b7962aa5dcce4276ab31ce)
-- [Use toml for actions and config-panel](https://github.com/YunoHost-Apps/pihole_ynh/pull/51/commits/b1ec989d2a74f6cefaf97eb1ed59dd6b9fc82bcf)
-* [use scalable phpfpm](https://github.com/YunoHost-Apps/pihole_ynh/pull/51/commits/1bf6783e334cd1260f418d641d29e8e11c7e6edc)
-- [Update to last standard](https://github.com/YunoHost-Apps/pihole_ynh/pull/51/commits/a719095dc51c8c7af8a6f34f75c92a08f45e0012)
-
-
-## [3.3.1~ynh5](https://github.com/YunoHost-Apps/pihole_ynh/pull/39) - 2019-02-03
-
-#### Added
-- [Add progression bar](https://github.com/YunoHost-Apps/pihole_ynh/pull/39/commits/887e6fcc79bfd71fbd8a97b59f912ef029f90cdf)
-* [Changelog & html email](https://github.com/YunoHost-Apps/pihole_ynh/pull/39/commits/2229f7817327ceb2d2ca41310493a5483fb94ef9)
-
-#### Changed
-- [Update php and nginx conf files to php7](https://github.com/YunoHost-Apps/pihole_ynh/pull/39/commits/65d1ba63fcaffba347ab01d690d9ced08837a69b)
-
-
-## [3.3.1~ynh4](https://github.com/YunoHost-Apps/pihole_ynh/pull/36) - 2019-01-24
-
-#### Fixed
-- [Fix #37 for post_domain_add](https://github.com/YunoHost-Apps/pihole_ynh/pull/38/commits/d34d953efbc93e3d3e4547e3d8585a35c1eb8751)
-
-## [3.3.1~ynh4](https://github.com/YunoHost-Apps/pihole_ynh/pull/36) - 2019-01-21
-
-#### Added
-- [Advertise config-panel and actions](https://github.com/YunoHost-Apps/pihole_ynh/pull/36/commits/a4a720a9e8bae6a6d4e43a860c71c9e8947fafea)
-
-#### Fixed
-- [Fix install issue](https://github.com/YunoHost-Apps/pihole_ynh/pull/36/commits/3b7e0608c42402433888f9129e8c9dacbb9f4797)
-
-#### Changed
-- [Update to last standart](https://github.com/YunoHost-Apps/pihole_ynh/pull/36/commits/0478648b332e312d980becea48e8381b01133c7b)

+ 1 - 1
README.md

@@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
 
 
 The Pi-hole® is a DNS sinkhole that protects your devices from unwanted content without installing any client-side software.
 The Pi-hole® is a DNS sinkhole that protects your devices from unwanted content without installing any client-side software.
 
 
-**Shipped version:** 5.14.2~ynh2
+**Shipped version:** 5.14.2~ynh3
 
 
 ## Screenshots
 ## Screenshots
 
 

+ 1 - 1
README_fr.md

@@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
 Pi-hole® est un puits DNS qui protège vos appareils des contenus indésirables sans installer de logiciel côté client.
 Pi-hole® est un puits DNS qui protège vos appareils des contenus indésirables sans installer de logiciel côté client.
 
 
 
 
-**Version incluse :** 5.14.2~ynh2
+**Version incluse :** 5.14.2~ynh3
 
 
 ## Captures d’écran
 ## Captures d’écran
 
 

+ 0 - 45
actions.toml

@@ -1,45 +0,0 @@
-[reset_default_setupvars]
-name = "Reset the config file and restore a default one."
-command = "/bin/bash scripts/actions/reset_default_config \"setupVars.conf\""
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the config file setupVars.conf."
-
-[reset_default_ftl]
-name = "Reset the config file and restore a default one."
-command = "/bin/bash scripts/actions/reset_default_config \"pihole-FTL.conf\""
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the config file pihole-FTL.conf."
-
-[reset_default_nginx]
-name = "Reset the nginx config for this app."
-command = "/bin/bash scripts/actions/reset_default_system nginx"
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the nginx config for this app."
-
-[reset_default_phpfpm]
-name = "Reset the php-fpm config for this app."
-command = "/bin/bash scripts/actions/reset_default_system phpfpm"
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the php-fpm config for this app."
-
-
-[reset_default_app]
-name = "Reset the app with a default configuration."
-command = "/bin/bash scripts/actions/reset_default_app"
-# user = "root"  # optional
-# cwd = "/" # optional
-# accepted_return_codes = [0, 1, 2, 3]  # optional
-accepted_return_codes = [0]
-description = "Reset the app to its default configuration to try to fix potential issues.<br>This action won't remove any data added to the app.<br>However, if you have modified any configuration, it will be overwritten."

+ 1 - 3
check_process

@@ -23,14 +23,12 @@
         setup_private=1
         setup_private=1
         setup_public=0
         setup_public=0
         upgrade=1
         upgrade=1
-        # 5.4~ynh1
-        upgrade=1   from_commit=cfa9c5a3dbcfb765dcca3b2e7d179756afe26def
         # 5.11.4~ynh1
         # 5.11.4~ynh1
         upgrade=1   from_commit=3d2f68c4e19f335e63f8ffa259708b38a58c8f67
         upgrade=1   from_commit=3d2f68c4e19f335e63f8ffa259708b38a58c8f67
         upgrade=1   from_commit=4999654987af8b1427a6c72f8af482b235bb46db
         upgrade=1   from_commit=4999654987af8b1427a6c72f8af482b235bb46db
         backup_restore=1
         backup_restore=1
         multi_instance=0
         multi_instance=0
-        port_already_use=1
+        port_already_use=0
         change_url=1
         change_url=1
         actions=0
         actions=0
         config_panel=0
         config_panel=0

+ 0 - 0
conf/extra_php-fpm.conf


+ 0 - 70
config_panel.toml.example

@@ -1,70 +0,0 @@
-version = "1.0"
-name = "PiHole configuration panel"
-
-[main]
-name = "PiHole configuration"
-
-    [main.overwrite_files]
-    name = "Overwriting config files"
-
-        [main.overwrite_files.overwrite_setupvars]
-        ask = "Overwrite the config file setupVars.conf?"
-        type = "boolean"
-        default = true
-        help = "If the file is overwritten, a backup will be created."
-
-        [main.overwrite_files.overwrite_ftl]
-        ask = "Overwrite the config file pihole-FTL.conf?"
-        type = "boolean"
-        default = true
-        help = "If the file is overwritten, a backup will be created."
-
-        [main.overwrite_files.overwrite_nginx]
-        ask = "Overwrite the nginx config file?"
-        type = "boolean"
-        default = true
-        help = "If the file is overwritten, a backup will be created."
-
-        [main.overwrite_files.overwrite_phpfpm]
-        ask = "Overwrite the php-fpm config file?"
-        type = "boolean"
-        default = true
-        help = "If the file is overwritten, a backup will be created."
-
-
-    [main.global_config]
-    name = "Global configuration"
-
-        [main.global_config.email_type]
-        ask = "Send HTML email to admin?"
-        type = "boolean"
-        default = true
-        help = "Allow app scripts to send HTML mails instead of plain text."
-
-
-    [main.php_fpm_config]
-    name = "PHP-FPM configuration"
-
-        [main.php_fpm_config.footprint]
-        ask = "Memory footprint of the service?"
-        choices = ["low", "medium", "high", "specific"]
-        default = "low"
-        help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
-
-        [main.php_fpm_config.free_footprint]
-        ask = "Memory footprint of the service?"
-        type = "number"
-        default = "0"
-        help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
-
-        [main.php_fpm_config.usage]
-        ask = "Expected usage of the service?"
-        choices = ["low", "medium", "high"]
-        default = "low"
-        help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."
-
-        [main.php_fpm_config.force_max_children]
-        ask = "Force the value of pm.max_children?"
-        type = "number"
-        default = "0"
-        help = "Do not change this value unless you're sure about what you're doing !<br>pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint<br>You can force that value, and ignore the formula by changing the value here.<br>To reset to the default value, set to 0."

+ 2 - 2
manifest.json

@@ -6,7 +6,7 @@
         "en": "Network-wide ad blocking via your own DNS server",
         "en": "Network-wide ad blocking via your own DNS server",
         "fr": "Filtrage publicitaire via votre propre serveur DNS"
         "fr": "Filtrage publicitaire via votre propre serveur DNS"
     },
     },
-    "version": "5.14.2~ynh2",
+    "version": "5.14.2~ynh3",
     "url": "https://pi-hole.net/",
     "url": "https://pi-hole.net/",
     "upstream": {
     "upstream": {
         "license": "EUPL-1.2",
         "license": "EUPL-1.2",
@@ -26,7 +26,7 @@
         }
         }
     ],
     ],
     "requirements": {
     "requirements": {
-        "yunohost": ">= 11.0.9"
+        "yunohost": ">= 11.2.4"
     },
     },
     "multi_instance": false,
     "multi_instance": false,
     "services": [
     "services": [

+ 0 - 279
scripts/_common.sh

@@ -27,147 +27,6 @@ PI_HOLE_BIN_DIR="/usr/local/bin"
 # EXPERIMENTAL HELPERS
 # EXPERIMENTAL HELPERS
 #=================================================
 #=================================================
 
 
-# Send an email to inform the administrator
-#
-# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
-# | arg: -m --app_message= - The file with the content to send to the administrator.
-# | arg: -r, --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"
-# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
-ynh_send_readme_to_admin() {
-	# Declare an array to define the options of this helper.
-	declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
-	local app_message
-	local recipients
-	local type
-	# Manage arguments with getopts
-
-	ynh_handle_getopts_args "$@"
-	app_message="${app_message:-}"
-	recipients="${recipients:-root}"
-	type="${type:-install}"
-
-	# Get the value of admin_mail_html
-	admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
-	admin_mail_html="${admin_mail_html:-0}"
-
-	# 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")
-
-	# Subject base
-	local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
-
-	# Adapt the subject according to the type of mail required.
-	if [ "$type" = "backup" ]; then
-		mail_subject="$mail_subject has just been backup."
-	elif [ "$type" = "change_url" ]; then
-		mail_subject="$mail_subject has just been moved to a new URL!"
-	elif [ "$type" = "remove" ]; then
-		mail_subject="$mail_subject has just been removed!"
-	elif [ "$type" = "restore" ]; then
-		mail_subject="$mail_subject has just been restored!"
-	elif [ "$type" = "upgrade" ]; then
-		mail_subject="$mail_subject has just been upgraded!"
-	else	# install
-		mail_subject="$mail_subject has just been installed!"
-	fi
-
-	local mail_message="This is an automated message from your beloved YunoHost server.
-
-Specific information for the application $app.
-
-$(if [ -n "$app_message" ]
-then
-	cat "$app_message"
-else
-	echo "...No specific information..."
-fi)
-
----
-Automatic diagnosis data from YunoHost
-
-__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
-
-	# Store the message into a file for further modifications.
-	echo "$mail_message" > mail_to_send
-
-	# If a html email is required. Apply html tags to the message.
- 	if [ "$admin_mail_html" -eq 1 ]
- 	then
-		# Insert 'br' tags at each ending of lines.
-		ynh_replace_string "$" "<br>" mail_to_send
-
-		# Insert starting HTML tags
-		sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
-
-		# Keep tabulations
-		ynh_replace_string "  " "\&#160;\&#160;" mail_to_send
-		ynh_replace_string "\t" "\&#160;\&#160;" mail_to_send
-
-		# Insert url links tags
-		ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
-
-		# Insert pre tags
-		ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
-		ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
-
-		# Insert finishing HTML tags
-		echo -e "\n</body>\n</html>" >> mail_to_send
-
-	# Otherwise, remove tags to keep a plain text.
-	else
-		# Remove URL tags
-		ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
-		ynh_replace_string "__URL_TAG2__" ": " mail_to_send
-
-		# Remove PRE tags
-		ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
-	fi
-
-	# Define binary to use for mail command
-	if [ -e /usr/bin/bsd-mailx ]
-	then
-		local mail_bin=/usr/bin/bsd-mailx
-	else
-		local mail_bin=/usr/bin/mail.mailutils
-	fi
-
-	if [ "$admin_mail_html" -eq 1 ]
-	then
-		content_type="text/html"
-	else
-		content_type="text/plain"
-	fi
-
-	# Send the email to the recipients
-	cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
-}
-
-#=================================================
-
 ynh_maintenance_mode_ON () {
 ynh_maintenance_mode_ON () {
 	# Load value of $path_url and $domain from the config if their not set
 	# Load value of $path_url and $domain from the config if their not set
 	if [ -z $path_url ]; then
 	if [ -z $path_url ]; then
@@ -247,144 +106,6 @@ ynh_maintenance_mode_OFF () {
 	systemctl reload nginx
 	systemctl reload nginx
 }
 }
 
 
-#=================================================
-
-# Create a changelog for an app after an upgrade from the file CHANGELOG.md.
-#
-# usage: ynh_app_changelog [--format=markdown/html/plain] [--output=changelog_file] --changelog=changelog_source]
-# | arg: -f --format= - Format in which the changelog will be printed
-#	   markdown: Default format.
-#	   html:	 Turn urls into html format.
-#	   plain:	Plain text changelog
-# | arg: -o --output= - Output file for the changelog file (Default ./changelog)
-# | arg: -c --changelog= - CHANGELOG.md source (Default ../CHANGELOG.md)
-#
-# The changelog is printed into the file ./changelog and ./changelog_lite
-ynh_app_changelog () {
-	# Declare an array to define the options of this helper.
-	local legacy_args=foc
-	declare -Ar args_array=( [f]=format= [o]=output= [c]=changelog= )
-	local format
-	local output
-	local changelog
-	# Manage arguments with getopts
-	ynh_handle_getopts_args "$@"
-	format=${format:-markdown}
-	output=${output:-changelog}
-	changelog=${changelog:-../CHANGELOG.md}
-
-	local original_changelog="$changelog"
-	local temp_changelog="changelog_temp"
-	local final_changelog="$output"
-
-	if [ ! -n "$original_changelog" ]
-	then
-		echo "No changelog available..." > "$final_changelog"
-		echo "No changelog available..." > "${final_changelog}_lite"
-		return 0
-	fi
-
-	local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
-	local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version")
-
-	# Get the line of the version to update to into the changelog
-	local update_version_line=$(grep --max-count=1 --line-number "^## \[$update_version" "$original_changelog" | cut -d':' -f1)
-	# If there's no entry for this version yet into the changelog
-	# Get the first available version
-	if [ -z "$update_version_line" ]
-	then
-		update_version_line=$(grep --max-count=1 --line-number "^##" "$original_changelog" | cut -d':' -f1)
-	fi
-
-	# Get the length of the complete changelog.
-	local changelog_length=$(wc --lines "$original_changelog" | awk '{print $1}')
-	# Cut the file before the version to update to.
-	tail --lines=$(( $changelog_length - $update_version_line + 1 )) "$original_changelog" > "$temp_changelog"
-
-	# Get the length of the troncated changelog.
-	changelog_length=$(wc --lines "$temp_changelog" | awk '{print $1}')
-	# Get the line of the current version into the changelog
-	# Keep only the last line found
-	local current_version_line=$(grep --line-number "^## \[$current_version" "$temp_changelog" | cut -d':' -f1 | tail --lines=1)
-	# If there's no entry for this version into the changelog
-	# Get the last available version
-	if [ -z "$current_version_line" ]
-	then
-		current_version_line=$(grep --line-number "^##" "$original_changelog" | cut -d':' -f1 | tail --lines=1)
-	fi
-	# Cut the file before the current version.
-	# Then grep the previous version into the changelog to get the line number of the previous version
-	local previous_version_line=$(tail --lines=$(( $changelog_length - $current_version_line )) \
-		"$temp_changelog" | grep --max-count=1 --line-number "^## " | cut -d':' -f1)
-	# If there's no previous version into the changelog
-	# Go until the end of the changelog
-	if [ -z "$previous_version_line" ]
-	then
-		previous_version_line=$changelog_length
-	fi
-
-	# Cut the file after the previous version to keep only the changelog between the current version and the version to update to.
-	head --lines=$(( $current_version_line + $previous_version_line - 1 )) "$temp_changelog" | tee "$final_changelog"
-
-	if [ "$format" = "html" ]
-	then
-		# Replace markdown links by html links
-		ynh_replace_string --match_string="\[\(.*\)\](\(.*\)))" --replace_string="<a href=\"\2\">\1</a>)" --target_file="$final_changelog"
-		ynh_replace_string --match_string="\[\(.*\)\](\(.*\))" --replace_string="<a href=\"\2\">\1</a>" --target_file="$final_changelog"
-	elif [ "$format" = "plain" ]
-	then
-		# Change title format.
-		ynh_replace_string --match_string="^##.*\[\(.*\)\](\(.*\)) - \(.*\)$" --replace_string="## \1 (\3) - \2" --target_file="$final_changelog"
-		# Change modifications lines format.
-		ynh_replace_string --match_string="^\([-*]\).*\[\(.*\)\]\(.*\)" --replace_string="\1 \2 \3" --target_file="$final_changelog"
-	fi
-	# else markdown. As the file is already in markdown, nothing to do.
-
-	# Keep only important changes into the changelog
-	# Remove all minor changes
-	sed '/^-/d' "$final_changelog" > "${final_changelog}_lite"
-	# Remove all blank lines (to keep a clear workspace)
-	sed --in-place '/^$/d' "${final_changelog}_lite"
-	# Add a blank line at the end
-	echo "" >> "${final_changelog}_lite"
-
-	# Clean titles if there's no significative changes
-	local line
-	local previous_line=""
-	while read line <&3
-	do
-		if [ -n "$previous_line" ]
-		then
-			# Remove the line if it's a title or a blank line, and the previous one was a title as well.
-			if ( [ "${line:0:1}" = "#" ] || [ ${#line} -eq 0 ] ) && [ "${previous_line:0:1}" = "#" ]
-			then
-				ynh_replace_special_string --match_string="${previous_line//[/.}" --replace_string="" --target_file="${final_changelog}_lite"
-			fi
-		fi
-		previous_line="$line"
-	done 3< "${final_changelog}_lite"
-
-	# Remove all blank lines again
-	sed --in-place '/^$/d' "${final_changelog}_lite"
-
-	# Restore changelog format with blank lines
-	ynh_replace_string --match_string="^##.*" --replace_string="\n\n&\n" --target_file="${final_changelog}_lite"
-	# Remove the 2 first blank lines
-	sed --in-place '1,2d' "${final_changelog}_lite"
-	# Add a blank line at the end
-	echo "" >> "${final_changelog}_lite"
-
-	# If changelog are empty, add an info
-	if [ $(wc --words "$final_changelog" | awk '{print $1}') -eq 0 ]
-	then
-		echo "No changes from the changelog..." > "$final_changelog"
-	fi
-	if [ $(wc --words "${final_changelog}_lite" | awk '{print $1}') -eq 0 ]
-	then
-		echo "No significative changes from the changelog..." > "${final_changelog}_lite"
-	fi
-}
-
 #=================================================
 #=================================================
 # FUTURE OFFICIAL HELPERS
 # FUTURE OFFICIAL HELPERS
 #=================================================
 #=================================================

+ 0 - 224
scripts/actions/reset_default_app

@@ -1,224 +0,0 @@
-#!/bin/bash
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-# Load common variables for all scripts.
-source scripts/_common.sh
-source /usr/share/yunohost/helpers
-
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
-# Clean installation remaining that are not handle by the remove script.
-	ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-app=$YNH_APP_INSTANCE_NAME
-
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
-#=================================================
-# SPECIFIC ACTION
-#=================================================
-# ACTIVATE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Activating maintenance mode..." --weight=1
-
-ynh_maintenance_mode_ON
-
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
-
-# Create a dedicated user (if not existing)
-ynh_system_user_create --username=$app
-
-#=================================================
-# DOWNLOAD, CHECK AND UNPACK SOURCE
-#=================================================
-ynh_script_progression --message="Resetting source files..." --weight=1
-
-# Download, check integrity, uncompress and patch the source from app.src
-(
-	cd scripts
-	# Overwrite the last version available
-	YNH_CWD=$PWD ynh_setup_source --dest_dir="$PI_HOLE_LOCAL_REPO" --source_id="pi-hole_Core"
-	# Overwrite admin dashboard
-	YNH_CWD=$PWD ynh_setup_source --dest_dir="$final_path" --source_id=pi-hole_AdminLTE
-
-	chown $app:www-data "$final_path"
-
-)
-
-#=================================================
-# NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Resetting NGINX web server configuration..." --weight=1
-
-# Create a dedicated nginx config
-yunohost app action run $app reset_default_nginx
-
-#=================================================
-# PHP-FPM CONFIGURATION
-#=================================================
-ynh_script_progression --message="Resetting PHP-FPM configuration..." --weight=1
-
-# Create a dedicated php-fpm config
-yunohost app action run $app reset_default_phpfpm
-
-#=================================================
-# RECREATE DIRECTORIES
-#=================================================
-ynh_script_progression --message="Recreating and populating directories..." --weight=1
-
-mkdir -p "$PI_HOLE_CONFIG_DIR"
-chown $app: -R "$PI_HOLE_CONFIG_DIR"
-
-mkdir -p "$PI_HOLE_INSTALL_DIR"
-
-# Make a copy of Pi-Hole scripts
-cp -a "$PI_HOLE_LOCAL_REPO/gravity.sh" "$PI_HOLE_INSTALL_DIR/"
-cp -a $PI_HOLE_LOCAL_REPO/advanced/Scripts/*.sh "$PI_HOLE_INSTALL_DIR/"
-
-# And copy this fucking COL_TABLE file...
-cp -a "$PI_HOLE_LOCAL_REPO/advanced/Scripts/COL_TABLE" "$PI_HOLE_INSTALL_DIR/"
-
-#=================================================
-# COPY PI-HOLE MAIN SCRIPT
-#=================================================
-ynh_script_progression --message="Copying Pi-Hole main script..."
-
-cp -a "$PI_HOLE_LOCAL_REPO/pihole" $PI_HOLE_BIN_DIR/
-cp -a "$PI_HOLE_LOCAL_REPO/advanced/bash-completion/pihole" /etc/bash_completion.d/pihole
-
-#=================================================
-# RECREATE LOG FILES
-#=================================================
-
-touch /var/log/{pihole,pihole-FTL}.log
-chmod 644 /var/log/{pihole,pihole-FTL}.log
-dnsmasq_user=$(grep DNSMASQ_USER= /etc/init.d/dnsmasq | cut -d'"' -f2)
-chown $dnsmasq_user:root /var/log/{pihole,pihole-FTL}.log
-
-#=================================================
-# RECREATE SUDOER FILE
-#=================================================
-
-# This sudoers config allow pihole to execute $PI_HOLE_BIN_DIR/pihole as root without password. Nothing more.
-cp "$PI_HOLE_LOCAL_REPO/advanced/Templates/pihole.sudo" /etc/sudoers.d/pihole
-echo "$app ALL=NOPASSWD: $PI_HOLE_BIN_DIR/pihole" >> /etc/sudoers.d/pihole
-# echo "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:$PI_HOLE_BIN_DIR" >> /etc/sudoers.d/pihole
-chmod 0440 /etc/sudoers.d/pihole
-
-#=================================================
-# REINSTALL LOGROTATE SCRIPT FOR PI-HOLE
-#=================================================
-
-cp "$PI_HOLE_LOCAL_REPO/advanced/Templates/logrotate" "$PI_HOLE_CONFIG_DIR/logrotate"
-sed -i "/# su #/d;" "$PI_HOLE_CONFIG_DIR/logrotate"
-
-#=================================================
-# REINSTALLATION OF PIHOLE-FTL
-#=================================================
-ynh_script_progression --message="Reinstalling PiHole-FTL..." --weight=30
-
-# Get the source of Pi-Hole-FTL
-FTL_temp_path=$(mktemp -d)
-# Install the last version available
-ynh_setup_source --dest_dir="$FTL_temp_path" --source_id="pi-hole_FTL"
-
-# Instead of downloading a binary file, we're going to compile it
-( 
-	cd "$FTL_temp_path"
-	ynh_exec_warn_less make
-	ynh_exec_warn_less make install
-)
-ynh_secure_remove --file="$FTL_temp_path"
-
-cp "../conf/dns-servers.conf" "$PI_HOLE_CONFIG_DIR"
-
-# Restore the default pihole-FTL.conf
-yunohost app action run $app reset_default_ftl
-
-cp -a $PI_HOLE_LOCAL_REPO/advanced/Templates/pihole-FTL.service /etc/init.d/pihole-FTL
-chmod +x /etc/init.d/pihole-FTL
-ynh_exec_warn_less systemctl enable pihole-FTL
-
-# Reload systemd config
-systemctl daemon-reload
-
-#=================================================
-# RESET THE VARIABLES FILE
-#=================================================
-
-# Restore the default setupVars.conf
-yunohost app action run $app reset_default_setupvars
-
-#=================================================
-# RESET DNSMASQ CONFIG
-#=================================================
-
-# Restore the default setupVars.conf
-yunohost app action run $app reset_default_dnsmasq
-
-#=================================================
-# REINSTALL CRON JOB
-#=================================================
-
-cp $PI_HOLE_LOCAL_REPO/advanced/Templates/pihole.cron /etc/cron.d/pihole
-
-# Remove git usage for version. Which fails because we use here a release instead of master.
-ynh_replace_string --match_string=".*updatechecker.*" --replace_string="#&" --target_file=/etc/cron.d/pihole
-
-#=================================================
-# REINSTALL CONF_REGEN HOOK
-#=================================================
-
-(
-	cd scripts
-	cp ../conf/dnsmasq_regenconf_hook /usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app
-	ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/usr/share/yunohost/hooks/conf_regen/50-dnsmasq_$app"
-)
-
-#=================================================
-# RESTART PIHOLE-FTL
-#=================================================
-
-ynh_script_progression --message="Restarting PiHole-FTL..." --weight=2
-
-ynh_systemd_action --service_name=pihole-FTL --action=restart --log_path="/var/log/pihole-FTL.log"
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
-#=================================================
-# DEACTIVE MAINTENANCE MODE
-#=================================================
-ynh_script_progression --message="Disabling maintenance mode..." --weight=1
-
-ynh_maintenance_mode_OFF
-
-#=================================================
-# END OF SCRIPT
-#=================================================
-
-ynh_script_progression --message="Execution completed" --last

+ 0 - 87
scripts/actions/reset_default_config

@@ -1,87 +0,0 @@
-#!/bin/bash
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source scripts/_common.sh
-source /usr/share/yunohost/helpers
-
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-app=$YNH_APP_INSTANCE_NAME
-
-query_logging=$(ynh_app_setting_get --app=$app --key=query_logging)
-
-#=================================================
-# SORT OUT THE CONFIG FILE TO HANDLE
-#=================================================
-
-file="$1"
-
-if [ "$file" = "setupVars.conf" ]; then
-	config_file="$PI_HOLE_CONFIG_DIR/setupVars.conf"
-elif [ "$file" = "pihole-FTL.conf" ]; then
-	config_file="$PI_HOLE_CONFIG_DIR/pihole-FTL.conf"
-fi
-
-#=================================================
-# SPECIFIC ACTION
-#=================================================
-# RESET THE CONFIG FILE
-#=================================================
-ynh_script_progression --message="Resetting the config file $config_file..." --weight=9
-
-# Verify the checksum and backup the file if it's different
-ynh_backup_if_checksum_is_different --file="$config_file"
-
-main_iface=$(ip route | grep --max-count=1 default | awk '{print $5;}')
-
-if [ "$file" = "setupVars.conf" ]
-then
-	# Recreate the default config
-	# Trouve l'interface réseau par défaut
-	echo "PIHOLE_INTERFACE=$main_iface" > "$config_file"
-	echo "IPV4_ADDRESS=127.0.0.1" >> "$config_file"
-	echo "IPV6_ADDRESS=::1" >> "$config_file"
-	echo "PIHOLE_DNS_1=" >> "$config_file"
-	echo "PIHOLE_DNS_2=" >> "$config_file"
-	if [ $query_logging -eq 1 ]; then
-		query_logging=true
-	else
-		query_logging=false
-	fi
-	echo "QUERY_LOGGING=$query_logging" >> "$config_file"
-	echo "INSTALL_WEB=true" >> "$config_file"
-
-elif [ "$file" = "pihole-FTL.conf" ]
-then
-	# Get the default file and overwrite the current config
-	port=$(ynh_app_setting_get --app=$app --key=port)
-	ynh_add_config --template="/etc/yunohost/apps/$app/conf/pihole-FTL.conf" --destination="$config_file"
-
-	ynh_script_progression --message="Restarting Pi-Hole..." --weight=2
-
-	# Restart pihole-FTL
-	ynh_systemd_action --service_name=pihole-FTL --action=restart --log_path="/var/log/pihole-FTL.log"
-fi
-
-# Calculate and store the config file checksum into the app settings
-ynh_store_file_checksum --file="$config_file"
-
-#=================================================
-# END OF SCRIPT
-#=================================================
-
-ynh_script_progression --message="Execution completed" --last

+ 0 - 64
scripts/actions/reset_default_system

@@ -1,64 +0,0 @@
-#!/bin/bash
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source scripts/_common.sh
-source /usr/share/yunohost/helpers
-
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
-# Clean installation remaining that are not handle by the remove script.
-	ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-app=$YNH_APP_INSTANCE_NAME
-
-type=$1
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
-#=================================================
-# SPECIFIC ACTION
-#=================================================
-# RESET THE CONFIG FILE
-#=================================================
-
-if [ $type == nginx ]; then
-	name=Nginx
-elif [ $type == phpfpm ]; then
-	name=PHP-FPM
-else
-	ynh_die --message="The type $type is not recognized"
-fi
-
-ynh_script_progression --message="Resetting the specific configuration of $name for the app $app..." --weight=3
-
-if [ $type == nginx ]
-then
-	(cd scripts; ynh_add_nginx_config)
-
-elif [ $type == phpfpm ]
-then
-	(cd scripts; ynh_add_fpm_config --usage=low --footprint=low --dedicated_service)
-fi
-
-#=================================================
-# END OF SCRIPT
-#=================================================
-
-ynh_script_progression --message="Execution completed" --last

+ 0 - 1
scripts/backup

@@ -53,7 +53,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
 # BACKUP THE PHP-FPM CONFIGURATION
 # BACKUP THE PHP-FPM CONFIGURATION
 #=================================================
 #=================================================
 
 
-ynh_backup --src_path="$fpm_config_dir/php-fpm-$app.conf"
 ynh_backup --src_path="$fpm_config_dir/pool.d/$app.conf"
 ynh_backup --src_path="$fpm_config_dir/pool.d/$app.conf"
 
 
 #=================================================
 #=================================================

+ 0 - 174
scripts/config

@@ -1,174 +0,0 @@
-#!/bin/bash
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source _common.sh
-source /usr/share/yunohost/helpers
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-app=$YNH_APP_INSTANCE_NAME
-
-fpm_config_dir=$(ynh_app_setting_get --app=$app --key=fpm_config_dir)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
-#=================================================
-# SPECIFIC CODE
-#=================================================
-# LOAD VALUES
-#=================================================
-
-# Load the real value from the app config or elsewhere.
-# Then get the value from the form.
-# If the form has a value for a variable, take the value from the form,
-# Otherwise, keep the value from the app config.
-
-# Overwrite setupVars.conf file
-old_overwrite_setupvars="$(ynh_app_setting_get --app=$app --key=overwrite_setupvars)"
-overwrite_setupvars="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETUPVARS:-$old_overwrite_setupvars}"
-
-# Overwrite pihole-FTL.conf file
-old_overwrite_ftl="$(ynh_app_setting_get --app=$app --key=overwrite_ftl)"
-overwrite_ftl="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_FTL:-$old_overwrite_ftl}"
-
-# Overwrite nginx configuration
-old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
-overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
-
-# Overwrite php-fpm configuration
-old_overwrite_phpfpm="$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)"
-overwrite_phpfpm="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_PHPFPM:-$old_overwrite_phpfpm}"
-
-
-# Type of admin mail configuration
-old_admin_mail_html="$(ynh_app_setting_get --app=$app --key=admin_mail_html)"
-admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
-
-
-# Footprint for php-fpm
-old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)"
-fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}"
-
-# Free footprint value for php-fpm
-# Check if fpm_footprint is an integer
-if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null
-then
-	# If fpm_footprint is an integer, that's a numeric value for the footprint
-	old_free_footprint=$fpm_footprint
-	fpm_footprint=specific
-else
-	old_free_footprint=0
-fi
-free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}"
-
-# Usage for php-fpm
-old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)"
-fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}"
-
-# php_forced_max_children for php-fpm
-old_php_forced_max_children="$(ynh_app_setting_get --app=$app --key=php_forced_max_children)"
-# If php_forced_max_children isn't into settings.yml, get the current value from the fpm config
-if [ -z "$old_php_forced_max_children" ]; then
-	old_php_forced_max_children="$(grep "^pm.max_children" "$fpm_config_dir/pool.d/$app.conf" | awk '{print $3}')"
-fi
-php_forced_max_children="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FORCE_MAX_CHILDREN:-$old_php_forced_max_children}"
-
-#=================================================
-# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
-#=================================================
-
-show_config() {
-	# here you are supposed to read some config file/database/other then print the values
-	# ynh_return "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
-
-	ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETUPVARS=$overwrite_setupvars"
-	ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_FTL=$overwrite_ftl"
-	ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx"
-	ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_PHPFPM=$overwrite_phpfpm"
-
-	ynh_return "YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE=$admin_mail_html"
-
-	ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT=$fpm_footprint"
-	ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT=$free_footprint"
-	ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE=$fpm_usage"
-	ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FORCE_MAX_CHILDREN=$php_forced_max_children"
-}
-
-#=================================================
-# MODIFY THE CONFIGURATION
-#=================================================
-
-apply_config() {
-
-	#=================================================
-	# MODIFY OVERWRITTING SETTINGS
-	#=================================================
-
-	# Set overwrite_setupvars
-	ynh_app_setting_set --app=$app --key=overwrite_setupvars --value="$overwrite_setupvars"
-	# Set overwrite_ftl
-	ynh_app_setting_set --app=$app --key=overwrite_ftl --value="$overwrite_ftl"
-	# Set overwrite_nginx
-	ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
-	# Set overwrite_phpfpm
-	ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value="$overwrite_phpfpm"
-
-	#=================================================
-	# MODIFY EMAIL SETTING
-	#=================================================
-
-	# Set admin_mail_html
-	ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
-
-	#=================================================
-	# RECONFIGURE PHP-FPM
-	#=================================================
-
-	if [ "$fpm_usage" != "$old_fpm_usage" ] || \
-		[ "$fpm_footprint" != "$old_fpm_footprint" ] || \
-		[ "$free_footprint" != "$old_free_footprint" ] || \
-		[ "$php_forced_max_children" != "$old_php_forced_max_children" ]
-	then
-		# If fpm_footprint is set to 'specific', use $free_footprint value.
-		if [ "$fpm_footprint" = "specific" ]
-		then
-			fpm_footprint=$free_footprint
-		fi
-
-		if [ "$php_forced_max_children" != "$old_php_forced_max_children" ]
-		then
-			# Set php_forced_max_children
-			if [ $php_forced_max_children -ne 0 ]
-			then
-				ynh_app_setting_set --app=$app --key=php_forced_max_children --value="$php_forced_max_children"
-			else
-				# If the value is set to 0, remove the setting
-				ynh_app_setting_delete --app=$app --key=php_forced_max_children
-			fi
-		fi
-
-		if [ "$fpm_footprint" != "0" ]
-		then
-			ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --dedicated_service
-		else
-			ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
-		fi
-	fi
-}
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
-#=================================================
-
-case $1 in
-	show) show_config;;
-	apply) apply_config;;
-esac

+ 2 - 28
scripts/install

@@ -55,9 +55,6 @@ ynh_app_setting_set --app=$app --key=enable_dhcp --value=$enable_dhcp
 
 
 ynh_app_setting_set --app=$app --key=overwrite_setupvars --value=1
 ynh_app_setting_set --app=$app --key=overwrite_setupvars --value=1
 ynh_app_setting_set --app=$app --key=overwrite_ftl --value=1
 ynh_app_setting_set --app=$app --key=overwrite_ftl --value=1
-ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
-ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value=1
-ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
 
 
 #=================================================
 #=================================================
 # STANDARD MODIFICATIONS
 # STANDARD MODIFICATIONS
@@ -118,7 +115,7 @@ chown -R $app:www-data "$final_path"
 ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
 ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
 
 
 # Create a dedicated PHP-FPM config
 # Create a dedicated PHP-FPM config
-ynh_add_fpm_config --usage=low --footprint=low --dedicated_service
+ynh_add_fpm_config
 
 
 #=================================================
 #=================================================
 # NGINX CONFIGURATION
 # NGINX CONFIGURATION
@@ -239,6 +236,7 @@ else
 fi
 fi
 echo "QUERY_LOGGING=$query_logging" >> $setupVars
 echo "QUERY_LOGGING=$query_logging" >> $setupVars
 echo "INSTALL_WEB=true" >> $setupVars
 echo "INSTALL_WEB=true" >> $setupVars
+echo "BLOCKING_ENABLED=true" >> $setupVars
 
 
 # Calculate and store the config file checksum into the app settings
 # Calculate and store the config file checksum into the app settings
 ynh_store_file_checksum --file="$setupVars"
 ynh_store_file_checksum --file="$setupVars"
@@ -344,30 +342,6 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=3
 
 
 ynh_systemd_action --service_name=nginx --action=reload
 ynh_systemd_action --service_name=nginx --action=reload
 
 
-#=================================================
-# SEND A README FOR THE ADMIN
-#=================================================
-
-# Get main domain and buid the url of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-if [ $enable_dhcp -eq 1 ]
-then
-	dhcp_alert="You asked to use the internal DHCP server of dnsmasq with Pi-hole.
-You should really read the __URL_TAG1__documentation about that__URL_TAG2__https://github.com/YunoHost-Apps/pihole_ynh/blob/master/dhcp.md__URL_TAG3__
-
-"
-else
-	dhcp_alert=""
-fi
-
-echo "${dhcp_alert}You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/pihole_ynh__URL_TAG3__." > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=install
-
 #=================================================
 #=================================================
 # END OF SCRIPT
 # END OF SCRIPT
 #=================================================
 #=================================================

+ 2 - 36
scripts/remove

@@ -33,12 +33,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
 enable_dhcp=$(ynh_app_setting_get --app=$app --key=enable_dhcp)
 enable_dhcp=$(ynh_app_setting_get --app=$app --key=enable_dhcp)
 admin=$(ynh_app_setting_get --app=$app --key=admin)
 admin=$(ynh_app_setting_get --app=$app --key=admin)
 
 
-# Get variables from ynh_add_fpm_config
-fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
-fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
-fpm_config_dir=$(ynh_app_setting_get --app=$app --key=fpm_config_dir)
-fpm_service=$(ynh_app_setting_get --app=$app --key=fpm_service)
-
 #=================================================
 #=================================================
 # CHECK IF THE APP CAN BE RESTORED
 # CHECK IF THE APP CAN BE RESTORED
 #=================================================
 #=================================================
@@ -111,11 +105,7 @@ ynh_install_app_dependencies $pkg_dependencies
 ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=7
 ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=7
 
 
 # Restore the file first, so it can have a backup if different
 # Restore the file first, so it can have a backup if different
-ynh_restore_file --origin_path="$fpm_config_dir/php-fpm-$app.conf"
-ynh_restore_file --origin_path="$fpm_config_dir/pool.d/$app.conf"
-
-# Recreate a dedicated php-fpm config
-ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --dedicated_service
+ynh_add_fpm_config
 
 
 #=================================================
 #=================================================
 # RESTORE THE NGINX CONFIGURATION
 # RESTORE THE NGINX CONFIGURATION
@@ -260,7 +250,7 @@ ynh_systemd_action --service_name=pihole-FTL --action=restart --log_path="/var/l
 #=================================================
 #=================================================
 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
 
 
-ynh_systemd_action --service_name=$fpm_service --action=reload
+ynh_systemd_action --service_name=php$YNH_PHP_VERSION-fpm --action=reload
 ynh_systemd_action --service_name=nginx --action=reload
 ynh_systemd_action --service_name=nginx --action=reload
 
 
 #=================================================
 #=================================================
@@ -270,30 +260,6 @@ ynh_script_progression --message="Disabling maintenance mode..." --weight=4
 
 
 ynh_maintenance_mode_OFF
 ynh_maintenance_mode_OFF
 
 
-#=================================================
-# SEND A README FOR THE ADMIN
-#=================================================
-
-# Get main domain and buid the URL of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-if [ $enable_dhcp -eq 1 ]
-then
-	dhcp_alert="You asked to use the internal DHCP server of Dnsmasq with Pi-hole.
-You should really read the __URL_TAG1__documentation about that__URL_TAG2__https://github.com/YunoHost-Apps/pihole_ynh/blob/master/dhcp.md__URL_TAG3__
-
-"
-else
-	dhcp_alert=""
-fi
-
-echo "${dhcp_alert}You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/pihole_ynh__URL_TAG3__." > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=restore
-
 #=================================================
 #=================================================
 # END OF SCRIPT
 # END OF SCRIPT
 #=================================================
 #=================================================

+ 6 - 86
scripts/upgrade

@@ -27,11 +27,6 @@ pihole_version="$(ynh_app_setting_get --app=$app --key=pihole_version)"
 
 
 overwrite_setupvars=$(ynh_app_setting_get --app=$app --key=overwrite_setupvars)
 overwrite_setupvars=$(ynh_app_setting_get --app=$app --key=overwrite_setupvars)
 overwrite_ftl=$(ynh_app_setting_get --app=$app --key=overwrite_ftl)
 overwrite_ftl=$(ynh_app_setting_get --app=$app --key=overwrite_ftl)
-overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
-overwrite_phpfpm=$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)
-admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
-fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
-fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
 
 
 #=================================================
 #=================================================
 # CHECK VERSION
 # CHECK VERSION
@@ -80,36 +75,6 @@ if [ -z "$overwrite_ftl" ]; then
 	ynh_app_setting_set --app=$app --key=overwrite_ftl --value=$overwrite_ftl
 	ynh_app_setting_set --app=$app --key=overwrite_ftl --value=$overwrite_ftl
 fi
 fi
 
 
-# If overwrite_nginx doesn't exist, create it
-if [ -z "$overwrite_nginx" ]; then
-	overwrite_nginx=1
-	ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx
-fi
-
-# If overwrite_phpfpm doesn't exist, create it
-if [ -z "$overwrite_phpfpm" ]; then
-	overwrite_phpfpm=1
-	ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value=$overwrite_phpfpm
-fi
-
-# If admin_mail_html doesn't exist, create it
-if [ -z "$admin_mail_html" ]; then
-	admin_mail_html=1
-	ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html
-fi
-
-# If fpm_footprint doesn't exist, create it
-if [ -z "$fpm_footprint" ]; then
-	fpm_footprint=low
-	ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
-fi
-
-# If fpm_usage doesn't exist, create it
-if [ -z "$fpm_usage" ]; then
-	fpm_usage=low
-	ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
-fi
-
 # If pihole_version doesn't exist, create it
 # If pihole_version doesn't exist, create it
 if [ -z "$pihole_version" ]; then
 if [ -z "$pihole_version" ]; then
 	pihole_version="Last 3.X"
 	pihole_version="Last 3.X"
@@ -152,25 +117,17 @@ ynh_install_app_dependencies $pkg_dependencies
 # PHP-FPM CONFIGURATION
 # PHP-FPM CONFIGURATION
 #=================================================
 #=================================================
 
 
-# Overwrite the PHP-FPM configuration only if it's allowed
-if [ $overwrite_phpfpm -eq 1 ]
-then
-	ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3
-	# Create a dedicated PHP-FPM config
-	ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --dedicated_service
-fi
+ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3
+# Create a dedicated PHP-FPM config
+ynh_add_fpm_config
 
 
 #=================================================
 #=================================================
 # NGINX CONFIGURATION
 # NGINX CONFIGURATION
 #=================================================
 #=================================================
 
 
-# Overwrite the NGINX configuration only if it's allowed
-if [ $overwrite_nginx -eq 1 ]
-then
-	ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
-	# Create a dedicated NGINX config
-	ynh_add_nginx_config
-fi
+ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
+# Create a dedicated NGINX config
+ynh_add_nginx_config
 
 
 #=================================================
 #=================================================
 # SPECIFIC UPGRADE
 # SPECIFIC UPGRADE
@@ -411,43 +368,6 @@ ynh_script_progression --message="Disabling maintenance mode..." --weight=5
 
 
 ynh_maintenance_mode_OFF
 ynh_maintenance_mode_OFF
 
 
-#=================================================
-# SEND A README FOR THE ADMIN
-#=================================================
-
-# Get main domain and buid the url of the admin panel of the app.
-admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
-
-# If a HTML email is required. Apply HTML to the changelog.
-if [ "$admin_mail_html" -eq 1 ]; then
-	format=html
-else
-	format=plain
-fi
-ynh_app_changelog --format=$format
-
-if [ $enable_dhcp -eq 1 ]
-then
-	dhcp_alert="You asked to use the internal DHCP server of dnsmasq with Pi-hole.
-You should really read the documentation about that, https://github.com/YunoHost-Apps/pihole_ynh/blob/master/dhcp.md
-
-"
-else
-	dhcp_alert=""
-fi
-
-echo "${dhcp_alert}You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
-You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
-
-If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/pihole_ynh__URL_TAG3__.
-
----
-
-Changelog since your last upgrade:
-$(cat changelog)" > mail_to_send
-
-ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=upgrade
-
 #=================================================
 #=================================================
 # END OF SCRIPT
 # END OF SCRIPT
 #=================================================
 #=================================================