Browse Source

Ongoing work for 4.x

Maniack Crudelis 6 years ago
parent
commit
f2f174413d
2 changed files with 52 additions and 6 deletions
  1. 7 3
      conf/FTL_last.src
  2. 45 3
      scripts/install

+ 7 - 3
conf/FTL_last.src

@@ -1,6 +1,10 @@
-SOURCE_URL=https://github.com/pi-hole/FTL/archive/v4.3.1.tar.gz
-SOURCE_SUM=1c0df5fa42e7f7b89c7e704fdc1b5154
+SOURCE_URL=https://github.com/pi-hole/FTL/archive/894a3c74a8e17b92c68a986e990d5f7f3c127ae2.zip
+SOURCE_SUM=e7a75a792fdc836389b71808165bca18
 SOURCE_SUM_PRG=md5sum
-SOURCE_FORMAT=tar.gz
+SOURCE_FORMAT=zip
 SOURCE_IN_SUBDIR=true
 SOURCE_FILENAME=
+
+#SOURCE_old_URL=https://github.com/pi-hole/FTL/archive/v4.3.1.tar.gz
+#SOURCE_old_SUM=1c0df5fa42e7f7b89c7e704fdc1b5154
+#SOURCE_old_FORMAT=tar.gz

+ 45 - 3
scripts/install

@@ -229,12 +229,22 @@ if [ "$pihole_version" == "Last 3.X" ]
 then
     # Version 3.3.1
     cp -a $pihole_local_repo/advanced/pihole-FTL.service /etc/init.d/pihole-FTL
-    chmod +x /etc/init.d/q
+    chmod +x /etc/init.d/pihole-FTL
     ynh_exec_warn_less systemctl enable pihole-FTL
 else
     # Last version available
     # Stopped dnsmasq to replace it by pihole-FTL
     ynh_systemd_action --action=stop --service_name=dnsmasq
+
+systemctl disable dnsmasq
+# rm /lib/systemd/system/dnsmasq.service
+mv /lib/systemd/system/dnsmasq.service /lib/systemd/system/.dnsmasq.service
+# rm /etc/init.d/dnsmasq
+mv /etc/init.d/dnsmasq /etc/init.d/.dnsmasq
+
+    cp -a $pihole_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
     # Move dnsmasq to preserve the current version
     mv /usr/sbin/dnsmasq /usr/sbin/dnsmasq.backup_by_pihole
     # Replace dnsmasq by pihole-FTL
@@ -242,6 +252,36 @@ else
     # https://github.com/pi-hole/FTL/tree/master/dnsmasq
     update-alternatives --install /usr/sbin/dnsmasq dnsmasq /usr/bin/pihole-FTL 50
     update-alternatives --install /usr/sbin/dnsmasq dnsmasq /usr/sbin/dnsmasq.backup_by_pihole 40
+
+# cp /etc/init.d/pihole-FTL /etc/init.d/dnsmasq
+# systemctl enable dnsmasq
+
+#     ln --symbolic /run/pihole-FTL.pid /run/dnsmasq/dnsmasq.pid
+
+# lrwxrwxrwx 1 root root 35 Jun 22  2018 /etc/systemd/system/multi-user.target.wants/dnsmasq.service -> /lib/systemd/system/dnsmasq.service
+# /run/systemd/generator.late/pihole-FTL.service
+sudo ln -s /run/systemd/generator.late/pihole-FTL.service /etc/systemd/system/multi-user.target.wants/dnsmasq.service
+sudo systemctl daemon-reload
+
+# sudo yunohost app install github/pihole_ynh/ --args "admin=mcrudelis&pihole_version=Last available&" -f -n
+
+# >>> It does work, as we have both dnsmasq and pihole-FTL as the same.
+# But no more dns resolution...
+
+# sudo systemctl daemon-reload
+
+# /lib/systemd/system/dnsmasq.service
+# /etc/init.d/dnsmasq
+
+# systemctl stop dnsmasq
+# systemctl disable dnsmasq
+# If I remove /lib/systemd/system/dnsmasq.service and /etc/init.d/dnsmasq, it works.
+# sudo systemctl daemon-reload
+
+# But we don't have dnsmasq anymore...
+# Duplicating /etc/init.d/pihole-FTL in /etc/init.d/dnsmasq does work
+
+
 fi
 
 #=================================================
@@ -273,7 +313,7 @@ ynh_store_file_checksum --file="$setupVars"
 #=================================================
 ynh_script_progression --message="Setting up Dnsmasq config..." --weight=2
 
-ynh_systemd_action --action=stop --service_name=dnsmasq
+# ynh_systemd_action --action=stop --service_name=dnsmasq
 
 pihole_dnsmasq_config="/etc/dnsmasq.d/01-pihole.conf"
 cp "$pihole_local_repo/advanced/01-pihole.conf" $pihole_dnsmasq_config
@@ -374,7 +414,7 @@ ynh_replace_string --match_string=".*updatechecker.*" --replace_string="#&" --ta
 #=================================================
 ynh_script_progression --message="Restarting Dnsmasq..." --weight=2
 
-ynh_systemd_action --action=restart --service_name=dnsmasq
+# ynh_systemd_action --action=restart --service_name=dnsmasq
 
 #=================================================
 # START PIHOLE-FTL
@@ -387,6 +427,8 @@ then
     ynh_systemd_action --action=restart --service_name=pihole-FTL
 fi
 
+sleep 5
+
 #=================================================
 # BUILD THE LISTS WITH GRAVITY
 #=================================================