Skip to content

Commit b36fe93

Browse files
committed
Taking care the comments from Seb on 16 July 2025.
1 parent 34b50f2 commit b36fe93

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

debian/postinst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ configure)
124124
update-initramfs -u -t -k "$(uname -r)"
125125
fi
126126

127-
if [[ -f "/var/lib/delphix-platform/export-home" ]]; then
128-
chmod 755 "/var/lib/delphix-platform/export-home"
129-
fi
130-
131127
;;
132128
esac
133129

files/common/var/lib/delphix-platform/export-home

100644100755
Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,38 @@
88
# to /home.
99
#
1010

11-
if ! mountpoint -q /export/home; then
12-
if [ ! -L /export/home ]; then
13-
echo 'Ensuring /export/home is a symlink to /home...'
14-
if [ -e /export/home ]; then
15-
echo 'Removing existing /export/home directory...'
16-
rm -rf /export/home
17-
fi
18-
if [ ! -d /export ]; then
19-
mkdir /export
20-
fi
21-
echo 'Creating symlink: /export/home -> /home'
22-
ln -s /home /export/home
11+
# If /export/home is already a symlink to /home, do nothing
12+
if [ -L /export/home ]; then
13+
echo '/export/home is already exists. Nothing to do.'
14+
exit 0
15+
fi
16+
17+
# If it's still a mount point, abort to avoid potential data loss
18+
if mountpoint -q /export/home; then
19+
echo '/export/home is still mounted. Aborting to avoid risk of data loss.'
20+
exit 1
21+
fi
22+
23+
# If /export/home exists as a directory, check if it is safe to remove
24+
if [ -e /export/home ]; then
25+
echo 'Found existing /export/home. Checking if it is safe to remove.'
26+
if rmdir /export/home 2>/dev/null; then
27+
echo '/export/home was empty and removed successfully.'
28+
else
29+
echo 'Error: /export/home is not empty. Aborting to avoid accidental deletion.'
30+
exit 1
2331
fi
2432
fi
33+
34+
# Ensure /export directory exists
35+
mkdir -p /export
36+
37+
# Create symlink
38+
echo 'Creating symlink: /export/home -> /home'
39+
ln -s /home /export/home
40+
if [ $? -eq 0 ]; then
41+
echo 'Symlink created successfully.'
42+
else
43+
echo 'Failed to create symlink. Please check permissions and try again.'
44+
exit 1
45+
fi

0 commit comments

Comments
 (0)