aboutsummaryrefslogtreecommitdiffstats
path: root/bin/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pkgs')
-rwxr-xr-xbin/pkgs17
1 files changed, 16 insertions, 1 deletions
diff --git a/bin/pkgs b/bin/pkgs
index e8281b3..253ca91 100755
--- a/bin/pkgs
+++ b/bin/pkgs
@@ -33,7 +33,18 @@ declare -A package_dirs=(
["extra"]="${package_dir_base}extra"
)
-# TODO: check whether git and subversion are installed
+check_dependencies() {
+ # check whether required commands are installed
+ local _commands=('svn' 'git')
+ local _command
+
+ for _command in "${_commands[@]}"; do
+ if ! command -v s > /dev/null; then
+ printf "The required command %s can not be found. Exiting...\n" "$_command"
+ exit 1
+ fi
+ done
+}
create_tmp_packagelist() {
local list_file=""
@@ -247,6 +258,7 @@ case "${mode}" in
echo "A package must be defined for adding a package."
exit 1
else
+ check_dependencies
add_package "$package"
[ $new_package -gt 0 ] && create_package "$package"
fi
@@ -260,10 +272,12 @@ case "${mode}" in
echo "A package must be defined for removing a package."
exit 1
else
+ check_dependencies
remove_package "$package"
fi
;;
update)
+ check_dependencies
if [ -z "$repo" ];then
for list in aur community core extra; do
if [ -f "${package_lists[$list]}" ]; then
@@ -289,6 +303,7 @@ case "${mode}" in
fi
;;
clean)
+ check_dependencies
if [ -z "$repo" ]; then
for list in aur community core extra; do
repo="$list"