From 6ae9ec555a75656ccabe280a39fbd1fc1aa53f04 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 25 Jul 2020 10:21:29 +0200 Subject: [PATCH] Add dependency warning for packages installs --- dotfiles.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index 330b863..5e37fe0 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Manages dotfiles and packages +# Depends: pacman-contrib + # User-config--------------------------- # File which holds all installed packages @@ -28,7 +31,7 @@ help() { cat << EOF ${B}NAME${N} - dotfiles - file copy script for the dotfiles repository + dotfiles - manages dotfiles and packages ${B}SYNOPSIS${N} ${B}./dotfiles.sh${N} ${U}OPTION${N} [${U}ARG${N}] @@ -113,7 +116,7 @@ pull_push() { # cp /home// /[/]dotfiles/ cp -a "$HOME/$f" "$(pwd)/$f" elif [ "$1" = "push" ]; then - mkdir -p "$(dirname $HOME/$f)" + mkdir -p "$(dirname "$HOME/$f")" cp -a "$(pwd)/$f" "$HOME/$f" fi done @@ -141,7 +144,12 @@ push() { } packages() { - FILTER_LIST="$((pacman -Qqg base base-devel; pactree -u base | tail -n +2) | sort)" + if ! pacman -Qqs pacman-contrib > /dev/null; then \ + echo 'Please install the "pacman-contrib" dependency before running this option.' + exit 1 + fi + + FILTER_LIST="$( (pacman -Qqg base base-devel; pactree -u base | tail -n +2) | sort)" PACKAGE_LIST="$(pacman -Qqe | grep -vx "$FILTER_LIST" | sort)" if [ "$1" = "list" ] || [ "$1" = "" ]; then