|
| 1 | +#!/bin/bash -eux |
| 2 | +# |
| 3 | +# Copyright 2024 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 | + # Checking the fstab file if the /export/home entry |
| 21 | + # is present in the /etc/fstab, In case of container |
| 22 | + # upgrade the file is already changed by the |
| 23 | + # container-upgrade script and we dont need to do |
| 24 | + # it again. |
| 25 | + fs_tab=/etc/fstab |
| 26 | + auto_master=/etc/auto.master |
| 27 | + |
| 28 | + if grep -q "\/export\/home" "$fs_tab" |
| 29 | + then |
| 30 | + sed -i 's|/export/home|/home|g' "$fs_tab" |
| 31 | + mount /home |
| 32 | + fi |
| 33 | + |
| 34 | + if [[ -e $auto_master ]] |
| 35 | + then |
| 36 | + if grep -q "\/home\s+auto_home\s+-nobrowse" "$auto_master" |
| 37 | + then |
| 38 | + sed -i 's|/home auto_home -nobrowse|#/home auto_home -nobrowse|g' "$auto_master" |
| 39 | + systemctl restart autofs |
| 40 | + fi |
| 41 | + fi |
| 42 | + |
| 43 | + passwd_file=/etc/passwd |
| 44 | + if grep -q "\/export\/home\/delphix" "$passwd_file" |
| 45 | + then |
| 46 | + sed -i 's/\/export\/home\/delphix/\/home\/delphix/g' /etc/passwd |
| 47 | + fi |
| 48 | + |
| 49 | + if grep -q "\/export\/home\/cli" "$passwd_file" |
| 50 | + then |
| 51 | + sed -i 's/\/export\/home\/cli/\/home\/cli/g' /etc/passwd |
| 52 | + fi |
| 53 | + |
| 54 | + if grep -q "\/export\/home\/cloudagent" "$passwd_file" |
| 55 | + then |
| 56 | + sed -i 's/\/export\/home\/cloudagent/\/home\/cloudagent/g' /etc/passwd |
| 57 | + fi |
| 58 | + |
| 59 | + ;; |
| 60 | +esac |
| 61 | +exit 0 |
0 commit comments