Merge branches 'development' and 'feature/track_pre-installed_packages' of github.com:pi-hole/pi-hole into feature/track_pre-installed_packages

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>

# Conflicts:
#	automated install/basic-install.sh
This commit is contained in:
Dan Schaper 2016-12-27 22:50:00 -08:00
commit b02730a5ad
No known key found for this signature in database
GPG key ID: 572E999E385B7BFC
2 changed files with 25 additions and 11 deletions

View file

@ -216,6 +216,18 @@ SetDNSDomainName(){
} }
SetPrivacyMode(){
# Remove setting from file (create backup setupVars.conf.bak)
sed -i.bak '/API_PRIVACY_MODE/d' /etc/pihole/setupVars.conf
# Save setting to file
if [[ "${args[2]}" == "true" ]] ; then
echo "API_PRIVACY_MODE=true" >> /etc/pihole/setupVars.conf
else
echo "API_PRIVACY_MODE=false" >> /etc/pihole/setupVars.conf
fi
}
ResolutionSettings() { ResolutionSettings() {
typ=${args[2]} typ=${args[2]}
@ -246,6 +258,7 @@ case "${args[1]}" in
"layout" ) SetWebUILayout;; "layout" ) SetWebUILayout;;
"-h" | "--help" ) helpFunc;; "-h" | "--help" ) helpFunc;;
"domainname" ) SetDNSDomainName;; "domainname" ) SetDNSDomainName;;
"privacymode" ) SetPrivacyMode;;
"resolve" ) ResolutionSettings;; "resolve" ) ResolutionSettings;;
* ) helpFunc;; * ) helpFunc;;
esac esac

View file

@ -63,7 +63,7 @@ else
echo ":::" echo ":::"
echo "::: Detecting the presence of the sudo utility for continuation of this install..." echo "::: Detecting the presence of the sudo utility for continuation of this install..."
if [ -x "$(command -v sudo)" ]; then if command -v sudo &> /dev/null; then
echo "::: Utility sudo located." echo "::: Utility sudo located."
exec curl -sSL https://install.pi-hole.net | sudo bash "$@" exec curl -sSL https://install.pi-hole.net | sudo bash "$@"
exit $? exit $?
@ -75,7 +75,7 @@ fi
# Compatibility # Compatibility
if [[ $(command -v apt-get) ]]; then if command -v apt-get &> /dev/null; then
#Debian Family #Debian Family
############################################# #############################################
PKG_MANAGER="apt-get" PKG_MANAGER="apt-get"
@ -97,9 +97,9 @@ if [[ $(command -v apt-get) ]]; then
LIGHTTPD_CFG="lighttpd.conf.debian" LIGHTTPD_CFG="lighttpd.conf.debian"
DNSMASQ_USER="dnsmasq" DNSMASQ_USER="dnsmasq"
elif [ $(command -v rpm) ]; then elif command -v rpm &> /dev/null; then
# Fedora Family # Fedora Family
if [ $(command -v dnf) ]; then if command -v dnf &> /dev/null; then
PKG_MANAGER="dnf" PKG_MANAGER="dnf"
else else
PKG_MANAGER="yum" PKG_MANAGER="yum"
@ -119,6 +119,7 @@ elif [ $(command -v rpm) ]; then
LIGHTTPD_GROUP="lighttpd" LIGHTTPD_GROUP="lighttpd"
LIGHTTPD_CFG="lighttpd.conf.fedora" LIGHTTPD_CFG="lighttpd.conf.fedora"
DNSMASQ_USER="nobody" DNSMASQ_USER="nobody"
else else
echo "OS distribution not supported" echo "OS distribution not supported"
exit exit
@ -413,7 +414,7 @@ setStaticIPv4() {
echo "USERCTL=no" echo "USERCTL=no"
}> "${IFCFG_FILE}" }> "${IFCFG_FILE}"
ip addr replace dev "${PIHOLE_INTERFACE}" "${IPV4_ADDRESS}" ip addr replace dev "${PIHOLE_INTERFACE}" "${IPV4_ADDRESS}"
if [ -x "$(command -v nmcli)" ];then if command -v nmcli &> /dev/null;then
# Tell NetworkManager to read our new sysconfig file # Tell NetworkManager to read our new sysconfig file
nmcli con load "${IFCFG_FILE}" > /dev/null nmcli con load "${IFCFG_FILE}" > /dev/null
fi fi
@ -673,7 +674,7 @@ stop_service() {
# Can softfail, as process may not be installed when this is called # Can softfail, as process may not be installed when this is called
echo ":::" echo ":::"
echo -n "::: Stopping ${1} service..." echo -n "::: Stopping ${1} service..."
if [ -x "$(command -v systemctl)" ]; then if command -v systemctl &> /dev/null; then
systemctl stop "${1}" &> /dev/null || true systemctl stop "${1}" &> /dev/null || true
else else
service "${1}" stop &> /dev/null || true service "${1}" stop &> /dev/null || true
@ -686,7 +687,7 @@ start_service() {
# This should not fail, it's an error if it does # This should not fail, it's an error if it does
echo ":::" echo ":::"
echo -n "::: Starting ${1} service..." echo -n "::: Starting ${1} service..."
if [ -x "$(command -v systemctl)" ]; then if command -v systemctl &> /dev/null; then
systemctl restart "${1}" &> /dev/null systemctl restart "${1}" &> /dev/null
else else
service "${1}" restart &> /dev/null service "${1}" restart &> /dev/null
@ -698,7 +699,7 @@ enable_service() {
# Enable service so that it will start with next reboot # Enable service so that it will start with next reboot
echo ":::" echo ":::"
echo -n "::: Enabling ${1} service to start on reboot..." echo -n "::: Enabling ${1} service to start on reboot..."
if [ -x "$(command -v systemctl)" ]; then if command -v systemctl &> /dev/null; then
systemctl enable "${1}" &> /dev/null systemctl enable "${1}" &> /dev/null
else else
update-rc.d "${1}" defaults &> /dev/null update-rc.d "${1}" defaults &> /dev/null
@ -884,10 +885,10 @@ create_pihole_user() {
configureFirewall() { configureFirewall() {
# Allow HTTP and DNS traffic # Allow HTTP and DNS traffic
if [ -x "$(command -v firewall-cmd)" ]; then if command -v firewall-cmd &> /dev/null; then
firewall-cmd --state &> /dev/null && ( echo "::: Configuring firewalld for httpd and dnsmasq.." && firewall-cmd --permanent --add-port=80/tcp && firewall-cmd --permanent --add-port=53/tcp \ firewall-cmd --state &> /dev/null && ( echo "::: Configuring firewalld for httpd and dnsmasq.." && firewall-cmd --permanent --add-port=80/tcp && firewall-cmd --permanent --add-port=53/tcp \
&& firewall-cmd --permanent --add-port=53/udp && firewall-cmd --reload) || echo "::: FirewallD not enabled" && firewall-cmd --permanent --add-port=53/udp && firewall-cmd --reload) || echo "::: FirewallD not enabled"
elif [ -x "$(command -v iptables)" ]; then elif command -v iptables &> /dev/null; then
echo "::: Configuring iptables for httpd and dnsmasq.." echo "::: Configuring iptables for httpd and dnsmasq.."
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 53 -j ACCEPT iptables -A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
@ -969,7 +970,7 @@ updatePihole() {
checkSelinux() { checkSelinux() {
if [ -x "$(command -v getenforce)" ]; then if command -v getenforce &> /dev/null; then
echo ":::" echo ":::"
echo -n "::: SELinux Support Detected... Mode: " echo -n "::: SELinux Support Detected... Mode: "
enforceMode=$(getenforce) enforceMode=$(getenforce)