aboutsummaryrefslogtreecommitdiff
path: root/aux
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-07-07 22:00:35 -0300
committerEuAndreh <eu@euandre.org>2021-07-07 22:01:16 -0300
commitded158891da92c8e402b408e934a49e5b00b5490 (patch)
tree23b7a1de491834200dc2ec283d4a7fb1a5fe90e2 /aux
parentPut pofiles under po/, use one folder for each translated file. (diff)
downloadgit-permalink-ded158891da92c8e402b408e934a49e5b00b5490.tar.gz
git-permalink-ded158891da92c8e402b408e934a49e5b00b5490.tar.xz
aux/workflow/installcheck.sh: Add, call it from Makefile
Implements #task-0b034315-cbd2-6fd6-fd32-9e00a12b7594.
Diffstat (limited to 'aux')
-rwxr-xr-xaux/workflow/installcheck.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/aux/workflow/installcheck.sh b/aux/workflow/installcheck.sh
new file mode 100755
index 0000000..e28f5d1
--- /dev/null
+++ b/aux/workflow/installcheck.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+set -eu
+
+while getopts 'p:x:l:f:u' flag; do
+ case "$flag" in
+ p)
+ PREFIX="$OPTARG"
+ ;;
+ x)
+ EXECUTABLES_EXPECTED="$OPTARG"
+ ;;
+ l)
+ SYMLINKS_EXPECTED="$OPTARG"
+ ;;
+ f)
+ FILES_EXPECTED="$OPTARG"
+ ;;
+ u)
+ UNINSTALL=1
+ ;;
+ *)
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+
+if [ -n "${UNINSTALL:-}" ]; then
+ if [ "$(find "$PREFIX" -type f | wc -l)" != 0 ]; then
+ printf 'When uninstalling, left over files in the PREFIX directory:\n'
+ find "$PREFIX" -type f
+ exit 1
+ fi
+ exit
+fi
+
+EXECUTABLES_ACTUAL="$(find "$PREFIX" -type f -perm -a=x | wc -l)"
+if [ "${EXECUTABLES_EXPECTED:-0}" != "$EXECUTABLES_ACTUAL" ]; then
+ printf 'Expected %s executables, found %s:\n' \
+ "$EXECUTABLES_EXPECTED" "$EXECUTABLES_ACTUAL" >&2
+ find "$PREFIX" -type f -perm -a=x
+ exit 1
+fi
+
+SYMLINKS_ACTUAL="$(find "$PREFIX" -type l | wc -l)"
+if [ "${SYMLINKS_EXPECTED:-0}" != "$SYMLINKS_ACTUAL" ]; then
+ printf 'Expected %s symlinks, found %s:\n' \
+ "$SYMLINKS_EXPECTED" "$SYMLINKS_ACTUAL" >&2
+ find "$PREFIX" -type l
+ exit 1
+fi
+
+FILES_ACTUAL="$(find "$PREFIX" -type f | wc -l)"
+if [ "${FILES_EXPECTED:-0}" != "$FILES_ACTUAL" ]; then
+ printf 'Expected %s files, found %s:\n' \
+ "$FILES_EXPECTED" "$FILES_ACTUAL" >&2
+ find "$PREFIX" -type f
+ exit 1
+fi