Skip to content

Commit

Permalink
Update scripts and cosmetic fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
DesktopECHO committed Oct 18, 2022
1 parent 60a0605 commit 42084ba
Show file tree
Hide file tree
Showing 9 changed files with 2,812 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .motd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pi-hole for Android 1.7 [20221005]
Pi-hole for Android 1.8 [20221017]

Pi-hole Stats -> padd
Install or Update -> p4a-install
Expand Down
2 changes: 1 addition & 1 deletion etc/init.d/crond
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ start() {
echo
exit 0
fi
echo -n "Starting crond: "
echo -n "Starting crond: "
daemon --pidfile="$pidfile" $binary
RETVAL=$?
echo
Expand Down
4 changes: 3 additions & 1 deletion etc/init.d/dropbear
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# vim /etc/rc.d/init.d/dropbear
#!/bin/bash
#
# description: dropbear ssh daemon
Expand Down Expand Up @@ -52,7 +53,7 @@ start() {
echo
exit 0
fi
echo -n "Starting dropbear: "
echo -n "Starting dropbear: "
daemon --pidfile="$pidfile" $dropbear -p $port -d $dsskey -r $rsakey
RETVAL=$?
echo
Expand Down Expand Up @@ -115,3 +116,4 @@ genrsakey)
usage
;;
esac

2 changes: 1 addition & 1 deletion etc/init.d/lighttpd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ start() {
echo
exit 0
fi
echo -n "Starting lighttpd: "
echo -n "Starting lighttpd: "
daemon --pidfile="$pidfile" $binary -f /etc/lighttpd/lighttpd.conf
RETVAL=$?
echo
Expand Down
2 changes: 1 addition & 1 deletion etc/init.d/syslog-ng
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ start() {
echo
exit 0
fi
echo -n "Starting syslog-ng: "
echo -n "Starting syslog-ng: "
daemon --pidfile="$pidfile" $binary
RETVAL=$?
echo
Expand Down
5 changes: 3 additions & 2 deletions etc/init.d/unbound
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ start() {
echo
exit 0
fi
echo -n "Starting unbound: "
echo -n "Starting unbound: "
daemon --pidfile="$pidfile" $binary
RETVAL=$?
echo
Expand All @@ -37,12 +37,13 @@ stop() {
exit 1
fi
echo -n "Stopping unbound daemon: "
pkill -HUP unbound
pkill -9 -u unbound
RETVAL=$?
echo

if [ $RETVAL -eq 0 ]; then
rm -f $lockfile $pidfile
pkill -9 -u unbound
return 0
else
return 1
Expand Down
2 changes: 1 addition & 1 deletion etc/init.d/xrdp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ start() {
echo
exit 0
fi
echo -n "Starting xrdp: "
echo -n "Starting xrdp: "
/sbin/xrdp-sesman
daemon --pidfile="$pidfile" $binary
RETVAL=$?
Expand Down
58 changes: 48 additions & 10 deletions etc/rc.local
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
#!/bin/bash
#!/bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Start P4A
### END INIT INFO

# Clean-up environment for startup, update PADD, install unbound for new deployment
case "$1" in
start)

# Clean-up environment before startup, update PADD, install unbound for new deployment
ntpd -gq
curl --silent --output /bin/padd https://raw.githubusercontent.com/pi-hole/PADD/master/padd.sh
curl --silent --output /bin/padd https://raw.githubusercontent.com/pi-hole/PADD/master/padd.sh &
rm -rf /sbin/service /var/lock/subsys/* /tmp/* /var/run/*.pid /sbin/poweroff /sbin/reboot /bin/pihole
/bin/cp /.service /sbin/service ; /bin/cp /.poweroff /sbin/poweroff ; /bin/cp /.reboot /sbin/reboot; /bin/cp /.service /bin/update-rc.d ; ln -s /usr/local/bin/pihole /bin/pihole ; /bin/cp /.systemctl /usr/bin/systemctl ; /bin/cp /.motd /etc/motd
/bin/cp /.service /sbin/service
/bin/cp /.poweroff /sbin/poweroff
/bin/cp /.reboot /sbin/reboot
/bin/cp /.service /bin/update-rc.d
/bin/cp /.systemctl /usr/bin/systemctl
/bin/cp /.motd /etc/motd
ln -s /usr/local/bin/pihole /bin/pihole
chmod +x /usr/bin/systemctl /sbin/poweroff /sbin/reboot /bin/padd
[ ! -f /sbin/unbound ] && rpm -Uvh /rpm/*.rpm && cp /.pihole.conf /etc/unbound/conf.d/pihole.conf

Expand Down Expand Up @@ -35,22 +53,42 @@ sed -i "/IPV4_ADDRESS/c\IPV4_ADDRESS=$ipaddr/$subnetmask" /etc/pihole/setupVars.
sed -i "/PIHOLE_INTERFACE/c\PIHOLE_INTERFACE=$device" /etc/pihole/setupVars.conf

# Start Services
yes ' ' | sed 40q
yes ' ' | sed 50q
echo '_______________________________________'
echo ' '
echo ' Pi-hole for Android '
echo ' ** Pi-hole for Android ** '
echo ' '
service syslog-ng start
service crond start
service dropbear start
service xrdp start
service lighttpd start
service unbound start

# Quietly start FTL and get better reporting from pihole status
# Quietly start FTL and get better status info after
service pihole-FTL start > /var/log/pihole.log 2>&1
pihole status
echo '_______________________________________'
;;

stop)
yes ' ' | sed 50q
echo '_______________________________________'
echo ' '
echo ' Shutting Down... '
echo ' '
service unbound stop
service lighttpd stop
service xrdp stop
service dropbear stop
service crond stop
service syslog-ng stop
service pihole-FTL stop
echo '_______________________________________'
;;


# This needs to be at the end of rc.local
touch /var/lock/subsys/local
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
Loading

0 comments on commit 42084ba

Please sign in to comment.