Skip to content

Commit b837233

Browse files
committed
Adding logic to take case the /export/home mount before delting /export/home
Adding the mount point logic back to delphix-platform.sh script Changing as per Seb-s comment to alter the softlink logic. Changing the code to previous version to validate the comments. Changing the delphix-legacy-link.service to perform the same steps next reboot like deferred upgrade. Creating a different service for taking care of soft /export/home -> /home DLPX-89763 DLPX-86523 delphix-platform changes Moved the code to create symlink to different script Removing the autofs handling as per the concerns raised by Seb and our validation Removing the softlink loginc from main.yml Since /export/home has empty delphix directory, taking care Taking care the comments from Seb on 16 July 2025. handling /export/home and /home both mounted, validated in mount | grep home check PR URL: https://www.github.com/delphix/delphix-platform/pull/477
1 parent cdd6630 commit b837233

File tree

4 files changed

+98
-4
lines changed

4 files changed

+98
-4
lines changed

debian/preinst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash -eux
2+
#
3+
# Copyright 2025 Delphix
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
case $1 in
19+
upgrade)
20+
# Home directories were previously mounted under /export/home,
21+
# and this was changed to /home. This is the upgrade logic that
22+
# updates the /etc/fstab file to reflect that change.
23+
# Home directories will be mounted in both /export/home and /home
24+
# until the system is rebooted to ensure that running processes
25+
# referencing the old /export/home paths continue to function
26+
# while also enabling new logins under /home to work.
27+
fs_tab=/etc/fstab
28+
29+
if grep -q "\/export\/home" "$fs_tab"; then
30+
sed -i 's|/export/home|/home|g' "$fs_tab"
31+
mount /home
32+
fi
33+
34+
passwd_file=/etc/passwd
35+
if grep -q "\/export\/home" "$passwd_file"; then
36+
sed -i 's/\/export\/home/\/home/g' /etc/passwd
37+
fi
38+
39+
;;
40+
esac
41+
42+
exit 0

files/common/lib/systemd/system/delphix-platform.service

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Before=rsync.service docker.service
2424
Type=oneshot
2525
ExecStart=/var/lib/delphix-platform/ansible/apply
2626
ExecStart=/var/lib/delphix-platform/dynamic-debug
27+
ExecStart=/var/lib/delphix-platform/export-home
2728
RemainAfterExit=yes
2829

2930
#

files/common/var/lib/delphix-platform/ansible/10-delphix-platform/roles/delphix-platform/tasks/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2018, 2023 Delphix
2+
# Copyright 2018, 2025 Delphix
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
# it below; otherwise that task will fail.
2323
#
2424
- file:
25-
path: /export/home
25+
path: /home
2626
state: directory
2727
mode: 0755
2828

@@ -35,7 +35,7 @@
3535
shell: /bin/bash
3636
create_home: yes
3737
comment: Delphix User
38-
home: /export/home/delphix
38+
home: /home/delphix
3939

4040
#
4141
# In order for this locale to be used (e.g. by virtualization) we need
@@ -637,7 +637,7 @@
637637
638638
- name: Source bash completion
639639
blockinfile:
640-
dest: "/export/home/delphix/.bashrc"
640+
dest: "/home/delphix/.bashrc"
641641
block: |
642642
. /etc/bash_completion.d/systemctl
643643
. /etc/bash_completion.d/zfs
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2025 by Delphix. All rights reserved.
4+
#
5+
6+
#
7+
# This script ensures that the /export/home is a symlink
8+
# to /home.
9+
#
10+
11+
12+
# If /export/home is already a symlink to /home, do nothing
13+
if [ -L /export/home ]; then
14+
echo '/export/home is already exists. Nothing to do.'
15+
exit 0
16+
fi
17+
18+
# if /export/home and /home both are mounted - Dont do anything
19+
# Since during the next boot /export/home will not be mounted
20+
# Since /export/home is there all tests will be passes
21+
if mountpoint -q /export/home; then
22+
echo '/export/home is still mounted. Check if /home is also mounted'
23+
if mountpoint -q /home; then
24+
echo '/home is also mounted. Since during the next boot /export/home will not be mounted, exiting safely.'
25+
exit 0
26+
else
27+
echo '/home is not mounted. Aborting!!'
28+
exit 1
29+
fi
30+
fi
31+
32+
# /export/home is not mounted, check if /home is mounted
33+
if mountpoint -q /home; then
34+
echo '/home is mounted. Proceeding with the unmount check for /export/home.'
35+
else
36+
echo '/home is not mounted. Aborting to avoid risk of data loss.'
37+
exit 1
38+
fi
39+
40+
# Ensure /export directory exists
41+
mkdir -p /export
42+
43+
# Create symlink
44+
echo 'Creating symlink: /export/home -> /home'
45+
ln -s /home /export/home
46+
if [ $? -eq 0 ]; then
47+
echo 'Symlink created successfully.'
48+
else
49+
echo 'Failed to create symlink. Please check permissions and try again.'
50+
exit 1
51+
fi

0 commit comments

Comments
 (0)