Merge branch 'development' into adminPageAsOption

pull/1182/head
Mcat12 7 years ago committed by GitHub
commit ba67144e34

@ -42,14 +42,14 @@ helpFunc() {
::: Usage: pihole -${letter} domain1 [domain2 ...]
:::
::: Options:
::: -d, --delmode Remove domains from the ${word}list
::: -nr, --noreload Update ${word}list without refreshing dnsmasq
::: -q, --quiet output is less verbose
::: -h, --help Show this help dialog
::: -l, --list Display your ${word}listed domains
::: -d, --delmode Remove domains from the ${word}list
::: -nr, --noreload Update ${word}list without refreshing dnsmasq
::: -q, --quiet Output is less verbose
::: -h, --help Show this help dialog
::: -l, --list Display your ${word}listed domains
EOM
if [[ "${letter}" == "b" ]]; then
echo "::: -wild, --wildcard Add whitecard entry (only blacklist)"
echo "::: -wild, --wildcard Add wildcard entry (only blacklist)"
fi
exit 0
}
@ -229,4 +229,3 @@ PoplistFile
if ${reload}; then
Reload
fi

@ -79,8 +79,8 @@ if command -v apt-get &> /dev/null; then
phpVer="php5"
fi
# #########################################
INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git whiptail)
PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils ${iproute_pkg} iputils-ping lsof netcat sudo unzip wget)
INSTALLER_DEPS=(apt-utils debconf dhcpcd5 git ${iproute_pkg} whiptail)
PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget)
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi)
LIGHTTPD_USER="www-data"
LIGHTTPD_GROUP="www-data"
@ -174,11 +174,9 @@ getGitFiles() {
echo ":::"
echo "::: Checking for existing repository..."
if is_repo "${directory}"; then
echo -n "::: Updating repository in ${directory}..."
update_repo "${directory}" || { echo "*** Error: Could not update local repository. Contact support."; exit 1; }
echo " done!"
else
echo -n "::: Cloning ${remoteRepo} into ${directory}..."
make_repo "${directory}" "${remoteRepo}" || { echo "Unable to clone repository, please contact support"; exit 1; }
echo " done!"
fi
@ -726,7 +724,7 @@ enable_service() {
echo " done."
}
update_pacakge_cache() {
update_package_cache() {
#Running apt-get update/upgrade with minimal output can cause some issues with
#requiring user input (e.g password for phpmyadmin see #218)
@ -735,8 +733,11 @@ update_pacakge_cache() {
echo ":::"
echo -n "::: Updating local cache of available packages..."
${UPDATE_PKG_CACHE} &> /dev/null
echo " done!"
if eval ${UPDATE_PKG_CACHE} &> /dev/null; then
echo " done!"
else
echo -n "\n!!! ERROR - Unable to update package cache. Please try \"${UPDATE_PKG_CACHE}\""
fi
}
notify_package_updates_available() {
@ -1203,7 +1204,7 @@ main() {
fi
# Update package cache
update_pacakge_cache
update_package_cache
# Notify user of package availability
notify_package_updates_available

@ -274,19 +274,20 @@ helpFunc() {
::: Add -h after -w (whitelist), -b (blacklist), -c (chronometer), or -a (admin) for more information on usage
:::
::: Options:
::: -w, whitelist Whitelist domains
::: -b, blacklist Blacklist domains
::: -d, debug Start a debugging session if having trouble
::: -f, flush Flush the pihole.log file
::: -t, tail Output the last lines of the pihole.log file. Lines are appended as the file grows
::: -up, updatePihole Update Pi-hole
::: -w, whitelist Whitelist domain(s)
::: -b, blacklist Blacklist domain(s) (exact match)
::: -wild, wildcard Blacklist whole domain(s) (wildcard)
::: -d, debug Start a debugging session
::: -f, flush Flush the 'pihole.log' file
::: -t, tail Output the last lines of the 'pihole.log' file. Lines are appended as the file grows
::: -up, updatePihole Update Pi-hole components
::: -r, reconfigure Reconfigure or Repair Pi-hole
::: -g, updateGravity Update the list of ad-serving domains
::: -c, chronometer Calculates stats and displays to an LCD
::: -h, help Show this help dialog
::: -v, version Show current versions
::: -v, version Show installed versions of Pi-Hole and Web-Admin
::: -q, query Query the adlists for a specific domain
::: Use pihole -q domain -exact if you want to see exact matches only
::: Use 'pihole -q domain -exact' if you want to see exact matches only
::: -l, logging Enable or Disable logging (pass 'on' or 'off')
::: -a, admin Admin webpage options
::: uninstall Uninstall Pi-Hole from your system :(!
@ -294,7 +295,7 @@ helpFunc() {
::: enable Enable Pi-Hole DNS Blocking
::: disable Disable Pi-Hole DNS Blocking
::: Blocking can also be disabled only temporarily, e.g.,
::: pihole disable 5m - will disable blocking for 5 minutes
::: 'pihole disable 5m' - will disable blocking for 5 minutes
::: restartdns Restart dnsmasq
EOM
exit 0

@ -274,6 +274,29 @@ def test_installPiholeWeb_already_populated_no_errors(Pihole):
assert 'index.js' in web_directory
assert 'blockingpage.css' in web_directory
def test_update_package_cache_success_no_errors(Pihole):
''' confirms package cache was updated without any errors'''
updateCache = Pihole.run('''
source /opt/pihole/basic-install.sh
distro_check
update_package_cache
''')
assert 'Updating local cache of available packages...' in updateCache.stdout
assert 'ERROR' not in updateCache.stdout
assert 'done!' in updateCache.stdout
def test_update_package_cache_failure_no_errors(Pihole):
''' confirms package cache was not updated'''
mock_command('apt-get', {'update':('', '1')}, Pihole)
updateCache = Pihole.run('''
source /opt/pihole/basic-install.sh
distro_check
update_package_cache
''')
assert 'Updating local cache of available packages...' in updateCache.stdout
assert 'ERROR' in updateCache.stdout
assert 'done!' not in updateCache.stdout
# Helper functions
def mock_command(script, args, container):
''' Allows for setup of commands we don't really want to have to run for real in unit tests '''

Loading…
Cancel
Save