From 8cf42d4c72d9e0b773c32849af2fb237b557029e Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sun, 4 Feb 2024 03:40:36 +0800 Subject: [PATCH] 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. --- chapter07/kernfs.xml | 5 +++-- chapter11/afterlfs.xml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml index 00a971b59..ecdff0dd2 100644 --- a/chapter07/kernfs.xml +++ b/chapter07/kernfs.xml @@ -97,7 +97,8 @@ mount -vt tmpfs tmpfs $LFS/run --> In some host systems, /dev/shm is a - symbolic link to /run/shm. + symbolic link to a directory, typically + /run/shm. The /run tmpfs was mounted above so in this case only a directory needs to be created. @@ -107,7 +108,7 @@ mount -vt tmpfs tmpfs $LFS/run we must explicitly mount a tmpfs: 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 diff --git a/chapter11/afterlfs.xml b/chapter11/afterlfs.xml index ff8bae006..5c2693ade 100644 --- a/chapter11/afterlfs.xml +++ b/chapter11/afterlfs.xml @@ -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