mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Merge pull request #225 from jacobsalmela/bugfix/createPiholeDir
Bugfix/create pihole dir
This commit is contained in:
commit
0b03264fb0
2 changed files with 22 additions and 6 deletions
|
@ -172,7 +172,6 @@ useIPv6dialog()
|
||||||
{
|
{
|
||||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
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
|
whiptail --msgbox --backtitle "IPv6..." --title "IPv6 Supported" "$piholeIPv6 will be used to block ads." $r $c
|
||||||
$SUDO mkdir -p /etc/pihole/
|
|
||||||
$SUDO touch /etc/pihole/.useIPv6
|
$SUDO touch /etc/pihole/.useIPv6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +372,7 @@ installPihole()
|
||||||
{
|
{
|
||||||
installDependencies
|
installDependencies
|
||||||
stopServices
|
stopServices
|
||||||
|
$SUDO mkdir -p /etc/pihole/
|
||||||
$SUDO chown www-data:www-data /var/www/html
|
$SUDO chown www-data:www-data /var/www/html
|
||||||
$SUDO chmod 775 /var/www/html
|
$SUDO chmod 775 /var/www/html
|
||||||
$SUDO usermod -a -G www-data pi
|
$SUDO usermod -a -G www-data pi
|
||||||
|
|
24
gravity.sh
24
gravity.sh
|
@ -10,8 +10,24 @@
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# Run this script as root or under sudo
|
||||||
|
if [[ $EUID -eq 0 ]];then
|
||||||
|
echo "You are root."
|
||||||
|
else
|
||||||
|
echo "::: sudo will be used."
|
||||||
|
# Check if it is actually installed
|
||||||
|
# If it isn't, exit because the install cannot complete
|
||||||
|
if [[ $(dpkg-query -s sudo) ]];then
|
||||||
|
export SUDO="sudo"
|
||||||
|
else
|
||||||
|
echo "::: Please install sudo or run this script as root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
piholeIPfile=/tmp/piholeIP
|
piholeIPfile=/tmp/piholeIP
|
||||||
piholeIPv6file=/etc/pihole/.useIPv6
|
piholeIPv6file=/etc/pihole/.useIPv6
|
||||||
|
|
||||||
if [[ -f $piholeIPfile ]];then
|
if [[ -f $piholeIPfile ]];then
|
||||||
# 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
|
# 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)
|
piholeIP=$(cat $piholeIPfile)
|
||||||
|
@ -70,8 +86,8 @@ function gravity_collapse() {
|
||||||
# Temporary hack to allow non-root access to pihole directory
|
# Temporary hack to allow non-root access to pihole directory
|
||||||
# Will update later, needed for existing installs, new installs should
|
# Will update later, needed for existing installs, new installs should
|
||||||
# create this directory as non-root
|
# create this directory as non-root
|
||||||
sudo chmod 777 $piholeDir
|
$SUDO chmod 777 $piholeDir
|
||||||
find "$piholeDir" -type f -exec sudo chmod 666 {} \;
|
find "$piholeDir" -type f -exec $SUDO chmod 666 {} \;
|
||||||
else
|
else
|
||||||
echo "** Creating pihole directory..."
|
echo "** Creating pihole directory..."
|
||||||
mkdir $piholeDir
|
mkdir $piholeDir
|
||||||
|
@ -247,10 +263,10 @@ function gravity_reload() {
|
||||||
|
|
||||||
if [[ $dnsmasqPid ]]; then
|
if [[ $dnsmasqPid ]]; then
|
||||||
# service already running - reload config
|
# service already running - reload config
|
||||||
sudo kill -HUP $dnsmasqPid
|
$SUDO kill -HUP $dnsmasqPid
|
||||||
else
|
else
|
||||||
# service not running, start it up
|
# service not running, start it up
|
||||||
sudo service dnsmasq start
|
$SUDO service dnsmasq start
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue