always overwrite default blockpage, so that changes can be rolled out

Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
Adam Warner 2017-09-09 19:07:48 +01:00
parent 17be6b860e
commit 6c605f55f9
No known key found for this signature in database
GPG key ID: 03843F6C65554B22

View file

@ -1293,68 +1293,27 @@ CreateLogFile() {
installPiholeWeb() { installPiholeWeb() {
echo "" echo ""
echo " ${INFO} Installing blocking page..." echo " ${INFO} Installing blocking page..."
# If the pihole Web directory exists,
if [[ -d "/var/www/html/pihole" ]]; then
local str="Installing index.php"
echo -ne " ${INFO} ${str}..."
# and if the index file exists,
if [[ -f "/var/www/html/pihole/index.php" ]]; then
# do not overwrite it,
echo -e " ${COL_LIGHT_GREEN}detected index.php, not overwriting${COL_NC}"
# if it doesn't exist
else
# install it by copying it from the repo
cp ${PI_HOLE_LOCAL_REPO}/advanced/index.php /var/www/html/pihole/
echo -e "${OVER} ${TICK} ${str}"
fi
local str="Installing index.js" local str="Creating directory for blocking page, and copying files"
echo -ne " ${INFO} ${str}..." echo -ne " ${INFO} ${str}..."
# and if the index file exists, # Install the directory
if [[ -f "/var/www/html/pihole/index.js" ]]; then install -d /var/www/html/pihole
# do not overwrite it, # and the blockpage
echo -e " ${COL_LIGHT_GREEN}detected index.js, not overwriting${COL_NC}" install -D ${PI_HOLE_LOCAL_REPO}/advanced/{index,blockingpage}.* /var/www/html/pihole/
else echo -e "${OVER} ${TICK} ${str}"
# install it by copying it from the repo
cp ${PI_HOLE_LOCAL_REPO}/advanced/index.js /var/www/html/pihole/
echo -e "${OVER} ${TICK} ${str}"
fi
local str="Installing blockingpage.css" local str="Backing up index.lighttpd.html"
echo -ne " ${INFO} ${str}..." echo -ne " ${INFO} ${str}..."
# and if the index file exists, # If the default index file exists,
if [[ -f "/var/www/html/pihole/blockingpage.css" ]]; then if [[ -f "/var/www/html/index.lighttpd.html" ]]; then
# do not overwrite it, # back it up
echo -e " ${COL_LIGHT_GREEN}detected blockingpage.css, not overwriting${COL_NC}" mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
else
# install it by copying it from the repo
cp ${PI_HOLE_LOCAL_REPO}/advanced/blockingpage.css /var/www/html/pihole
echo -e "${OVER} ${TICK} ${str}"
fi
# If the pihole Web directory does not exist,
else
local str="Creating directory for blocking page, and copying files"
echo -ne " ${INFO} ${str}..."
# Install the directory
install -d /var/www/html/pihole
# and the blockpage
install -D ${PI_HOLE_LOCAL_REPO}/advanced/{index,blockingpage}.* /var/www/html/pihole/
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${TICK} ${str}"
# Othwerwise,
local str="Backing up index.lighttpd.html" else
echo -ne " ${INFO} ${str}..." # don't do anything
# If the default index file exists, echo -e "${OVER} ${CROSS} ${str}
if [[ -f "/var/www/html/index.lighttpd.html" ]]; then No default index.lighttpd.html file found... not backing up"
# back it up
mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
echo -e "${OVER} ${TICK} ${str}"
# Othwerwise,
else
# don't do anything
echo -e "${OVER} ${CROSS} ${str}
No default index.lighttpd.html file found... not backing up"
fi
fi fi
# Install Sudoers file # Install Sudoers file