_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
# Contributors Guide
Please read and understand the contribution guide before creating an issue or pull request.
## Etiquette
- Our goal for Pi-hole is **stability before features**. This means we focus on squashing critical bugs before adding new features. Often, we can do both in tandem, but bugs will take priority over a new feature.
- Pi-hole is open source and [powered by donations](https://pi-hole.net/donate/), and as such, we give our **free time** to build, maintain, and **provide user support** for this project. It would be extremely unfair for us to suffer abuse or anger for our hard work, so please take a moment to consider that.
- Please be considerate towards the developers and other users when raising issues or presenting pull requests.
- Respect our decision(s), and do not be upset or abusive if your submission is not used.
## Viability
When requesting or submitting new features, first consider whether it might be useful to others. Open source projects are used by many people, who may have entirely different needs to your own. Think about whether or not your feature is likely to be used by other users of the project.
## Procedure
**Before filing an issue:**
- Attempt to replicate and **document** the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.
**Before submitting a pull request:**
- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
## Technical Requirements
- Submit Pull Requests to the **development branch only**.
- Before Submitting your Pull Request, merge `development` with your new branch and fix any conflicts. (Make sure you don't break anything in development!)
- Commit Unix line endings.
- (Optional fun) keep to the theme of Star Trek/black holes/gravity.
_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
**In raising this issue, I confirm the following (please check boxes, eg [X]):**
##### Actual Behaviour:
- [ ] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md).
- [ ] The issue I am reporting can be *replicated*
- [ ] The issue I'm reporting isn't a duplicate (see [FAQs](https://github.com/pi-hole/pi-hole/wiki/FAQs), [closed issues](https://github.com/pi-hole/pi-hole/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), and [open issues](https://github.com/pi-hole/pi-hole/issues)).
**How familiar are you with the codebase?:**
##### Steps to reproduce this issue:
- [ ] 1 (very unfamiliar)
- [ ] 2
- [ ] 3
- [ ] 4
- [ ] 5
- [ ] 6
- [ ] 7
- [ ] 8
- [ ] 9
- [ ] 10 (very familiar)
---
**[FEATURE REQUEST | QUESTION | OTHER]:**
_{replace this section with your content or delete if not a FEATURE REQUEST/QUESTION/OTHER}_
**[BUG | ISSUE] Expected Behaviour:**
**[BUG | ISSUE] Actual Behaviour:**
**[BUG | ISSUE] Steps to reproduce:**
-
-
-
-
**(Optional) Debug Log generated by `pihole -d`:**
This is a basic checklist for now, We will update it in the future.
* Fork the repo and create your new branch based on the `development` branch.
* Commit Unix line endings
* If you want, try to keep to the theme of black holes/gravity. This can add some fun to your submission.
* Submit Pull Requests to the development branch only.
* Before Submitting your Pull Request, merge `development` with your new branch and fix any conflicts. (Make sure you don't break anything in development!)
* Be patient. We will review all submitted pull requests, but our focus is on stability.. please don't be offended if we reject your PR, or it appears we're doing nothing with it! We'll get around to it..
echo"No adlists.list file found... using adlists.default!" >> ${DEBUG_LOG}
@ -319,7 +422,7 @@ fi
# Continuously append the pihole.log file to the pihole_debug.log file
function dumpPiHoleLog {
trap'{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT
echo -e "::: Writing current pihole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)"
echo -e "::: Writing current Pi-hole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)"
# 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.)
# - Fourdee: Local ensures the variable is only created, and accessible within this function/void. Generally considered a "good" coding practice for non-global variables.
if ! [["$existing_free_kilobytes"=~ ^([0-9])+$ ]];then
whiptail --title "Unknown free disk space" --yesno "We were unable to determine available free disk space on this system.\n\nYou may override this check and force the installation, however, it is not recommended.\n\nWould you like to continue with the installation?" --defaultno --backtitle "Pi-hole"${r}${c}
localchoice=$?
if(($choice !=0));then
echo"non-integer value from existing_free_kilobytes ($existing_free_kilobytes)"
echo"Unknown free space, user aborted, exiting..."
exit1
fi
echo"::: Unknown free disk space!"
echo"::: We were unable to determine available free disk space on this system."
echo"::: You may override this check and force the installation, however, it is not recommended"
echo"::: To do so, pass the argument '--i_do_not_follow_recommendations' to the install script"
echo"::: Your system appears to be low on disk space. pi-hole recommends a minimum of $required_free_kilobytes KiloBytes."
echo"::: You only have $existing_free_kilobytes KiloBytes free."
echo"::: If this is a new install you may need to expand your disk."
echo"::: Try running 'sudo raspi-config', and choose the 'expand file system option'"
echo"::: After rebooting, run this installation again. (curl -L https://install.pi-hole.net | bash)"
whiptail --msgbox --backtitle "Insufficient Disk Space" --title "Insufficient Disk Space""\nYour system appears to be low on disk space. pi-hole recomends a minimum of $required_free_kilobytes KiloBytes.\nYou only have $existing_free_kilobytes KiloBytes free.\n\nIf this is a new install you may need to expand your disk.\n\nTry running:\n 'sudo raspi-config'\nChoose the 'expand file system option'\n\nAfter rebooting, run this installation again.\n\ncurl -L install.pi-hole.net | bash\n"$r$c
echo"$existing_free_kilobytes is less than $required_free_kilobytes"
echo"Insufficient free space, exiting..."
exit1
@ -188,14 +195,13 @@ chooseInterface() {
# Find out how many interfaces are available to choose from
cmd=(whiptail --separate-output --checklist "Select Protocols (press space to select)"${r}${c} 2)
@ -249,7 +248,7 @@ use4andor6() {
echo"::: Exiting"
exit1
fi
cleanupIPv6
else
echo"::: Cancel selected. Exiting..."
exit1
@ -260,8 +259,6 @@ useIPv6dialog() {
# Show the IPv6 address used for blocking
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " "'{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
whiptail --msgbox --backtitle "IPv6..." --title "IPv6 Supported""$piholeIPv6 will be used to block ads."${r}${c}
${SUDO} touch /etc/pihole/.useIPv6
}
getStaticIPv4Settings(){
@ -273,8 +270,6 @@ getStaticIPv4Settings() {
whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict""It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that.
If you are worried, either manually set the address, or modify the DHCP reservation pool so it does not include the IP you want.
It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address."${r}${c}
#piholeIP is saved to a permanent file so gravity.sh can use it when updating
# Nothing else to do since the variables are already set above
else
# Otherwise, we need to ask the user to input their desired settings.
@ -294,10 +289,6 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
if(whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Are these settings correct?
IP address: $IPv4addr
Gateway: $IPv4gw"${r}${c}); then
# If the settings are correct, then we need to set the piholeIP
# Saving it to a temporary file us to retrieve it later when we run the gravity.sh script. piholeIP is saved to a permanent file so gravity.sh can use it when updating
$SUDOecho"${IPv4addr%/*}" > /etc/pihole/piholeIP
$SUDOecho"$piholeInterface" > /tmp/piholeINT
# After that's done, the loop ends and we move on
ipSettingsCorrect=True
else
@ -358,6 +349,9 @@ setStaticIPv4() {
${SUDO}echo"ONBOOT=yes" >> ${IFCFG_FILE}
${SUDO}echo"IPADDR=$IPADDR" >> ${IFCFG_FILE}
${SUDO}echo"PREFIX=$CIDR" >> ${IFCFG_FILE}
${SUDO}echo"GATEWAY=$IPv4gw" >> ${IFCFG_FILE}
${SUDO}echo"DNS1=$piholeDNS1" >> ${IFCFG_FILE}
${SUDO}echo"DNS2=$piholeDNS2" >> ${IFCFG_FILE}
${SUDO}echo"USERCTL=no" >> ${IFCFG_FILE}
${SUDO} ip addr replace dev "$piholeInterface""$IPv4addr"
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
piholeIP=$(cat ${piholeIPfile})
#rm $piholeIPfile
else
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev"| awk '{print $4}'| awk 'END {print}')
piholeIP=${piholeIPCIDR%/*}
fi
if[[ -f ${piholeIPv6file}]];then
# If the file exists, then the user previously chose to use IPv6 in the automated installer
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " "'{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
fi
#Source the setupVars from install script for the IP
. /etc/pihole/setupVars.conf
#Remove the /* from the end of the IPv4addr.
IPv4addr=${IPv4addr%/*}
# Variables for various stages of downloading and formatting the list
## Nate 3/26/2016 - Commented unused variables
basename=pihole
piholeDir=/etc/${basename}
adList=${piholeDir}/gravity.list
#blacklist=$piholeDir/blacklist.txt
#whitelist=$piholeDir/whitelist.txt
#latentWhitelist=$piholeDir/latentWhitelist.txt
justDomainsExtension=domains
matterandlight=${basename}.0.matterandlight.txt
matterAndLight=${basename}.0.matterandlight.txt
supernova=${basename}.1.supernova.txt
eventHorizon=${basename}.2.eventHorizon.txt
accretionDisc=${basename}.3.accretionDisc.txt
#eyeOfTheNeedle=$basename.4.wormhole.txt
# After setting defaults, check if there's local overrides
if[[ -r ${piholeDir}/pihole.conf ]];then
@ -213,10 +195,10 @@ function gravity_Schwarzchild() {
echo"::: "
# Find all active domains and compile them into one file and remove CRs
echo"::: Error: Unable to determine fully qualified domain name of host"
fi
# If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols
if[[ -n ${piholeIPv6}]];then
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
# Otherwise, just create gravity.list as normal using IPv4
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)