diff --git a/.reboot b/.reboot new file mode 100644 index 00000000..daeb0b22 --- /dev/null +++ b/.reboot @@ -0,0 +1,8 @@ +#!/bin/bash +service pihole-FTL stop +service unbound stop +service lighttpd stop +service xrdp stop +service crond stop +service syslog-ng stop +unchroot am start -a android.intent.action.REBOOT diff --git a/.shutdown b/.shutdown new file mode 100644 index 00000000..26310f25 --- /dev/null +++ b/.shutdown @@ -0,0 +1,8 @@ +#!/bin/bash +service pihole-FTL stop +service unbound stop +service lighttpd stop +service xrdp stop +service crond stop +service syslog-ng stop +unchroot am start -a com.android.internal.intent.action.REQUEST_SHUTDOWN diff --git a/.systemctl b/.systemctl new file mode 100644 index 00000000..e3e9f72b --- /dev/null +++ b/.systemctl @@ -0,0 +1,540 @@ +# Filename: systemctl +# Location: /usr/sbin/systemctl +# /usr/bin/hostnamectl +# /usr/bin/systemd-detect-virt +# Author: bgstack15@gmail.com +# Startdate: 2020-01-10 13:02:14 +# SPDX-License-Identifier: CC-BY-SA-4.0 +# Title: +# Purpose: +# Package: systemctl-service-shim +# History: +# 2020-05-14 place framework.sh contents inline so as not to depend on it. +# 2021-01-10 adapted for inclusion in devuan-sanity +# 2021-10-20 add /bin/systemctl symlink control logic +# Usage: +# Should be mostly like systemctl from systemd. +# Reference: ftemplate.sh 2019-05-02a ; framework.sh 2018-05-02a +# man 1 systemctl +# Improve: +# add preset command +# Return 1 if status output is failed +# Dependencies: +# req-devuan: moreutils +# Documentation: +# Be aware that real systemd systemctl is file /bin/systemctl but +# this systemdtl is file /usr/sbin/systemctl to prevent a recursive loop +# in some service scripts that look for /bin/systemctl +# vim: set sw=3 sts=3 ts=3 et: +fiversion="2019-05-02a" +systemctlversion="2021-10-20a" + +usage() { + ${PAGER:-/usr/bin/less -F} >&2 <> "${logfile}" +} + +parseFlag() { + flag="$1" + hasval=0 + case ${flag} in + # INSERT FLAGS HERE + "d" | "debug" | "DEBUG" | "dd" ) setdebug ; ferror "debug level ${debug}" ; __debug_set_by_param=1 ;; + "u" | "usage" | "help" | "h" ) usage ; exit 0 ;; + "V" | "fcheck" | "version" ) ferror "${scriptfile} version ${systemctlversion}" ; exit 0 ;; + "c" | "conf" | "conffile" | "config" ) getval ; conffile="${tempval}" ;; + "now" ) export SYSTEMCTL_NOW=1 ;; + "full") export SYSTEMCTL_FULL=1 ;; + "system") export SYSTEMCTL_SYSTEM=1 ;; + esac + + debuglev 10 && { test ${hasval} -eq 1 && ferror "flag: ${flag} = ${tempval}" || ferror "flag: ${flag}" ; } +} + +# INITIALIZE VARIABLES +# variables set in framework: +# server scriptdir scriptfile scripttrim + +### BEGIN IMPORT OF FRAMEWORK.SH +fversion="2020-04-24x" + +# DEFINE FUNCTIONS + +isflag() { + # input: $1=word to parse + case "$1" in + --*) retval=2 ;; + -*) retval=1 ;; + *) retval=0 ;; + esac + echo $retval +} + +parseParam() { + # determines if --longname or -shortflagS that need individual parsing + trimParam=$( printf '%s' "${param}" | sed -n 's/--//p' ) + _rest= + if test -n "$trimParam" ; + then + parseFlag $trimParam + else + #splitShortStrings + _i=2 + while test ${_i} -le ${#param} ; + do + _j=$( expr ${_i} + 1) + #_char=$(expr substr "$param" $_i 1) + #_rest=$(expr substr "$param" $_j 255) + _char=$( printf '%s' "${param}" | cut -c ${_i}) + _rest=$( printf '%s' "${param}" | cut -c ${_j}-255) + parseFlag $_char + _i=$( expr ${_i} + 1) + done + fi +} + +getval() { + tempval= + if test -n "${_rest}" ; + then + tempval="${_rest}" + hasval=1 + _i=255 # skip rest of splitShortStrings because found the value! + elif test -n "$nextparam" && test $(isflag "$nextparam") -eq 0 ; + then + tempval="$nextparam" + hasval=1 #DNE ; is affected by ftemplate! + paramnum=$nextparamnum + fi +} + +debuglev() { + # call: debuglev 5 && ferror "debug level is at least a five!" + # added 2015-11-17 + localdebug=0 ; localcheck=0 ; + fisnum ${debug} && localdebug=${debug} + fisnum ${1} && localcheck=${1} + test $localdebug -ge $localcheck && return 0 || return 1 +} + +debuglevoutput() { + # call: commandthatgeneratesstdout | debuglevoutput 8 + # output: output to standard error prepended with "debug8: " the contents of the pipe + ___dlo_threshold="${1}" + ___dlo_silent="${2}" + if debuglev "${___dlo_threshold}" ; + then + if test -n "${___dlo_silent}" ; + then + cat 1>&2 + else + sed -r -e "s/^/debug${___dlo_threshold}: /;" 1>&2 + fi + else + cat 1>/dev/null 2>&1 + fi +} + +fisnum() { + # call: fisnum $1 && debug=$1 || debug=10 + fisnum= ; + case $1 in + ''|*[!0-9]*) fisnum=1 ;; # invalid + *) fisnum=0 ;; # valid number + esac + return ${fisnum} +} + +fistruthy() { + # call: if fistruthy "$val" ; then + local _return= + case "$( echo "${1}" | tr '[:upper:]' '[:lower:]' )" in + yes|1|y|true|always) _return=true ;; + esac + test -n "${_return}" ; return $? +} + +setval() { + # call: setval 0 value1 value2 value3 ... <&2 +} + +setdebug() { + # call: setdebug + debug=10 + getval + if test $hasval -eq 1 ; + then + if fisnum ${tempval} ; + then + debug=${tempval} + else + #test paramnum -le paramcount && paramnum=$( expr ${paramnum} - 1 ) + hasval=0 + fi + elif fisnum ${_rest} ; + then + debug=${_rest} + _i=255 + else + test $paramnum -le $paramcount && test -z ${nextparam} && paramnum=$( expr ${paramnum} - 1 ) + fi +} + +define_if_new() { + # call: define_if_new IFW_IN_LOG_FILE "/var/log/messages" + eval thisval="\${${1}}" + test -z "${thisval}" && eval "$1"=\"$2\" +} + +# INITIALIZE VARIABLES +server=$( hostname -s ) +thisos="$( uname -s )" +# get thisflavor and thisflavorversion. Examples: centos, ubuntu, redhat +if test -f /etc/os-release ; +then + eval thisflavor=$( grep -iE "^\s*ID=" /etc/os-release 2>/dev/null | sed 's/^.*=//;' | tr 'A-Z' 'a-z' ) + eval thisflavorversion=$( grep -iE "^\s*PRETTY_NAME=" /etc/os-release 2>/dev/null | sed -e 's/^.*=//;' | tr -dc '0-9.' ) +elif test -f /etc/system-release && test $( wc -l < /etc/system-release 2>/dev/null ) -eq 1 ; +then + eval thisflavor=$( awk '{print $1}' < /etc/system-release 2>/dev/null | tr 'A-Z' 'a-z' ) + eval thisflavorversion=$( /dev/null | tr -dc '0-9.' ) +else + if test "${thisos}" = "FreeBSD" ; then + thisflavor="$( uname -i )" ; thisflavorversion="$( uname -r )" ; + else + thisflavor="other" + thisflavorversion="unknown" + fi +fi +case "${thisos}" in FreeBSD) sed=gsed ;; *) sed=sed ;; esac + +# if framework is dot sourced then $0 will be "-bash" and screw things up +case ${0} in + "-bash") + scriptdir="$( pwd )" + scriptfile="dot-sourced" ;; + *) + scriptdir="$( cd $( dirname ${0} ) ; pwd )" + scriptfile="$( basename ${0} | sed 's!/./!/!g;s!\./!!g' )" + scripttrim="${scriptfile%%.sh}" + ;; +esac + +# SPECIAL RUNTIME-RELATED VARIABLES +{ test "$USER" = "root" || test "$( stat -c '%u' /proc/$$/exe 2>/dev/null )" = 0 ; } && is_root=1 +test -n "$SUDO_USER" && is_root="sudo" + +nullflagcount=0 +validateparams() { + # VALIDATE PARAMETERS + # scroll through all parameters and check for isflag. + # if isflag, get all flags listed. Also grab param#. + paramcount=$# + thiscount=0 ;thisopt=0 ;freeopt=0 ; + varsyet=0 + paramnum=0 + debug=0 + fallopts= + while test $paramnum -lt $paramcount ; + do + paramnum=$( expr ${paramnum} + 1 ) + eval param=\${$paramnum} + nextparamnum=$( expr ${paramnum} + 1 ) + eval nextparam=\${$nextparamnum} + case $param in + "-") + if test "$varsyet" = "0" ; + then + # first instance marks beginning of flags and parameters. + #Until then it was the names of variables to fill. + varsyet=1 + else + nullflagcount=$( expr ${nullflagcount} + 1 ) #useful for separating flags from something else? + debuglev 10 && ferror "null flag!" # second instance is null flag. + fi + ;; + esac + if test -n "$param" ; + then + # parameter $param exists. + if test $(isflag $param) -gt 0 ; + then + # IS FLAG + parseParam + else + # IS VALUE + if test "$varsyet" = "0" ; + then + thisopt=$( expr ${thisopt} + 1 ) + test "${param}" = "DEBUG" && debug=10 && thisopt=$( expr ${thisopt} - 1 ) || \ + eval "varname${thisopt}=${param}" + #varname[${thisopt}]="${param}" + debuglev 10 && ferror "var \"${param}\" named" + else + thiscount=$( expr ${thiscount} + 1 ) + test $thiscount -gt $thisopt && freeopt=$( expr ${freeopt} + 1 ) + #eval ${varname[${thiscount}]:-opt${freeopt}}="\"${param}\"" + eval "thisvarname=\${varname${thiscount}}" + test -z "${thisvarname}" && eval "thisvarname=opt${freeopt}" + eval "${thisvarname}=\"${param}\"" + eval fallopts=\"${fallopts} ${param}\" + debuglev 10 && ferror "${thisvarname} value: ${param}" + fi + fi + fi + done + fallopts="${fallopts# }" + if debuglev 10 ; + then + ferror "thiscount=$thiscount" + ferror "fallopts=$fallopts" + ferror "Framework $fversion" + ferror "Finput $fiversion" + fi +} +### END IMPORT OF FRAMEWORK.SH + +define_if_new logfile "/var/log/systemctl.log" + +# VALIDATE PARAMETERS +# objects before the dash are options, which get filled with the optvals +# to debug flags, use option DEBUG. Variables set in framework: fallopts +validateparams action - "$@" + +# LEARN EX_DEBUG +test -z "${__debug_set_by_param}" && fisnum "${SYSTEMCTL_DEBUG}" && debug="${SYSTEMCTL_DEBUG}" +debug=10 + +# CONFIGURE VARIABLES AFTER PARAMETERS + +_trimmed="$( echo "${@}" | tr -d '\r\n' )" +log_to_file "${0} ${_trimmed}" +case "${0}" in + *hostnamectl|*systemd-detect-virt) exit 0 ;; # always just short-circuit +esac + +# MAIN LOOP + +# actions +actionlist="" +case "${action}" in + + restart|start|stop|status|reload|condrestart|try-restart|reload-or-try-restart) + # re-map a few actions + case "${action}" in + "reload-or-try-restart") action=restart ;; + esac + x=1 + while test ${x:-${thiscount}} -le $(( thiscount - 1 )) && test ${thiscount} -gt 1 ; + do + eval thisopt="\${opt${x}}" + #thisopt="$( echo "${thisopt}" | sed -r -e 's/\.service$//;' )" + actionstatement="$( printf "%s" "service ${thisopt} ${action};" )" + actionlist="${actionlist:+${actionlist} }${actionstatement}" + x=$(( x + 1 )) + done + ;; + + enable|disable|mask|unmask) + case "${action}" in + mask) action=disable ;; + unmask) action=enable ;; + esac + x=1 + while test ${x:-${thiscount}} -le $(( thiscount - 1 )) && test ${thiscount} -gt 1 ; + do + eval thisopt="\${opt${x}}" + thisopt="$( echo "${thisopt}" | sed -r -e 's/\.service$//;' )" + actionstatement="$( printf "%s" "update-rc.d ${thisopt} ${action};" )" + actionlist="${actionlist:+${actionlist} }${actionstatement}" + test "${SYSTEMCTL_NOW}" = "1" && { + case "${action}" in + enable) + nowaction=start + ;; + disable) + nowaction=stop + ;; + esac + actionstatement="$( printf "%s" "service ${thisopt} ${nowaction:-stop};" )" + actionlist="${actionlist:+${actionlist} }${actionstatement}" + } + x=$(( x + 1 )) + done + ;; + + daemon-reload) + debuglev 1 && echo "${action} is a NOP." + ;; + + list-unit-files) + # Future improvement: can consume --full, but I do not care enough to deal with it now. + ls -Al /etc/init.d + ;; + + is-enabled) + currentrunlevel="$( who -r | grep -oE 'run-level\s+[[:digit:]]+' | awk '{print $NF}' )" + responsenumber=1 + + # loop through each service on the command line + x=1 + while test ${x:-${thiscount}} -le $(( thiscount - 1 )) && test ${thiscount} -gt 1 ; + do + eval thisopt="\${opt${x}}" + thisopt="$( echo "${thisopt}" | sed -r -e 's/\.service$//;' )" + #actionstatement="$( printf "%s" "service ${thisopt} ${action};" )" + scriptfile="$( find "/etc/rc${currentrunlevel}.d" -mindepth 1 -maxdepth 1 -name "S??${thisopt}" 2>/dev/null )" + responsetext="disabled" + # if file exists, let us return 0. + if test -n "${scriptfile}" ; + then + debuglev 2 && echo "${scriptfile}" + responsenumber=0 # any "enabled" response makes systemctl return 0 + responsetext="enabled" + fi + echo "${responsetext:-UNKNOWN}" + x=$(( x + 1 )) + done + exit "${responsenumber}" + ;; + + is-active) + responsenumber=3 + x=1 + while test ${x:-${thiscount}} -le $(( thiscount - 1 )) && test ${thiscount} -gt 1 ; + do + eval thisopt="\${opt${x}}" + thisopt="$( echo "${thisopt}" | sed -r -e 's/\.service$//;' )" + #actionstatement="$( printf "%s" "service ${thisopt} ${action};" )" + servicestatus="$( service "${thisopt}" status 1>/dev/null 2>&1 ; echo "${?}" )" + responsetext="stopped" + # if file exists, let us return 0. + if test ${servicestatus:-1} -eq 0 ; + then + responsenumber=0 + responsetext="active" + fi + echo "${responsetext:-unknown}" + x=$(( x + 1 )) + done + exit "${responsenumber}" + ;; + + *) + ferror "Fatal! 2. Unable to understand action ${action}. Aborted." + exit 2 + ;; +esac + +if test "${0}" = "/bin/systemctl" && test "$( readlink -f /bin/systemctl )" = "/usr/sbin/systemctl" ; +then + log_to_file "META: removing /bin/systemctl symlink" + unlink /bin/systemctl + export FIX_BIN_SYSTEMCTL=1 +fi + +# list of actions +if test -n "${actionlist}" ; +then + #debuglev 1 && ferror "Full list: ${actionlist}" + printf "%s" "${actionlist}" | tr ';' '\n' | while read thisaction ; + do + log_to_file "ACTION: ${thisaction}" + debuglev 5 && ferror "${thisaction}" + eval "${thisaction}" + done +fi + +if test "${FIX_BIN_SYSTEMCTL}" = "1" ; +then + log_to_file "META: restoring /bin/systemctl symlink" + ln -s /usr/sbin/systemctl /bin/systemctl +fi +# exit cleanly +: diff --git a/README.md b/README.md index 85b97331..01d282c6 100644 --- a/README.md +++ b/README.md @@ -53,16 +53,23 @@ Touch the **[ ▸ START ]** button and confirm. ----------------------------------------------------------- **INSTALLATION COMPLETE - PI-HOLE IS RUNNING ON YOUR ANDROID DEVICE!** +_**NOTE:** Upstream dropped support for CentOS 7 in September 2022. +Login to the instance via SSH or RDP and run the following command:_ + +```sudo su -c "wget -O /usr/local/bin/p4a-install https://raw.githubusercontent.com/DesktopECHO/Pi-hole-for-Android/main/usr/local/bin/p4a-install ; p4a-install"``` + +Run `p4a-install` to update Pi-hole moving forward. pihole-FTL will stay up-to-date by building from source. + ----------------------------------------------------------- -Your Android device's IP is shown at the top of the Linux Deploy main window. You can interact with the Pi-hole instance in several ways: +The Android device's IP is shown at the top of the Linux Deploy main window. You can interact with Pi-hole in several ways, the examples below use IP **_10.13.12.11_** - - Open a web browser to the Android device's IP address **-->** ```http://10.13.12.11/admin``` + - From a Windows desktop, connect via RDP **->** **```mstsc.exe /v:10.13.12.11```** - - SSH to the instance on port 22 **-->** ```ssh android@10.13.12.11``` + - From a computer running Linux, connect via SSH **->** **```ssh android@10.13.12.11```** - - If your Android device has a display, you can RDP into the Pi-hole instance (as localhost) by installing the [Microsoft Remote Desktop](https://play.google.com/store/apps/details?id=com.microsoft.rdc.androidx) client. + - Pi-hole administration is accessible from any browser on your network **->** **```http://10.13.12.11/admin```** - - RDP to the device's IP address from a remote machine **-->** ```mstsc.exe /v:10.13.12.11``` + - If your Android device has a display, you can RDP into the Pi-hole instance (as localhost) by installing the [Microsoft Remote Desktop](https://play.google.com/store/apps/details?id=com.microsoft.rdc.androidx) client. ![image](https://user-images.githubusercontent.com/33142753/147254465-26443e85-6695-46e6-83f4-4c3ff1749804.png) @@ -72,7 +79,9 @@ Your Android device's IP is shown at the top of the Linux Deploy main window. Y - [Setting custom disk/shmem alert thresholds](https://github.com/DesktopECHO/Pi-hole-for-Android/wiki/Setting-custom-alert-thresholds-for-disk-and-shmem-monitoring) - [Linux Deploy - Trouble finding disk image or install location](https://github.com/DesktopECHO/Pi-hole-for-Android/wiki/Trouble-finding-path-where-Pi%E2%80%90hole-image-is-downloaded,-or-errors-are-reported-during-creation-of-Pi%E2%80%90hole-disk-image.) -**Additional Info** +**Additional Info:** + +RDP Sessions launch the Openbox window manager with QTerminal in fullscreen mode. To open a new tab hit **[Ctrl-Shift-T]** and to un-hide the menubar hit **[Ctrl-Shift-M]** You can restart (or "bounce") the Pi-hole instance in Linux Deploy by pressing **[ ■ STOP ]** and waiting a few seconds for the instance to indicate all services are stopped. Restart the instance by pressing **[ ▸ START ]** @@ -88,4 +97,4 @@ Adjust QT display scaling: ```~/startwm.sh``` Change the font size in QTerminal: ```~/.config/qterminal.org/qterminal.ini``` -**If your Android device has a battery and was unused for months or years, replace its battery.** Old, worn, or abused Li-ion batteries can fail when pushed back into service. Failure appears as a bulge in the battery, "thermal event" or worse. A new battery makes an excellent [UPS](https://en.wikipedia.org/wiki/Uninterruptible_power_supply) for the tiny Linux box you just provisioned! +**If your Android device has a battery and was unused for months or years, replace its battery.** Old, worn, or abused Li-ion batteries can fail when pushed back into service. Failure appears as a bulge in the battery, or worse a [**_thermal event_**](https://www.urbandictionary.com/define.php?term=unexpected+thermal+event). A good battery provides [UPS](https://en.wikipedia.org/wiki/Uninterruptible_power_supply) protection for your newly-provisioned Pi-hole. diff --git a/etc/init.d/dropbear b/etc/init.d/dropbear index ac0a3893..b1a919e0 100644 --- a/etc/init.d/dropbear +++ b/etc/init.d/dropbear @@ -1,4 +1,3 @@ -# vim /etc/rc.d/init.d/dropbear #!/bin/bash # # description: dropbear ssh daemon @@ -116,4 +115,3 @@ genrsakey) usage ;; esac - diff --git a/etc/motd b/etc/motd new file mode 100644 index 00000000..cde98af8 --- /dev/null +++ b/etc/motd @@ -0,0 +1,5 @@ +Pi-hole for Android 1.6 [20220908] + + Pi-hole Stats -> padd + Install or Update -> p4a-install + diff --git a/etc/rc.local b/etc/rc.local index d730dc2e..574c0ad2 100644 --- a/etc/rc.local +++ b/etc/rc.local @@ -1,8 +1,11 @@ #!/bin/bash -# Clean up before start +# Clean-up environment for startup, update PADD, install unbound for new deployment +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/shutdown /sbin/reboot /bin/pihole +/bin/cp /.service /sbin/service ; /bin/cp /.shutdown /sbin/shutdown ; /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 +chmod +x /usr/bin/systemctl /sbin/shutdown /sbin/reboot /bin/padd [ ! -f /sbin/unbound ] && rpm -Uvh /rpm/*.rpm && cp /.pihole.conf /etc/unbound/conf.d/pihole.conf -rm -rf /sbin/service /var/lock/subsys/* /tmp/* /var/run/*.pid ; cp /.service /sbin/service ; cp /.service /bin/update-rc.d ; rm -f /bin/pihole ; ln -s /usr/local/bin/pihole /bin/pihole # Make sure users are in right groups usermod -a -G aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin root @@ -11,11 +14,15 @@ usermod -a -G aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin lig usermod -a -G aid_net_bt_admin,aid_net_bt,aid_inet,aid_net_raw,aid_net_admin unbound # IP / subnet / interface detection -ipaddr=$(ip route list table main) ; ipaddr=`echo $ipaddr | awk -F' ' ' { print $(NF-0) } '` -subnetmask=$(ip route list table main) ; subnetmask=$(cut -d "/" -f2 <<< "$subnetmask") ; subnetmask=$(cut -d " " -f1 <<< "$subnetmask") ; echo $subnetmask -device=$(ip route list table main | cut -d' ' -f 3) +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) } '` touch /etc/sysconfig/network-scripts/ifcfg-$device +# Derive hostname from device name (or set to your preference) +hostname=$(unchroot getprop ro.product.device) # or hostname="DroidHole" +hstnm=$(echo $hostname | sed -e 's/ /-/g' | sed -e 's/_/-/g'| sed -e 's/--//g') ; echo $hstnm > /proc/sys/kernel/hostname ; echo $hstnm > /etc/hostname ; sed -i "/$ipaddr/d" "/etc/hosts" ; sed -i "/$hstnm/d" "/etc/hosts" ; echo $ipaddr $hstnm $hstnm.local >> /etc/hosts + # When a Pi-hole instance is started, the default setting is to let # it automagically configure networking. When you change netwokrks # on the Android device stop the Linux Deploy instance and re-start it. diff --git a/home/android/startwm.sh b/home/android/startwm.sh index 1279c89a..dc00b224 100644 --- a/home/android/startwm.sh +++ b/home/android/startwm.sh @@ -1,5 +1,6 @@ # xRDP Startup Script # Change QT_SCALE_FACTOR as needed +export QT_QPA_PLATFORMTHEME=qt5ct export QT_SCALE_FACTOR=1.5 export LC_ALL=en_US.UTF-8 openbox-session diff --git a/usr/local/bin/p4a-install b/usr/local/bin/p4a-install index 591d3ef0..6e1b4ed9 100644 --- a/usr/local/bin/p4a-install +++ b/usr/local/bin/p4a-install @@ -1,14 +1,31 @@ #!/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 touch /etc/lighttpd/external.conf -service lighttpd start -mkdir -p /etc/pihole ; cp /.setupVars /etc/pihole/setupVars.conf -subnetmask=$(ip route list table main) ; subnetmask=$(cut -d "/" -f2 <<< "$subnetmask") ; subnetmask=$(cut -d " " -f1 <<< "$subnetmask") -device=$(ip route list table main | cut -d' ' -f 3) -ipaddr=$(ip route list table main) ; ipaddr=`echo $ipaddr | awk -F' ' ' { print $(NF-0) } '` +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 +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 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 -echo -echo 'In Linux Deploy press [ STOP ] after Pi-hole install is complete' -echo ' Then press [ START ] to launch Pi-hole' -echo +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 diff --git a/usr/local/bin/p4a-uninstall b/usr/local/bin/p4a-uninstall index 6f116039..c7fea333 100644 --- a/usr/local/bin/p4a-uninstall +++ b/usr/local/bin/p4a-uninstall @@ -1,7 +1,2 @@ #!/bin/bash -clear -[ -f /usr/local/bin/pihole ] && pihole uninstall -echo -echo 'In Linux Deploy press [ STOP ] after Pi-hole uninstaller completes' -echo " Then press [ START ] and run p4a-install for a new Pi-hole install" -echo +[ -f /usr/local/bin/pihole ] && service pihole-FTL stop && service lighttpd stop && pihole uninstall diff --git a/usr/local/bin/sysprep b/usr/local/bin/sysprep index 409dab0f..d70cf1e4 100644 --- a/usr/local/bin/sysprep +++ b/usr/local/bin/sysprep @@ -10,11 +10,15 @@ rm -rf /etc/dropbear/* rm -rf /home/android/.bash_history rm -rf /root/.bash_history rm -rf /var/log/*.log +rm -rf /var/tmp/* +rm -rf /var/log/pihole/* +rm -rf /var/log/cron rm -rf /var/log/lighttpd/*.log rm -rf /var/log/messages /var/log/secure rm -rf /etc/xrdp/*.pem /etc/xrdp/rsakeys.ini +rm -rf /var/cache/yum/armhfp/7/* cd /home/android ; rm -rf .cache .pcsc* .ssh .vnc .rnd .pki .local .Xauthority .xsession* PADD.pid piHoleVersion thinclient_drives /tmp/* /tmp/.* -rpm -e unbound ; rpm -e unbound-libs ; rm -rf /etc/unbound ; rm -rf /var/lib/unbound +rpm -e unbound ; rpm -e unbound-libs ; rm -rf /etc/unbound ; rm -rf /var/lib/unbound /var/lib/unbound/root.key.rpmsave clear echo Turn off this instance and run image backup. sleep 60