2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 # Function to create files/directory on boot.
27 # Read in the configuration file.
28 exec 9>&0 < /etc
/sysconfig
/createfiles
29 while read name
type perm usr grp dtype maj min junk
32 # Ignore comments and blank lines.
37 # Ignore existing files.
38 if [ ! -e "${name}" ]; then
39 # Create stuff based on its type.
50 mknod
"${name}" c ${maj} ${min}
53 mknod "${name}" b ${maj} ${min}
59 boot_mesg
-n "\nUnknown device type: ${dtype}" ${WARNING}
60 boot_mesg
"" ${NORMAL}
65 boot_mesg
-n "\nUnknown type: ${type}" ${WARNING}
66 boot_mesg
"" ${NORMAL}
71 # Set up the permissions, too.
72 chown
${usr}:${grp} "${name}"
73 chmod ${perm} "${name}"
81 if [[ ! -L "/var
/run
" ]]; then
82 boot_mesg "Repair
/var
/run symlink to
/run...
"
83 mv -u /var/run/* /run/ 2>&1 > /dev/null
90 if [ ! -e /var/lock/subsys ]; then
91 mkdir -p /var/lock/subsys
93 if [ ! -e /var/lock/time ]; then
94 mkdir -p /var/lock/time
95 chown nobody.root /var/lock/time
97 if [ ! -e /var/run/clamav ]; then
98 mkdir -p /var/run/clamav
99 chown clamav:clamav /var/run/clamav
101 if [ ! -e /var/run/cups ]; then
102 mkdir -p /var/run/cups
104 if [ ! -e /var/run/dbus ]; then
105 mkdir -p /var/run/dbus
107 if [ ! -e /var/run/saslauthd ]; then
108 mkdir -p /var/run/saslauthd
110 if [ ! -e /var/log/vnstat ]; then
111 mkdir -p /var/log/vnstat
113 boot_mesg -n "Cleaning
file systems
:" ${INFO}
115 boot_mesg -n " /tmp
" ${NORMAL}
117 find . -xdev -mindepth 1 ! -name lost+found \
120 boot_mesg -n " /var
/ipfire
/dhcp
" ${NORMAL}
121 cd /var/ipfire/dhcpc/ && find . -name "*.pid
" -exec rm -f {} \; || failed=1
122 cd /var/ipfire/dhcpc/ && find . -name "*.cache
" -exec rm -f {} \; || failed=1
123 cd /var/ipfire/dhcpc/ && find . -name "*.info
" -exec rm -f {} \; || failed=1
125 boot_mesg -n " /var
/ipfire
/red
" ${NORMAL}
126 cd /var/ipfire/red/ && find . -name active -exec rm -f {} \; || failed=1
128 boot_mesg -n " /var
/lock
" ${NORMAL}
130 find . -type f ! -newer /proc -exec rm -f {} \; || failed=1
132 boot_mesg -n " /var
/log
/updatexlrator
" ${NORMAL}
133 rm -f /var/log/updatexlrator/checkdeaddl.lck
135 boot_mesg " /var
/run
" ${NORMAL}
137 find . ! -type d ! -name utmp ! -newer /proc \
138 -exec rm -f {} \; || failed=1
140 if grep -q '^utmp:' /etc/group ; then
141 chmod 664 /var/run/utmp
142 chgrp utmp /var/run/utmp
148 if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then
149 boot_mesg "Creating files and directories...
"
155 echo "Usage
: ${0} {start
}"