mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-17 01:04:51 +02:00
Do not overwrites persistent Docker volumes. Fixes #2358.
This commit is contained in:
parent
3e3e1df051
commit
630afc5469
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user