1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Do not overwrites persistent Docker volumes. Fixes #2358.

This commit is contained in:
grossmj 2017-12-17 22:35:26 +01:00
parent 3e3e1df051
commit 630afc5469
2 changed files with 10 additions and 9 deletions

View File

@ -236,6 +236,7 @@ class DockerVM(BaseNode):
"""
path = os.path.join(self.working_dir, "etc", "network")
os.makedirs(path, exist_ok=True)
open(os.path.join(path, ".gns3_perms"), 'a').close()
os.makedirs(os.path.join(path, "if-up.d"), exist_ok=True)
os.makedirs(os.path.join(path, "if-down.d"), exist_ok=True)
os.makedirs(os.path.join(path, "if-pre-up.d"), exist_ok=True)

View File

@ -35,17 +35,17 @@ do
mkdir -p "$i"
# Copy original files if destination is empty (first start)
[ "$(ls -A "/gns3volumes$i")" ] || cp -a "$i/." "/gns3volumes$i"
if [ ! -f "/gns3volumes$i/.gns3_perms" ]; then
cp -a "$i/." "/gns3volumes$i"
touch "/gns3volumes$i/.gns3_perms"
fi
mount --bind "/gns3volumes$i" "$i"
if [ -f "$i/.gns3_perms" ]
then
while IFS=: read PERMS OWNER GROUP FILE
do
[ -L "$FILE" ] || chmod "$PERMS" "$FILE"
chown -h "${OWNER}:${GROUP}" "$FILE"
done < "$i/.gns3_perms"
fi
while IFS=: read PERMS OWNER GROUP FILE
do
[ -L "$FILE" ] || chmod "$PERMS" "$FILE"
chown -h "${OWNER}:${GROUP}" "$FILE"
done < "$i/.gns3_perms"
done