From 77b04805c6aa5310afa9b8f968d5b90dbb7d9b5b Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Wed, 25 Jan 2023 05:03:11 +0000 Subject: [PATCH] Update file run_before_01-add-temporary-includes.tmpl --- .../run_before_01-add-temporary-includes.tmpl | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl b/home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl index 25fd7a86..e8dbeaad 100644 --- a/home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl +++ b/home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl @@ -2,21 +2,25 @@ #!/usr/bin/env bash ### Ensure /tmp/tmp-profile is created and owned by root -# Add pre-scaffolding profile to /tmp/tmp-profile so it's easier to navigate through scripts -cat << EOF > /tmp/tmp-profile -{{ includeTemplate "universal/profile-inline" }} -EOF +if [ ! -f /tmp/tmp-profile ]; then + # Add pre-scaffolding profile to /tmp/tmp-profile so it's easier to navigate through scripts + cat << 'EOF' > /tmp/tmp-profile + {{ includeTemplate "universal/profile-inline" }} + EOF -# Make /tmp/tmp-profile owned by root to prevent tampering -sudo chown root /tmp/tmp-profile + # Make /tmp/tmp-profile owned by root to prevent tampering + sudo chown root /tmp/tmp-profile +fi ### Ensure /tmp/tmp-logg is created and owned by root -# Add pre-scaffolding /tmp/tmp-logg -cat << EOF > /tmp/tmp-logg -{{ includeTemplate "universal/logg-inline" }} -EOF +if [ ! -f /tmp/tmp-logg ]; then + # Add pre-scaffolding /tmp/tmp-logg + cat << 'EOF' > /tmp/tmp-logg + {{ includeTemplate "universal/logg-inline" }} + EOF -# Make /tmp/tmp-logg owned by root to prevent tampering -sudo chown root /tmp/tmp-logg + # Make /tmp/tmp-logg owned by root to prevent tampering + sudo chown root /tmp/tmp-logg +fi {{ end -}}