Added fixed init script to not clobber existing files
This commit is contained in:
parent
de1dabd9ba
commit
bdf5ca5683
1 changed files with 10 additions and 3 deletions
13
init.sh
13
init.sh
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue