aboutsummaryrefslogtreecommitdiffstats
path: root/preparechroot.sh
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2021-03-23 13:12:07 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2021-03-23 13:12:07 -0500
commitca4c9e30de78f762233d3d01cb33509792ddc68b (patch)
tree4e229a5a07b834912b2c07e09960f4f6c83932c2 /preparechroot.sh
parent53a7ae6a51646eeb0a27c7aa525d15c642860d68 (diff)
Cleanup preparechroot.sh
Diffstat (limited to 'preparechroot.sh')
-rw-r--r--preparechroot.sh58
1 files changed, 26 insertions, 32 deletions
diff --git a/preparechroot.sh b/preparechroot.sh
index 07b3cb3..302fd9b 100644
--- a/preparechroot.sh
+++ b/preparechroot.sh
@@ -11,63 +11,57 @@ fi
if [ "${USER}" == "root" ]; then
echo -e "${GRN}Changing ownership to root...${RST}"
- chown -R root:root ${LFS}/bin
- chown -R root:root ${LFS}/etc
- chown -R root:root ${LFS}/lib
- chown -R root:root ${LFS}/sbin
- chown -R root:root ${LFS}/tools
- chown -R root:root ${LFS}/usr
- chown -R root:root ${LFS}/var
+ chown -R root:root "${LFS}"/bin
+ chown -R root:root "${LFS}"/etc
+ chown -R root:root "${LFS}"/lib
+ chown -R root:root "${LFS}"/sbin
+ chown -R root:root "${LFS}"/tools
+ chown -R root:root "${LFS}"/usr
+ chown -R root:root "${LFS}"/var
case $(uname -m) in
- x86_64) chown -R root:root ${LFS}/lib64 ;;
+ x86_64) chown -R root:root "${LFS}"/lib64 ;;
esac
echo -e "${GRN}Creating virtual kernel filesystem mountpoints...${RST}"
- mkdir -p ${LFS}/dev
- mkdir -p ${LFS}/proc
- mkdir -p ${LFS}/run
- mkdir -p ${LFS}/sys
+ mkdir -p "${LFS}"/dev
+ mkdir -p "${LFS}"/proc
+ mkdir -p "${LFS}"/run
+ mkdir -p "${LFS}"/sys
echo -e "${GRN}Creating initial device nodes...${RST}"
- mknod -m 600 ${LFS}/dev/console c 5 1 >/dev/null 2>&1
- mknod -m 666 ${LFS}/dev/null c 1 3 >/dev/null 2>&1
+ mknod -m 600 "${LFS}"/dev/console c 5 1 >/dev/null 2>&1
+ mknod -m 666 "${LFS}"/dev/null c 1 3 >/dev/null 2>&1
echo -e "${GRN}Mounting virtual kernel filesystems...${RST}"
- mountpoint ${LFS}/dev >/dev/null 2>&1
- retval=$?
- if [ "$retval" -ne 0 ]; then
- mount -v --bind /dev ${LFS}/dev
+ if ! mountpoint "${LFS}"/dev >/dev/null 2>&1; then
+ mount -v --bind /dev "${LFS}"/dev
else
echo -e " ${YLW}${LFS}/dev${GRN} is already mounted${RST}"
fi
- mountpoint ${LFS}/dev/pts >/dev/null 2>&1
- if [ "$?" -ne 0 ]; then
- mount -v --bind /dev/pts ${LFS}/dev/pts
+ if ! mountpoint "${LFS}"/dev/pts >/dev/null 2>&1; then
+ mount -v --bind /dev/pts "${LFS}"/dev/pts
else
echo -e " ${YLW}${LFS}/dev/pts${GRN} is already mounted${RST}"
fi
- mountpoint ${LFS}/proc >/dev/null 2>&1
- if [ "$?" -ne 0 ]; then
- mount -v --bind /proc ${LFS}/proc
+ if ! mountpoint "${LFS}"/proc >/dev/null 2>&1; then
+ mount -v --bind /proc "${LFS}"/proc
else
echo -e " ${YLW}${LFS}/proc${GRN} is already mounted${RST}"
fi
- mountpoint ${LFS}/sys >/dev/null 2>&1
- if [ "$?" -ne 0 ]; then
- mount -v --bind /sys ${LFS}/sys
+ if ! mountpoint "${LFS}"/sys >/dev/null 2>&1; then
+ mount -v --bind /sys "${LFS}"/sys
else
echo -e " ${YLW}${LFS}/sys${GRN} is already mounted${RST}"
fi
- mountpoint ${LFS}/run >/dev/null 2>&1
- if [ "$?" -ne 0 ]; then
- mount -v --bind /run ${LFS}/run
+ if ! mountpoint "${LFS}"/run >/dev/null 2>&1; then
+ mount -v --bind /run "${LFS}"/run
else
echo -e " ${YLW}${LFS}/run${GRN} is already mounted${RST}"
fi
- if [ -h ${LFS}/dev/shm ]; then
- mkdir -pv ${LFS}/$(readlink ${LFS}/dev/shm)
+ if [ -h "${LFS}"/dev/shm ]; then
+ mkdir -pv "${LFS}"/"$(readlink "${LFS}"/dev/shm)"
fi
else