From 57931ad8622ea4dd17b36a857acdd74139a09f62 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 14 Oct 2021 07:42:34 -0400 Subject: [PATCH] document and handle dependencies --- README.md | 13 +++++++++---- kaya | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1d918c5..b92f0df 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ GPLv3-or-later ## Installation +Install dependencies: + + apt install pwgen flock apache2-utils + Copy the binaries into place: cp kaya /usr/local/bin/ @@ -29,10 +33,11 @@ Copy the binaries into place: mkdir -p /srv/backups/kaya/ touch /srv/backups/kaya/.htpasswd -**Also** install [rest-server](https://github.com/restic/rest-server) on the -backup host, and [restic](https://github.com/restic/restic) on your backup -targets. Both can be complied into a statically-linked binary, so it's just a -matter of copying the appropriate binaries into the `PATH` of each machine. +**Also** install [rest-server](https://github.com/restic/rest-server) on +the backup host, and [restic](https://github.com/restic/restic) on your +backup targets and backup host. Both can be complied into a +statically-linked binary, so it's just a matter of copying the +appropriate binaries into the `PATH` of each machine. ## Usage diff --git a/kaya b/kaya index 65fba96..a7a1bc3 100755 --- a/kaya +++ b/kaya @@ -126,6 +126,20 @@ EOF } function main() { + local program + local missing_prog + missing_prog=false + for program in flock pwgen; do + if ! type -p $program &>/dev/null; then + echo "kaya: error: install $program (package $program on debian based systems)" + fi + done + if ! type -p htpasswd; then + echo "kaya: error: install htpasswd (package apache2-utils on debian based systems)" + fi + if $missing_prog; then + exit 1 + fi set_defaults get_params "$@" -- 2.25.1