-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor install prompts for pihole-updatelists
- Loading branch information
1 parent
7599323
commit 370e27b
Showing
1 changed file
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Add custom logic before the "motd_ssh" line in install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i \ | ||
# Prompt user to decide whether to install pihole-updatelists\n\ | ||
read -r -p "Would you like to add pihole-updatelists? <Y/n> " prompt\n\ | ||
if [[ -z \"$prompt\" || ${prompt,,} =~ ^(y|yes)$ ]]; then\n\ | ||
msg_info \"Installing pihole-updatelists\"\n\ | ||
apt-get install -y php-cli php-sqlite3 php-intl php-curl sqlite3\n\ | ||
wget -O - https://raw.githubusercontent.com/jacklul/pihole-updatelists/master/install.sh | bash -s systemd\n\ | ||
sed -e \"/pihole updateGravity/ s/^#*/#/\" -i /etc/cron.d/pihole\n\ | ||
mkdir -p /etc/systemd/system/pihole-FTL.service.d\n\ | ||
echo -e \"[Service]\\nExecStartPre=-/bin/sh -c '[ -w /etc/cron.d/pihole ] && /bin/sed -e \"/pihole updateGravity/ s/^#*/#/\" -i /etc/cron.d/pihole'\" > /etc/systemd/system/pihole-FTL.service.d/override.conf\n\ | ||
mkdir -p /etc/systemd/system/pihole-updatelists.timer.d\n\ | ||
echo -e \"[Timer]\\nRandomizedDelaySec=5m\\nOnCalendar=*-*-* 03:00:00\" > /etc/systemd/system/pihole-updatelists.timer.d/override.conf\n\ | ||
systemctl daemon-reload\n\ | ||
systemctl restart pihole-FTL.service\n\ | ||
wget -O /etc/pihole-updatelists.conf https://raw.githubusercontent.com/mschabhuettl/PiBlockLXC/main/config/pihole-updatelists.conf\n\ | ||
sqlite3 /etc/pihole/gravity.db \"DELETE FROM adlist\"\n\ | ||
sqlite3 /etc/pihole/gravity.db \"DELETE FROM adlist_by_group\"\n\ | ||
sqlite3 /etc/pihole/gravity.db \"DELETE FROM domainlist\"\n\ | ||
sqlite3 /etc/pihole/gravity.db \"DELETE FROM domainlist_by_group\"\n\ | ||
pihole-updatelists\n\ | ||
fi' install/piblocklxc-install.sh | ||
|
||
sed -i '/motd_ssh/i # Prompt user to decide whether to install pihole-updatelists' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i read -r -p "Would you like to add pihole-updatelists? <Y/n> " prompt' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i if [[ -z "$prompt" || ${prompt,,} =~ ^(y|yes)$ ]]; then' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i msg_info "Installing pihole-updatelists"' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i apt-get install -y php-cli php-sqlite3 php-intl php-curl sqlite3' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i wget -O - https://raw.githubusercontent.com/jacklul/pihole-updatelists/master/install.sh | bash -s systemd' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i sed -e "/pihole updateGravity/ s/^#*/#/" -i /etc/cron.d/pihole' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i mkdir -p /etc/systemd/system/pihole-FTL.service.d' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i echo -e "[Service]\\\\nExecStartPre=-/bin/sh -c \'[ -w /etc/cron.d/pihole ] && /bin/sed -e \\"/pihole updateGravity/ s/^#*/#\\" -i /etc/cron.d/pihole\'" > /etc/systemd/system/pihole-FTL.service.d/override.conf' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i mkdir -p /etc/systemd/system/pihole-updatelists.timer.d' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i echo -e "[Timer]\\\\nRandomizedDelaySec=5m\\\\nOnCalendar=*-*-* 03:00:00" > /etc/systemd/system/pihole-updatelists.timer.d/override.conf' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i systemctl daemon-reload' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i systemctl restart pihole-FTL.service' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i wget -O /etc/pihole-updatelists.conf https://raw.githubusercontent.com/mschabhuettl/PiBlockLXC/main/config/pihole-updatelists.conf' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i sqlite3 /etc/pihole/gravity.db "DELETE FROM adlist"' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i sqlite3 /etc/pihole/gravity.db "DELETE FROM adlist_by_group"' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i sqlite3 /etc/pihole/gravity.db "DELETE FROM domainlist"' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i sqlite3 /etc/pihole/gravity.db "DELETE FROM domainlist_by_group"' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i pihole-updatelists' install/piblocklxc-install.sh | ||
sed -i '/motd_ssh/i fi' install/piblocklxc-install.sh |