Skip to content
Snippets Groups Projects

fix: restore foris config from snapshots

Merged Karel Koci requested to merge hotfix/fix-config-foris-restore into master
1 unresolved thread
@@ -4,12 +4,12 @@ set -eu
config="/etc/config/foris"
if [ ! -s "$config" ]; then
schnapps list | awk 'NR > 2 { print $1 }' | sort -rn | \
while read -r snapshot; do
schnapps list | awk 'NR > 2 { print $1 }' | sort -rn \
| while read -r snapshot; do
schnapps mount "$snapshot" >/dev/null
mntp="/mnt/snapshot-@$snapshot"
if [ -s "$mntp$config" ]; then
cp -a "$mntp$config" "$config"
if [ -s "${mntp}${config}" ]; then
cp -a "${mntp}${config}" "$config"
umount "$mntp"
exit 0
fi