-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prevent creation of clones after reverting to previous snap revi…
…sion
- Loading branch information
Showing
3 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh -e | ||
|
||
# This hook migrates the client's data from $SNAP_DATA to $SNAP_COMMON. | ||
# It will be kept until all the existing | ||
# clients are migrated to $SNAP_COMMON (using this hook). | ||
# Full bug report: https://bugs.launchpad.net/landscape-client/+bug/2082616 | ||
|
||
OLD_DIR="$SNAP_DATA/var/lib/landscape/client" | ||
NEW_DIR="$SNAP_COMMON/var/lib/landscape/client" | ||
|
||
# Is a migration needed? We check if: | ||
# 1. $OLD_DIR exists | ||
# 2. And that we've not already done the migration | ||
if [ -d "$OLD_DIR" ] && [ ! -f "$NEW_DIR/.migrated" ]; then | ||
# Copy files while preserving attributes, links, etc | ||
cp -a "$OLD_DIR/." "$NEW_DIR/" | ||
|
||
# Flush file system buffers, ensuring all pending writes are completed | ||
sync | ||
|
||
# Add migration completion marker | ||
touch "$NEW_DIR/.migrated" | ||
|
||
# Remove the old directory | ||
rm -rf "$OLD_DIR" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters