Added fixed init script to not clobber existing files

This commit is contained in:
Eric Renfro 2023-12-03 12:31:01 -05:00
parent de1dabd9ba
commit bdf5ca5683
Signed by: psi-jack
GPG key ID: 14977F3A50D9A5BF

13
init.sh
View file

@ -2,6 +2,13 @@
scriptPath="$(dirname "$(readlink -f "$0")")" scriptPath="$(dirname "$(readlink -f "$0")")"
cp "$scriptPath/templates/profiles.toml" "$scriptPath/profiles.toml" if [[ ! -f "${scriptPath}/profiles.toml" ]]; then
cp "$scriptPath/templates/excludes" "$scriptPath/excludes" cp "${scriptPath}/templates/profiles.toml" "${scriptPath}/profiles.toml"
resticprofile generate --random-key > "$scriptPath/key" fi
if [[ ! -f "${scriptPath}/excludes" ]]; then
cp "${scriptPath}/templates/excludes" "${scriptPath}/excludes"
fi
if [[ ! -f "${scriptPath}/key" ]]; then
resticprofile generate --random-key > "${scriptPath}/key"
fi
chmod go-rwx "${scriptPath}/key "${scriptPath}/profiles.toml" "${scriptPath}/excludes"