Create symlinks for mapper and volume group dir

This commit is contained in:
Jeremy Gardais 2019-04-03 14:58:04 +02:00
parent da068ed9ce
commit 0e29099e60
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 20 additions and 0 deletions

20
debian/chroot.install vendored
View File

@ -146,5 +146,25 @@ done
### Fix group of LV ### Fix group of LV
chgrp disk -- /target/dev/dm-* chgrp disk -- /target/dev/dm-*
## }}} ## }}}
## Create symlinks to LV
### Get the list of all LV
tmp_list_lv="/tmp/lv.rescue.list"
find /dev/"${vgname}" -maxdepth 1 -type l -printf "%f\\n" > "${tmp_list_lv}"
### Create Volume Group and mapper directories
mkdir -p -- /target/dev/"${vgname}"
mkdir -p -- /target/dev/mapper
### For each LV
while IFS= read -r LV_NAME
do
#### Create symlink in Volume Group directory on the target system (eg. /dev/mapper/ovhsys/home -> ../dm-0)
[ -L /target/dev/"${vgname}/${LV_NAME}" ] || ln -fs -- $(readlink /dev/"${vgname}/${LV_NAME}") /target/dev/"${vgname}/${LV_NAME}"
#### Create symlink in mapper directory on the target system (eg. /dev/mapper/mapper/ovhsys-home -> ../dm-0)
[ -L /target/dev/mapper/"${vgname}-${LV_NAME}" ] || ln -fs -- $(readlink /dev/"${vgname}/${LV_NAME}") /target/dev/mapper/"${vgname}-${LV_NAME}"
done < "${tmp_list_lv}"
rm -f -- "${tmp_list_lv}"
# }}} # }}}