Fix and unify the commands creating the link target of /dev/shm

$(realpath /dev/shm) will return the absolute path of the target of
/dev/shm, thus the command will work for both absolute symlink and
relative symlink.
This commit is contained in:
Xi Ruoyao 2024-02-04 03:40:36 +08:00
parent 677f795cf8
commit 8cf42d4c72
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3
2 changed files with 4 additions and 3 deletions

View File

@ -97,7 +97,8 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
</variablelist>
-->
<para>In some host systems, <filename>/dev/shm</filename> is a
symbolic link to <filename class="directory">/run/shm</filename>.
symbolic link to a directory, typically
<filename class="directory">/run/shm</filename>.
The /run tmpfs was mounted above so in this case only a
directory needs to be created.</para>
@ -107,7 +108,7 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
we must explicitly mount a tmpfs:</para>
<screen><userinput>if [ -h $LFS/dev/shm ]; then
(cd $LFS/dev; mkdir $(readlink shm))
mkdir -pv $LFS$(realpath /dev/shm)
else
mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
fi</userinput></screen>

View File

@ -130,7 +130,7 @@ mounttype proc proc proc
mounttype sys sysfs sysfs
mounttype run tmpfs run
if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
mkdir -pv $LFS$(realpath /dev/shm)
else
mounttype dev/shm tmpfs tmpfs -o nosuid,nodev
fi