source: bootscripts/lfs/init.d/mountvirtfs@ 16cd0963

11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 bdubbs/gcc13 multilib renodr/libudev-from-systemd trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 16cd0963 was 16cd0963, checked in by Bruce Dubbs <bdubbs@…>, 19 months ago

Adjust instructions for /dev/shm when creating virtual filesystems.
Some host create /dev/shm as a tmpfs. Some have is as
a symlink to a location in another directory. This
change handles both cases.

The change to the sysV bootscripts now creates /dev/shm
as a separate tmpfs from /run. This makes LFS sysV and
systemd versions treat /dev/shm the same.

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[1c48007]1#!/bin/sh
2########################################################################
[0cda898]3# Begin mountvirtfs
[1c48007]4#
[dda039b]5# Description : Ensure proc, sysfs, run, and dev are mounted
[1c48007]6#
7# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
[f874424]8# DJ Lucas - dj@linuxfromscratch.org
[0cda898]9# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
[1c48007]10#
[0cda898]11# Version : LFS 7.0
[1c48007]12#
13########################################################################
14
[0cda898]15### BEGIN INIT INFO
16# Provides: mountvirtfs
[6903d5e]17# Required-Start: $first
[0cda898]18# Should-Start:
19# Required-Stop:
20# Should-Stop:
21# Default-Start: S
22# Default-Stop:
[dda039b]23# Short-Description: Mounts various special fs needed at start
[0cda898]24# Description: Mounts /sys and /proc virtual (kernel) filesystems.
[1025b2a]25# Mounts /run (tmpfs) and /dev (devtmpfs).
[dda039b]26# This is done only if they are not already mounted.
27# with the kernel config proposed in the book, dev
28# should be automatically mounted by the kernel.
[0cda898]29# X-LFS-Provided-By: LFS
30### END INIT INFO
31
[f874424]32. /lib/lsb/init-functions
[1c48007]33
34case "${1}" in
[0cda898]35 start)
[cba2d4e]36 # Make sure /run is available before logging any messages
[c433b2f]37 if ! mountpoint /run >/dev/null; then
[28c4c1e]38 mount /run || failed=1
[7b08ae24]39 fi
40
[16cd0963]41 mkdir -p /run/lock
42 chmod 1777 /run/lock
[0cda898]43
[a44ae577]44 log_info_msg "Mounting virtual file systems: ${INFO}/run"
[0cda898]45
46 if ! mountpoint /proc >/dev/null; then
[9813d5e3]47 log_info_msg2 " ${INFO}/proc"
[28c4c1e]48 mount -o nosuid,noexec,nodev /proc || failed=1
[0cda898]49 fi
50
51 if ! mountpoint /sys >/dev/null; then
[a44ae577]52 log_info_msg2 " ${INFO}/sys"
[28c4c1e]53 mount -o nosuid,noexec,nodev /sys || failed=1
[0cda898]54 fi
55
[e9ba8aa8]56 if ! mountpoint /dev >/dev/null; then
[a44ae577]57 log_info_msg2 " ${INFO}/dev"
[28c4c1e]58 mount -o mode=0755,nosuid /dev || failed=1
[e9ba8aa8]59 fi
60
[16cd0963]61 mkdir -p /dev/shm
62 log_info_msg2 " ${INFO}/dev/shm"
63 mount -o nosuid,nodev /dev/shm || failed=1
[a44ae577]64
[0cda898]65 (exit ${failed})
66 evaluate_retval
[f874424]67 exit $failed
[0cda898]68 ;;
69
70 *)
71 echo "Usage: ${0} {start}"
72 exit 1
73 ;;
[1c48007]74esac
75
[f874424]76# End mountvirtfs
Note: See TracBrowser for help on using the repository browser.