IS_BACKPORTSCONF: Quiet grep and better readability

Added `-s` to grep to not have error messages like:
`grep: /etc/apt/preferences.d/*: No such file or directory`
And don't use `2>/dev/null` as there is `-s` grep option!

Added if condition for better readability of the code.
This commit is contained in:
Benoît S. 2019-02-12 12:38:11 +01:00
parent a9d26a49b4
commit 1aad813663

View file

@ -607,8 +607,12 @@ if [ -e /etc/debian_version ]; then
if [ "$IS_BACKPORTSCONF" = 1 ]; then
if is_debianversion stretch; then
grep -qE "^[^#].*backports" /etc/apt/sources.list && echo 'IS_BACKPORTSCONF FAILED!'
grep -qE "^[^#].*backports" /etc/apt/sources.list.d/*.list 2>/dev/null && (grep -qE "^[^#].*backports" /etc/apt/preferences.d/* || echo 'IS_BACKPORTSCONF FAILED!')
grep -qsE "^[^#].*backports" /etc/apt/sources.list \
&& echo 'IS_BACKPORTSCONF FAILED!'
if grep -qsE "^[^#].*backports" /etc/apt/sources.list.d/*.list; then
grep -qsE "^[^#].*backports" /etc/apt/preferences.d/* \
|| echo 'IS_BACKPORTSCONF FAILED!'
fi
fi
fi