10.0
10.0-rc1
10.1
10.1-rc1
11.0
11.0-rc1
11.0-rc2
11.0-rc3
11.1
11.1-rc1
11.2
11.2-rc1
11.3
11.3-rc1
12.0
12.0-rc1
12.1
12.1-rc1
12.2
12.2-rc1
7.0
7.1
7.2
7.3
7.4
7.5
7.5-systemd
7.6
7.6-systemd
7.7
7.7-systemd
7.8
7.8-systemd
7.9
7.9-systemd
8.0
8.1
8.2
8.3
8.4
9.0
9.1
arm
bdubbs/gcc13
ml-11.0
multilib
renodr/libudev-from-systemd
s6-init
trunk
xry111/arm64
xry111/arm64-12.0
xry111/clfs-ng
xry111/lfs-next
xry111/loongarch
xry111/loongarch-12.0
xry111/loongarch-12.1
xry111/loongarch-12.2
xry111/mips64el
xry111/multilib
xry111/pip3
xry111/rust-wip-20221008
xry111/update-glibc
Rev | Line | |
---|
[1c48007] | 1 | #!/bin/sh
|
---|
[f3f65e73] | 2 | # Begin $RC_BASE/init.d/cleanfs
|
---|
[1c48007] | 3 |
|
---|
| 4 | ### BEGIN INIT INFO
|
---|
| 5 | # Provides: cleanfs
|
---|
| 6 | # Required-Start: $local_fs
|
---|
| 7 | # Should-Start:
|
---|
| 8 | # Required-Stop:
|
---|
| 9 | # Should-Stop:
|
---|
[010d108] | 10 | # Default-Start: S
|
---|
[1c48007] | 11 | # Default-Stop:
|
---|
[c2db087] | 12 | # Short-Description: Cleans and prepares the temporary directory.
|
---|
| 13 | # Description: Cleans the temporary directory /tmp and creates the
|
---|
| 14 | # /var/run/utmp file and any other files defined in
|
---|
| 15 | # /etc/default/createfiles.
|
---|
[1c48007] | 16 | # X-LFS-Provided-By: LFS
|
---|
| 17 | ### END INIT INFO
|
---|
| 18 |
|
---|
| 19 | . /lib/lsb/init-functions
|
---|
| 20 |
|
---|
| 21 | # Function to create files/directory on boot.
|
---|
| 22 | create_files()
|
---|
| 23 | {
|
---|
| 24 | # Read in the configuration file.
|
---|
[dc55fb5e] | 25 | exec 9>&0 < /etc/default/createfiles
|
---|
[1c48007] | 26 | while read name type perm usr grp dtype maj min junk
|
---|
| 27 | do
|
---|
| 28 | # Ignore comments and blank lines.
|
---|
| 29 | case "${name}" in
|
---|
| 30 | ""|\#*) continue ;;
|
---|
| 31 | esac
|
---|
| 32 |
|
---|
| 33 | # Ignore existing files.
|
---|
| 34 | if [ ! -e "${name}" ]
|
---|
| 35 | then
|
---|
| 36 | # Create stuff based on its type.
|
---|
| 37 | case "${type}" in
|
---|
| 38 | dir)
|
---|
| 39 | mkdir "${name}"
|
---|
| 40 | ;;
|
---|
| 41 | file)
|
---|
| 42 | :> "${name}"
|
---|
| 43 | ;;
|
---|
| 44 | dev)
|
---|
| 45 | case "${dtype}" in
|
---|
| 46 | char)
|
---|
| 47 | mknod "${name}" c ${maj} ${min}
|
---|
| 48 | ;;
|
---|
| 49 | block)
|
---|
| 50 | mknod "${name}" b ${maj} ${min}
|
---|
| 51 | ;;
|
---|
| 52 | pipe)
|
---|
| 53 | mknod "${name}" p
|
---|
| 54 | ;;
|
---|
| 55 | *)
|
---|
[6f69b5c] | 56 | echo -e -n "\n${WARNING}Unknown device type: ${dtype}"
|
---|
| 57 | echo -e "${NORMAL}"
|
---|
[1c48007] | 58 | ;;
|
---|
| 59 | esac
|
---|
| 60 | ;;
|
---|
| 61 | *)
|
---|
[6f69b5c] | 62 | echo -e "\n${WARNING}Unknown type: ${type}${NORMAL}"
|
---|
[1c48007] | 63 | continue
|
---|
| 64 | ;;
|
---|
| 65 | esac
|
---|
| 66 |
|
---|
| 67 | # Set up the permissions, too.
|
---|
| 68 | chown ${usr}:${grp} "${name}"
|
---|
| 69 | chmod ${perm} "${name}"
|
---|
| 70 | fi
|
---|
| 71 | done
|
---|
| 72 | exec 0>&9 9>&-
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | case "${1}" in
|
---|
| 76 | start)
|
---|
| 77 | message="Cleaning file systems: "
|
---|
| 78 |
|
---|
| 79 | message="${message}${INFO} /tmp"
|
---|
| 80 | find /tmp -xdev -mindepth 1 ! -name lost+found \
|
---|
| 81 | -delete || failed=1
|
---|
| 82 |
|
---|
| 83 | > /var/run/utmp
|
---|
| 84 | if grep -q '^utmp:' /etc/group ; then
|
---|
| 85 | chmod 664 /var/run/utmp
|
---|
| 86 | chgrp utmp /var/run/utmp
|
---|
| 87 | fi
|
---|
| 88 |
|
---|
| 89 | (exit ${failed})
|
---|
| 90 | evaluate_retval standard
|
---|
| 91 |
|
---|
[dc55fb5e] | 92 | if egrep -qv '^(#|$)' /etc/default/createfiles 2>/dev/null
|
---|
[1c48007] | 93 | then
|
---|
| 94 | message="Creating files and directories..."
|
---|
| 95 | create_files
|
---|
| 96 | evaluate_retval standard
|
---|
| 97 | fi
|
---|
| 98 | ;;
|
---|
| 99 | *)
|
---|
| 100 | echo "Usage: ${0} {start}"
|
---|
| 101 | exit 1
|
---|
| 102 | ;;
|
---|
| 103 | esac
|
---|
| 104 |
|
---|
[f3f65e73] | 105 | # End $RC_BASE/init.d/cleanfs
|
---|
Note:
See
TracBrowser
for help on using the repository browser.