mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-09 00:50:23 +00:00
Only change the recommendation to use apt
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
d9f8d9abb1
commit
fdb2923f65
2 changed files with 9 additions and 9 deletions
|
@ -266,13 +266,8 @@ if is_command apt-get ; then
|
||||||
# Set some global variables here
|
# Set some global variables here
|
||||||
# We don't set them earlier since the installed package manager might be rpm, so these values would be different
|
# We don't set them earlier since the installed package manager might be rpm, so these values would be different
|
||||||
PKG_MANAGER="apt-get"
|
PKG_MANAGER="apt-get"
|
||||||
# A variable to store the command used to update the package cache. If apt is available use this as we have seen it
|
# A variable to store the command used to update the package cache
|
||||||
# gives more user-friendly (interactive) advice, else fall-back to apt-get
|
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
||||||
if is_command apt ; then
|
|
||||||
UPDATE_PKG_CACHE="apt update"
|
|
||||||
else
|
|
||||||
UPDATE_PKG_CACHE="${PKG_MANAGER} update"
|
|
||||||
fi
|
|
||||||
# The command we will use to actually install packages
|
# The command we will use to actually install packages
|
||||||
PKG_INSTALL=("${PKG_MANAGER}" -qq --no-install-recommends install)
|
PKG_INSTALL=("${PKG_MANAGER}" -qq --no-install-recommends install)
|
||||||
# grep -c will return 1 if there are no matches. This is an acceptable condition, so we OR TRUE to prevent set -e exiting the script.
|
# grep -c will return 1 if there are no matches. This is an acceptable condition, so we OR TRUE to prevent set -e exiting the script.
|
||||||
|
@ -1486,8 +1481,14 @@ update_package_cache() {
|
||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
else
|
else
|
||||||
# Otherwise, show an error and exit
|
# Otherwise, show an error and exit
|
||||||
|
|
||||||
|
# In case we used apt-get and apt is also available, we use this as recommendation as we have seen it
|
||||||
|
# gives more user-friendly (interactive) advice
|
||||||
|
if [[ ${PKG_MANAGER} == "apt-get" ]] && is_command apt ; then
|
||||||
|
UPDATE_PKG_CACHE="apt update"
|
||||||
|
fi
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
printf " %bError: Unable to update package cache. Please try \"%s\"%b" "${COL_LIGHT_RED}" "sudo ${UPDATE_PKG_CACHE}" "${COL_NC}"
|
printf " %bError: Unable to update package cache. Please try \"%s\"%b\\n" "${COL_LIGHT_RED}" "sudo ${UPDATE_PKG_CACHE}" "${COL_NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,6 @@ def test_update_package_cache_failure_no_errors(Pihole):
|
||||||
'''
|
'''
|
||||||
confirms package cache was not updated
|
confirms package cache was not updated
|
||||||
'''
|
'''
|
||||||
mock_command('apt', {'update': ('', '1')}, Pihole)
|
|
||||||
mock_command('apt-get', {'update': ('', '1')}, Pihole)
|
mock_command('apt-get', {'update': ('', '1')}, Pihole)
|
||||||
updateCache = Pihole.run('''
|
updateCache = Pihole.run('''
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
|
|
Loading…
Add table
Reference in a new issue