From 9e718bbefb7183736bb1b39b4ab897116e9cf5f3 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 1 Dec 2016 02:51:47 +0300 Subject: list_packages: factor out distr-specific variants --- %HOME%/.bashrc | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to '%HOME%') diff --git a/%HOME%/.bashrc b/%HOME%/.bashrc index 730a7ea..d6eb5a6 100644 --- a/%HOME%/.bashrc +++ b/%HOME%/.bashrc @@ -62,18 +62,31 @@ alias tree='tree -a' alias cls='echo -en "\ec"' +list_packages_cygwin() ( + set -o errexit -o nounset -o pipefail + + cygcheck --check-setup --dump-only \ + | cut -d ' ' -f 1 +) + +list_packages_ubuntu() ( + set -o errexit -o nounset -o pipefail + + dpkg --get-selections \ + | grep --invert-match -- 'deinstall$' \ + | cut -f 1 \ + | cut -d ':' -f 1 +) + list_packages() ( set -o errexit -o nounset -o pipefail if is_cygwin; then - cygcheck --check-setup --dump-only \ - | cut -d ' ' -f 1 + list_packages_cygwin elif is_ubuntu; then - dpkg --get-selections \ - | grep --invert-match -- 'deinstall$' \ - | cut -f 1 \ - | cut -d ':' -f 1 + list_packages_ubuntu fi + return 1 ) [ -r "$HOME/.bash_utils/cxx.sh" ] && source "$HOME/.bash_utils/cxx.sh" -- cgit v1.2.3