/[vps]/baselayout-vserver/trunk/init.d/bootmisc
Gentoo

Contents of /baselayout-vserver/trunk/init.d/bootmisc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Sep 3 16:10:27 2005 UTC (9 years ago) by hollow
File size: 3637 byte(s)
import initial baselayout sources (1.12.0_pre8)
1 #!/sbin/runscript
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 depend() {
6 use clock hostname
7 need localmount
8 before logger
9 }
10
11 start() {
12 [[ ${BOOT} != "yes" ]] && return 0
13
14 #
15 # Put a nologin file in /etc to prevent people from logging in before
16 # system startup is complete.
17 #
18 if [[ ${DELAYLOGIN} == "yes" ]] ; then
19 echo "System bootup in progress - please wait" > /etc/nologin
20 cp /etc/nologin /etc/nologin.boot &> /dev/null
21 fi
22
23 if [[ -e /etc/sysctl.conf ]] ; then
24 ebegin "Configuring kernel parameters"
25 /sbin/sysctl -q -p /etc/sysctl.conf
26 eend 0
27 fi
28
29 if [[ -z ${CDBOOT} ]] && ! touch /var/run/.keep 2> /dev/null ; then
30 ewarn "Skipping /var and /tmp initialization (ro root?)"
31 return 0
32 fi
33
34 if [[ -x /sbin/env-update.sh ]] ; then
35 ebegin "Updating environment"
36 /sbin/env-update.sh -u > /dev/null
37 eend 0
38 fi
39
40 #
41 # Take care of random stuff [ /var/lock | /var/run | pam ]
42 #
43
44 if [[ -d /var/lib/net-scripts/state ]] ; then
45 ebegin "Cleaning /var/lib/net-scripts/state"
46 rm -rf /var/lib/net-scripts/state/*
47 eend 0
48 fi
49
50 ebegin "Cleaning /var/lock, /var/run"
51 rm -rf /var/run/console.lock /var/run/console/*
52
53 if [[ -z ${CDBOOT} ]] ; then
54 #
55 # Clean up any stale locks.
56 #
57 find /var/lock -type f -print0 | xargs -0 rm -f --
58 #
59 # Clean up /var/run and create /var/run/utmp so that we can login.
60 #
61 for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed) ; do
62 local daemon=${x##*/}
63 daemon=${daemon%*.pid}
64 # Do not remove pidfiles of already running daemons
65 if [[ -z $(ps --no-heading -C "${daemon}") ]] ; then
66 if [[ -f ${x} || -L ${x} ]] ; then
67 rm -f "${x}"
68 fi
69 fi
70 done
71 fi
72
73 # Reset pam_console permissions if we are actually using it
74 if [[ -x /sbin/pam_console_apply && ! -c /dev/.devfsd && \
75 -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ]] ; then
76 /sbin/pam_console_apply -r
77 fi
78
79 # Create the .keep to stop portage from removing /var/lock
80 > /var/lock/.keep
81 eend 0
82
83 #
84 # Clean up /tmp directory
85 #
86 if [[ -z ${CDBOOT} ]] && [[ -d /tmp ]] ; then
87 cd /tmp
88 if [[ ${WIPE_TMP} == "yes" ]] ; then
89 ebegin "Wiping /tmp directory"
90 # This eval stuff sucks, so if someone has a better *working*
91 # solution, please file a bug at http://bugs.gentoo.org/
92 # Originally ripped from Debian init scripts
93 local exceptions="
94 '!' -name . -a
95 '!' '(' -uid 0 -a
96 '('
97 -path './lost+found/*' -o
98 -path './quota.user/*' -o
99 -path './aquota.user/*' -o
100 -path './quota.group/*' -o
101 -path './aquota.group/*' -o
102 -path './.journal/*'
103 ')'
104 ')'"
105 # First kill most files, then kill empty dirs
106 eval find . -xdev -depth ${exceptions} ! -type d -print0 | xargs -0 rm -f --
107 eval find . -xdev -depth ${exceptions} -type d -empty -exec rmdir '{}' \\';'
108 eend 0
109 else
110 ebegin "Cleaning /tmp directory"
111 (
112 rm -f /tmp/.X*-lock /tmp/esrv* /tmp/kio* /tmp/jpsock.* /tmp/.fam*
113 rm -rf /tmp/.esd* /tmp/orbit-* /tmp/ssh-* /tmp/ksocket-* /tmp/.*-unix
114 ) &> /dev/null
115 eend 0
116 fi
117
118 (
119 # Make sure our X11 stuff have the correct permissions
120 mkdir -p /tmp/.{ICE,X11}-unix
121 chown 0:0 /tmp/.{ICE,X11}-unix
122 chmod 1777 /tmp/.{ICE,X11}-unix
123 [[ -x /sbin/restorecon ]] && restorecon /tmp/.{ICE,X11}-unix
124 ) &> /dev/null
125 fi
126
127 #
128 # Create an 'after-boot' dmesg log
129 #
130 touch /var/log/dmesg
131 chmod 640 /var/log/dmesg
132 dmesg > /var/log/dmesg
133
134 #
135 # Check for /etc/resolv.conf, and create if missing
136 #
137 [[ -f /etc/resolv.conf ]] || touch /etc/resolv.conf &> /dev/null
138 }
139
140
141 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20