aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-01-15 23:42:04 +0000
committerEgor Tensin <Egor.Tensin@gmail.com>2017-01-15 23:42:04 +0000
commit6c823773fcf0589bb821a68b10a9332f116efd5d (patch)
treeb32520051a129d0d6d9740d291f50e9ec0c2cc17
parentadd list_initial_packages_ubuntu (diff)
downloadlinux-home-6c823773fcf0589bb821a68b10a9332f116efd5d.tar.gz
linux-home-6c823773fcf0589bb821a68b10a9332f116efd5d.zip
os.sh: add corresponding functions for Arch Linux
-rw-r--r--%HOME%/.bash_utils/os.sh41
1 files changed, 32 insertions, 9 deletions
diff --git a/%HOME%/.bash_utils/os.sh b/%HOME%/.bash_utils/os.sh
index 5a49479..5f4f181 100644
--- a/%HOME%/.bash_utils/os.sh
+++ b/%HOME%/.bash_utils/os.sh
@@ -29,6 +29,18 @@ is_ubuntu() {
test "$_os" == 'Ubuntu'
}
+is_arch() {
+ test "$_os" == 'Arch Linux'
+}
+
+list_packages_cygwin() (
+ set -o errexit -o nounset -o pipefail
+
+ cygcheck --check-setup --dump-only \
+ | tail -n +3 \
+ | cut -d ' ' -f 1
+)
+
list_initial_packages_ubuntu() (
set -o errexit -o nounset -o pipefail
local -r initial_status='/var/log/installer/initial-status.gz'
@@ -45,14 +57,6 @@ list_manually_installed_packages_ubuntu() (
<( list_initial_packages_ubuntu )
)
-list_packages_cygwin() (
- set -o errexit -o nounset -o pipefail
-
- cygcheck --check-setup --dump-only \
- | tail -n +3 \
- | cut -d ' ' -f 1
-)
-
list_packages_ubuntu() (
set -o errexit -o nounset -o pipefail
@@ -62,6 +66,22 @@ list_packages_ubuntu() (
| cut -d ':' -f 1
)
+list_initial_packages_arch() (
+ set -o errexit -o nounset -o pipefail
+ local -ra groups=(base base-devel)
+ pacman -Q --groups -q -- ${groups[@]+"${groups[@]}"} | sort
+)
+
+list_manually_installed_packages_arch() (
+ set -o errexit -o nounset -o pipefail
+ comm -23 <( pacman -Q --explicit -q | sort ) \
+ <( list_initial_packages_arch )
+)
+
+list_packages_arch() {
+ pacman -Qq
+}
+
list_packages() (
set -o errexit -o nounset -o pipefail
@@ -69,6 +89,9 @@ list_packages() (
list_packages_cygwin
elif is_ubuntu; then
list_packages_ubuntu
+ elif is_arch; then
+ list_packages_arch
+ else
+ return 1
fi
- return 1
)