From a95b8a10ade821fc722e400c2040b4495bfa357f Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 31 Jul 2022 23:30:21 -0400 Subject: [PATCH] REF combine runtime dep listing into one script --- scripts/.query_pkgs | 22 ---------------------- scripts/aur_deps | 14 -------------- scripts/pacman_deps | 18 ------------------ scripts/runtime_deps | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 54 deletions(-) delete mode 100755 scripts/.query_pkgs delete mode 100755 scripts/aur_deps delete mode 100755 scripts/pacman_deps create mode 100755 scripts/runtime_deps diff --git a/scripts/.query_pkgs b/scripts/.query_pkgs deleted file mode 100755 index 769b864..0000000 --- a/scripts/.query_pkgs +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Query the current xmonad configuration for packages to install - -# usage: .query_pkgs "Official"|"AUR" - -query='.[].success | -objects | -.root.tree | -..|.left?.data, ..|.right?.data, .data? | -select(. != null) | -.fulfillment | -select(. != null) | -add | select(. != null)' - -jq_type () { - echo "$1" | jq --raw-output "select(.type==\"$2\") | .name" | sort | uniq -} - -raw=$(xmonad --deps | jq "$query") - -jq_type "$raw" "$1" diff --git a/scripts/aur_deps b/scripts/aur_deps deleted file mode 100755 index 581d27f..0000000 --- a/scripts/aur_deps +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# Print list of packages to be installed via yay - -this_dir=$(dirname "$0") - -mapfile -t local < <("$this_dir/.query_pkgs" "AUR") - -if ! yay -Si "${local[@]}" > /dev/null; then - echo "At least one local package doesn't exist." - exit 1 -fi - -echo "${local[@]}" diff --git a/scripts/pacman_deps b/scripts/pacman_deps deleted file mode 100755 index 3f49869..0000000 --- a/scripts/pacman_deps +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Print list of packages to be installed via pacman - -# these are extra packages that pertain to processes outside xmonad but are -# still required/desired to make it work correctly -xmonad_pkgs=(xorg-xinit autorandr picom) - -this_dir=$(dirname "$0") - -mapfile -t official < <("$this_dir/.query_pkgs" "Official") - -if ! pacman -Si "${official[@]}" > /dev/null; then - echo "At least one official package doesn't exist." - exit 1 -fi - -echo "${xmonad_pkgs[@]}" "${official[@]}" diff --git a/scripts/runtime_deps b/scripts/runtime_deps new file mode 100755 index 0000000..ae61a79 --- /dev/null +++ b/scripts/runtime_deps @@ -0,0 +1,39 @@ +#!/bin/bash + +# Print list of packages to be installed via pacman + +query='.[].success | +objects | +.root.tree | +..|.left?.data, ..|.right?.data, .data? | +select(. != null) | +.fulfillment | +select(. != null) | +add | select(. != null)' + +jq_type () { + echo "$1" | jq --raw-output "select(.type==\"$2\") | .name" | sort | uniq +} + +raw=$(xmonad --deps | jq "$query") + +jq_type "$raw" "$1" + +# these are extra packages that pertain to processes outside xmonad but are +# still required/desired to make it work correctly +xmonad_pkgs=(xorg-xinit autorandr picom) + +mapfile -t official < <(jq_type "$raw" "Official") +mapfile -t local < <(jq_type "$raw" "AUR") + +if ! pacman -Si "${official[@]}" > /dev/null; then + echo "At least one official package doesn't exist." + exit 1 +fi + +if ! yay -Si "${local[@]}" > /dev/null; then + echo "At least one local package doesn't exist." + exit 1 +fi + +echo "${xmonad_pkgs[@]}" "${official[@]}" "${local[@]}" | tr ' ' '\n'