device-helper: move /dev/disk/by- to create_symlink()

This commit is contained in:
illiliti 2021-05-11 12:49:29 +03:00
parent c7d9f9ad76
commit f9f2dbfd40

View File

@ -4,13 +4,13 @@
create_symlink() create_symlink()
{ {
dir="$1"; sym="$2" typ="$1"; sym="$2"
sym="${sym%\"}" sym="${sym%\"}"
sym="${sym#\"}" sym="${sym#\"}"
sym="${dir}/${sym}" sym="/dev/disk/by-${typ}/${sym}"
mkdir -p "$dir" mkdir -p "${sym%/*}"
ln -s "../../${dev_name}" "$sym" ln -s "../../${dev_name}" "$sym"
} }
@ -37,8 +37,8 @@ while ! _blkid=$(blkid "/dev/${dev_name}"); do
fi fi
done done
for line in $_blkid; do case "${line%%=*}" in for line in $_blkid; do case "${line%%=*}" in
UUID) create_symlink /dev/disk/by-uuid "${line##*=}" ;; UUID) create_symlink uuid "${line##*=}" ;;
LABEL) create_symlink /dev/disk/by-label "${line##*=}" ;; LABEL) create_symlink label "${line##*=}" ;;
PARTUUID) create_symlink /dev/disk/by-partuuid "${line##*=}" ;; PARTUUID) create_symlink partuuid "${line##*=}" ;;
esac; done esac; done