/[baselayout]/trunk/init.d/bootmisc
Gentoo

Diff of /trunk/init.d/bootmisc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 883 Revision 884
1#!/sbin/runscript 1#!/sbin/runscript
2# Copyright 1999-2004 Gentoo Foundation 2# Copyright 1999-2005 Gentoo Foundation
3# Distributed under the terms of the GNU General Public License v2 3# Distributed under the terms of the GNU General Public License v2
4# $Header$ 4# $Header$
5 5
6depend() { 6depend() {
7 use clock hostname 7 use clock hostname
8 need localmount 8 need localmount
9 before logger 9 before logger
10} 10}
11 11
12start() { 12start() {
13 if [ "${BOOT}" = "yes" ] 13 if [[ ${BOOT} == "yes" ]] ; then
14 then
15 # 14 #
16 # Put a nologin file in /etc to prevent people from logging in before 15 # Put a nologin file in /etc to prevent people from logging in before
17 # system startup is complete. 16 # system startup is complete.
18 # 17 #
19 if [ "${DELAYLOGIN}" = "yes" ] 18 if [[ ${DELAYLOGIN} == "yes" ]] ; then
20 then
21 echo "System bootup in progress - please wait" > /etc/nologin 19 echo "System bootup in progress - please wait" > /etc/nologin
22 cp /etc/nologin /etc/nologin.boot &>/dev/null 20 cp /etc/nologin /etc/nologin.boot &> /dev/null
23 fi 21 fi
24 22
25 if [ -e /etc/sysctl.conf ] 23 if [[ -e /etc/sysctl.conf ]] ; then
26 then
27 ebegin "Configuring kernel parameters" 24 ebegin "Configuring kernel parameters"
28 /sbin/sysctl -p /etc/sysctl.conf &>/dev/null 25 /sbin/sysctl -p /etc/sysctl.conf &> /dev/null
29 eend 0 26 eend 0
30 fi 27 fi
31 28
32 if [ -z "${CDBOOT}" ] && ! touch /var/run/.keep 2> /dev/null 29 if [[ -z ${CDBOOT} ]] && ! touch /var/run/.keep 2> /dev/null ; then
33 then
34 ewarn "Skipping /var and /tmp initialization (ro root?)" 30 ewarn "Skipping /var and /tmp initialization (ro root?)"
35 return 0 31 return 0
36 fi 32 fi
37 33
38 if [ -x /sbin/env-update.sh ] 34 if [[ -x /sbin/env-update.sh ]] ; then
39 then
40 ebegin "Updating environment" 35 ebegin "Updating environment"
41 /sbin/env-update.sh -u >/dev/null 36 /sbin/env-update.sh -u > /dev/null
42 eend 0 37 eend 0
43 fi 38 fi
44 39
45 # 40 #
46 # Take care of random stuff [ /var/lock | /var/run | pam ] 41 # Take care of random stuff [ /var/lock | /var/run | pam ]
47 # 42 #
48 ebegin "Cleaning /var/lock, /var/run" 43 ebegin "Cleaning /var/lock, /var/run"
49 rm -rf /var/run/console.lock /var/run/console/* 44 rm -rf /var/run/console.lock /var/run/console/*
50 if [ -z "${CDBOOT}" ] 45 if [[ -z ${CDBOOT} ]] ; then
51 then
52 # 46 #
53 # Clean up any stale locks. 47 # Clean up any stale locks.
54 # 48 #
55 ( find /var/lock -type f -print0 | xargs -0 rm -f -- ) 49 find /var/lock -type f -print0 | xargs -0 rm -f --
56 # 50 #
57 # Clean up /var/run and create /var/run/utmp so that we can login. 51 # Clean up /var/run and create /var/run/utmp so that we can login.
58 # 52 #
59 for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed) 53 for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed) ; do
60 do
61 local daemon="${x##*/}" 54 local daemon=${x##*/}
62 daemon="${daemon%*.pid}" 55 daemon=${daemon%*.pid}
63 # Do not remove pidfiles of already running daemons 56 # Do not remove pidfiles of already running daemons
64 if [ -z "`ps --no-heading -C "${daemon}"`" ] 57 if [[ -z $(ps --no-heading -C "${daemon}") ]] ; then
65 then 58 if [[ -f ${x} || -L ${x} ]] ; then
66 if [ -f "${x}" -o -L "${x}" ]
67 then
68 rm -f "${x}" 59 rm -f "${x}"
69 fi 60 fi
70 fi 61 fi
71 done 62 done
72 fi 63 fi
73 # Reset pam_console permissions 64 # Reset pam_console permissions
74 if [ -x /sbin/pam_console_apply ] && [ ! -c /dev/.devfsd ] 65 if [[ -x /sbin/pam_console_apply ]] && [[ ! -c /dev/.devfsd ]] ; then
75 then
76 /sbin/pam_console_apply -r 66 /sbin/pam_console_apply -r
77 fi 67 fi
78 # Create the .keep to stop portage from removing /var/lock 68 # Create the .keep to stop portage from removing /var/lock
79 >/var/lock/.keep 69 > /var/lock/.keep
80 eend 0 70 eend 0
81 71
82 # 72 #
83 # Clean up /tmp directory 73 # Clean up /tmp directory
84 # 74 #
85 if [ -z "${CDBOOT}" ] 75 if [[ -z ${CDBOOT} ]] ; then
86 then
87 ebegin "Cleaning /tmp directory" 76 ebegin "Cleaning /tmp directory"
88 rm -f /tmp/.X*-lock /tmp/esrv* /tmp/kio* /tmp/jpsock.* /tmp/.fam* &>/dev/null 77 rm -f /tmp/.X*-lock /tmp/esrv* /tmp/kio* /tmp/jpsock.* /tmp/.fam* &> /dev/null
89 rm -rf /tmp/.esd* /tmp/orbit-* /tmp/ssh-* /tmp/ksocket-* /tmp/.*-unix &>/dev/null 78 rm -rf /tmp/.esd* /tmp/orbit-* /tmp/ssh-* /tmp/ksocket-* /tmp/.*-unix &> /dev/null
90 # Make sure our X11 stuff have the correct permissions 79 # Make sure our X11 stuff have the correct permissions
91 mkdir -p /tmp/.{ICE,X11}-unix &>/dev/null 80 mkdir -p /tmp/.{ICE,X11}-unix &> /dev/null
92# chown root.root /tmp/.{ICE,X11}-unix &>/dev/null 81# chown root.root /tmp/.{ICE,X11}-unix &> /dev/null
93 chmod 1777 /tmp/.{ICE,X11}-unix &>/dev/null 82 chmod 1777 /tmp/.{ICE,X11}-unix &> /dev/null
94 eend 0 83 eend 0
95 fi 84 fi
96 85
97 # 86 #
98 # Create an 'after-boot' dmesg log 87 # Create an 'after-boot' dmesg log
103 fi 92 fi
104 93
105 # 94 #
106 # Check for /etc/resolv.conf, and create if missing 95 # Check for /etc/resolv.conf, and create if missing
107 # 96 #
108 [ -f /etc/resolv.conf ] || touch /etc/resolv.conf &>/dev/null 97 [[ -f /etc/resolv.conf ]] || touch /etc/resolv.conf &> /dev/null
109} 98}
110 99
111 100
112# vim:ts=4 101# vim:ts=4

Legend:
Removed from v.883  
changed lines
  Added in v.884

  ViewVC Help
Powered by ViewVC 1.1.20