From 386eeaf404be1d22a9982c9bbbdd45c7ee88eac7 Mon Sep 17 00:00:00 2001 From: Martin Puppe Date: Thu, 18 Jan 2024 15:43:25 +0100 Subject: [PATCH] Ensure that script never operates with empty basedir --- README.markdown | 2 +- secrets | 7 ++++++- shell.nix | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 086d1cd..267c9b9 100644 --- a/README.markdown +++ b/README.markdown @@ -101,7 +101,7 @@ If a file is specified as a string "path/to/file", this is equivalent to ## Copyright -Copyright 2020 Martin Puppe +Copyright 2020-2024 Martin Puppe This file is part of Secrets. diff --git a/secrets b/secrets index 33fb326..ef6bc17 100755 --- a/secrets +++ b/secrets @@ -2,7 +2,7 @@ #lang racket #| - Copyright 2020 Martin Puppe + Copyright 2020-2024 Martin Puppe This file is part of Secrets. @@ -90,6 +90,11 @@ rm "$0" echo "!*data" >&2 read basedir + +# exit if $basedir is an empty string +test -z "$basedir" && exit 1 + +# create $basedif if it does not exist if test ! -d "$basedir"; then install -o root -g root -m 755 -d "$basedir" fi diff --git a/shell.nix b/shell.nix index b8d6af4..1ac4232 100644 --- a/shell.nix +++ b/shell.nix @@ -1,5 +1,5 @@ /* - Copyright 2020 Martin Puppe + Copyright 2020-2024 Martin Puppe This file is part of Secrets.