-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update p4a-install, rc.local, add ntp
- Loading branch information
1 parent
e2fbed3
commit 3002509
Showing
8 changed files
with
179 additions
and
32 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
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
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
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 |
---|---|---|
@@ -0,0 +1,154 @@ | ||
#!/bin/bash | ||
# | ||
# ntpd This shell script takes care of starting and stopping | ||
# ntpd (NTPv4 daemon). | ||
# | ||
# chkconfig: - 58 74 | ||
# description: ntpd is the NTPv4 daemon. \ | ||
# The Network Time Protocol (NTP) is used to synchronize the time of \ | ||
# a computer client or server to another server or reference time syntaxhighlight, \ | ||
# such as a radio or satellite receiver or modem. | ||
|
||
# Source function library. | ||
. /etc/init.d/functions | ||
|
||
if [ -f /etc/sysconfig/ntpd ];then | ||
. /etc/sysconfig/ntpd | ||
fi | ||
|
||
ntpconf=/etc/ntp.conf | ||
ntpstep=/etc/ntp/step-tickers | ||
|
||
RETVAL=0 | ||
prog="ntpd" | ||
|
||
sync_hwclock() { | ||
ARC=0 | ||
SRM=0 | ||
UTC=0 | ||
|
||
if [ -f /etc/sysconfig/clock ]; then | ||
. /etc/sysconfig/clock | ||
|
||
# convert old style clock config to new values | ||
if [ "${CLOCKMODE}" = "GMT" ]; then | ||
UTC=true | ||
elif [ "${CLOCKMODE}" = "ARC" ]; then | ||
ARC=true | ||
fi | ||
fi | ||
|
||
CLOCKFLAGS="$CLOCKFLAGS --systohc" | ||
|
||
case "$UTC" in | ||
yes|true) CLOCKFLAGS="$CLOCKFLAGS --utc";; | ||
no|false) CLOCKFLAGS="$CLOCKFLAGS --localtime";; | ||
esac | ||
case "$ARC" in | ||
yes|true) CLOCKFLAGS="$CLOCKFLAGS --arc";; | ||
esac | ||
case "$SRM" in | ||
yes|true) CLOCKFLAGS="$CLOCKFLAGS --srm";; | ||
esac | ||
|
||
action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS | ||
} | ||
|
||
readconf() { | ||
dostep='' | ||
dropstr='' | ||
OPTIND=1 | ||
while getopts ":46aAbc:dD:f:gi:k:l:LnN:p:P:qr:s:t:u:v:V:x" args $OPTIONS; | ||
do | ||
case "$args" in | ||
x) dostep=yes;; | ||
c) ntpconf="$OPTARG";; | ||
u) dropstr="-U $(echo $OPTARG | sed 's/:.*//')";; | ||
esac | ||
done | ||
|
||
[ -x /sbin/ntpd -a -f $ntpconf ] || exit 0 | ||
|
||
tickers='' | ||
if [ -s "$ntpstep" ]; then | ||
tickers=$(sed 's/#.*//' $ntpstep) | ||
echo "$tickers" | grep -qi '[a-z0-9]' && dostep=yes || tickers='' | ||
fi | ||
if [ -n "$dostep" -a -z "$tickers" ]; then | ||
# -x option is used, but step-tickers doesn't exist or contain | ||
# anything useful, use servers from ntp.conf instead | ||
tickers=$(awk '$1=="peer"||$1=="server"{print $2}' $ntpconf | \ | ||
fgrep -v 127.127.1.0) | ||
fi | ||
} | ||
|
||
start() { | ||
# Check that networking is up. | ||
[ "$NETWORKING" = "no" ] && exit 1 | ||
|
||
readconf; | ||
|
||
if [ -n "$dostep" ]; then | ||
echo -n $"$prog: Synchronizing with time server: " | ||
/sbin/ntpdate $dropstr -s -b $NTPDATE_OPTIONS $tickers &>/dev/null | ||
RETVAL=$? | ||
[ $RETVAL -eq 0 ] && success || failure | ||
echo | ||
if [ $RETVAL -eq 0 ]; then | ||
[ "$SYNC_HWCLOCK" = "yes" ] && sync_hwclock | ||
else | ||
OPTIONS="$OPTIONS -g" | ||
fi | ||
else | ||
# -g can replace the grep for time servers | ||
# as it permits ntpd to violate its 1000s limit once. | ||
OPTIONS="$OPTIONS -g" | ||
fi | ||
# Start daemons. | ||
echo -n $"Starting $prog: " | ||
daemon ntpd $OPTIONS | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd | ||
return $RETVAL | ||
} | ||
|
||
stop() { | ||
echo -n $"Shutting down $prog: " | ||
killproc ntpd | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ntpd | ||
return $RETVAL | ||
} | ||
|
||
# See how we were called. | ||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
status) | ||
status ntpd | ||
RETVAL=$? | ||
;; | ||
restart|reload) | ||
stop | ||
start | ||
RETVAL=$? | ||
;; | ||
condrestart) | ||
if [ -f /var/lock/subsys/ntpd ]; then | ||
stop | ||
start | ||
RETVAL=$? | ||
fi | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|restart|condrestart|status}" | ||
RETVAL=3 | ||
esac | ||
|
||
exit $RETVAL |
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
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,31 +1,12 @@ | ||
#!/bin/bash | ||
[[ ! -f /opt/rh/devtoolset-9/root/usr/bin/gcc ]] && yum -y install https://buildlogs.centos.org/c7-devtoolset-9.armhfp/devtoolset-9-binutils/20211015132728/2.32-16.el7.2.armhfp/devtoolset-9-binutils-2.32-16.el7.2.armv7hl.rpm https://buildlogs.centos.org/c7-devtoolset-9.armhfp/devtoolset-9-gcc/20211014113237/9.3.1-2.2.el7.armhfp/devtoolset-9-gcc-9.3.1-2.2.el7.armv7hl.rpm https://buildlogs.centos.org/c7-devtoolset-9.armhfp/devtoolset-9-gcc/20211014113237/9.3.1-2.2.el7.armhfp/devtoolset-9-gcc-c++-9.3.1-2.2.el7.armv7hl.rpm https://buildlogs.centos.org/c7-devtoolset-9.armhfp/devtoolset-9-gcc/20211014113237/9.3.1-2.2.el7.armhfp/devtoolset-9-libstdc++-devel-9.3.1-2.2.el7.armv7hl.rpm https://buildlogs.centos.org/c7-devtoolset-9.armhfp/devtoolset-9/20211013151212/9.1-1.el7.armhfp/devtoolset-9-runtime-9.1-1.el7.armv7hl.rpm scl-utils policycoreutils-python python3-pip python-IPy nettle-devel libidn-devel readline-devel cmake3 | ||
export PIHOLE_SKIP_OS_CHECK=true | ||
touch /etc/lighttpd/external.conf | ||
mkdir -p /etc/pihole ; /bin/cp -f /.setupVars /etc/pihole/setupVars.conf | ||
echo v5.16.3 > /etc/pihole/ftlbranch ; export PIHOLE_SKIP_OS_CHECK=true | ||
mkdir -p /etc/pihole | ||
[[ ! -f /etc/pihole/setupVars.conf ]] && /bin/cp -f /.setupVars /etc/pihole/setupVars.conf | ||
subnetmask=$(ip route list table main | tail -n1) ; subnetmask=$(cut -d "/" -f2 <<< "$subnetmask") ; subnetmask=$(cut -d " " -f1 <<< "$subnetmask") | ||
device=$(ip route list table main | tail -n1 | cut -d' ' -f 3) | ||
ipaddr=$(ip route list table main | tail -n1) ; ipaddr=`echo $ipaddr | awk -F' ' ' { print $(NF-0) } '` | ||
clear ; echo Pi-hole for Android // Device: $device // IP: $ipaddr // SubNet: $subnetmask ; echo | ||
printf "\nPi-hole for Android // Device: $device // IP: $ipaddr // SubNet: $subnetmask\n" | ||
sed -i "/IPV4_ADDRESS/c\IPV4_ADDRESS=$ipaddr/$subnetmask" /etc/pihole/setupVars.conf | ||
sed -i "/PIHOLE_INTERFACE/c\PIHOLE_INTERFACE=$device" /etc/pihole/setupVars.conf | ||
curl -L https://install.pi-hole.net | bash /dev/stdin --unattended | ||
python -c "print('\033[A\033[A\033[A\033[A')" | ||
cd /tmp | ||
rm -rf FTL ; git clone --depth=1 https://github.com/pi-hole/FTL.git | ||
cd FTL | ||
|
||
# Fixups | ||
sed -i 's/cmake/cmake3/g' build.sh | ||
sed -i '/BUS_MCEERR_AR/d' src/signals.c | ||
sed -i '/BUS_MCEERR_AO/d' src/signals.c | ||
sed -i 's/--dirty//g' src/gen_version.cmake | ||
|
||
# Build pihole-FTL with updated CentOS 7 toolchain | ||
echo ; echo "Building pihole-FTL from source. This will take a few minutes..." | ||
scl enable devtoolset-9 ./build.sh >/etc/pihole/install.log 2>&1 | ||
|
||
# Install and Restart pihole-FTL | ||
mkdir -p /var/log/pihole ; chown -R pihole:pihole /var/log/pihole | ||
bash -c "service pihole-FTL stop ; pkill pihole-FTL ; /bin/cp pihole-FTL /usr/bin/pihole-FTL ; service pihole-FTL start ; service lighttpd restart ; pihole-FTL -v > /etc/pihole/ftlbranch" >>/etc/pihole/install.log 2>&1 | ||
echo ; pihole -v ; pihole status ; echo | ||
curl -sSL https://raw.githubusercontent.com/DesktopECHO/pi-hole/master/automated%20install/basic-install.sh | bash /dev/stdin --unattended |
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