From 63c14b28111f415cba2a0ecebc367e6f77818b8c Mon Sep 17 00:00:00 2001 From: Eduard T Date: Sun, 9 Jun 2024 14:09:55 -0500 Subject: [PATCH] Add more informative message in case that paclog is not found. Add version. --- pkgrecover.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgrecover.sh b/pkgrecover.sh index e4caef9..a7f8f5d 100644 --- a/pkgrecover.sh +++ b/pkgrecover.sh @@ -1,5 +1,6 @@ #!/usr/bin/bash +VERSION="1.0.0" USE_PACMAN_STATIC=${USE_PACMAN_STATIC:-"false"} install_pacman_static() { @@ -26,7 +27,7 @@ check_dependencies() { fi if [[ "$1" == "paclog" ]] && ! command -v paclog &>/dev/null; then - echo "paclog is not installed." + echo "paclog is not installed. Use the --pacman-db option instead or install the pacutils package." exit 1 fi } @@ -135,16 +136,18 @@ using_paclog() { } usage() { + echo "$0 v$VERSION" echo "Usage: [ENVIRONMENT] $0 [OPTIONS]" echo "ENVIRONMENT:" - echo " USE_PACMAN_STATIC=true $0 [OPTIONS] Use pacman-static instead of the default pacman. Useful in cases that pacman is broken. Default is false." + echo "USE_PACMAN_STATIC=true $0 [OPTIONS] Use pacman-static instead of the default pacman. Useful in cases that pacman is broken. Default is false." echo "Options:" echo " --pacman-db \"\" [--dry-run] Reinstall packages upgraded after the given date using pacman database. Please quote the date in the format 'YYYY-MM-DD HH:MM:SS'" echo " --paclog \"\" [--no-db] [--dry-run] Reinstall packages upgraded after the given date using pacman log. Please quote the date in the format 'YYYY-MM-DD HH:MM:SS'" exit 1 } -if [[ $# -eq 0 ]]; then +# Check that we have at least 2 arguments +if [[ $# -le 1 ]]; then usage fi