diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/init | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/init b/common/init index 1ea1603..63a72fa 100644 --- a/common/init +++ b/common/init @@ -10,13 +10,17 @@ trap "cleanup; remove_self" EXIT cleanup() { rm "$replacement_file" } +avoid_cleanup="false" remove_self() { - rm "$(realpath "$0")" - rm "$(realpath "$(dirname "$0")")/shell_line_editor.sh" + if [ "$avoid_cleanup" = "false" ]; then + rm "$(realpath "$0")" + rm "$(realpath "$(dirname "$0")")/shell_line_editor.sh" + fi } require() { program="$1" if ! command -v "$program" >/dev/null; then + avoid_cleanup="true" echo "Please install '$program' for this init script to work." 1>&2 exit 1 fi |