/[baselayout]/trunk/sbin/rc
Gentoo

Diff of /trunk/sbin/rc

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

Revision 440 Revision 441
40 fi 40 fi
41 41
42 return ${retval} 42 return ${retval}
43} 43}
44 44
45# Check that $svcdir exists ... 45# Check that $1 exists ...
46check_statedir() { 46check_statedir() {
47 [ -z "$1" ] && return 0
48
47 if [ ! -d "${svcdir}" ] 49 if [ ! -d "$1" ]
48 then 50 then
49 if ! mkdir -p "${svcdir}" &> /dev/null 51 if ! mkdir -p "$1" &>/dev/null
50 then 52 then
51 echo 53 echo
52 eerror "For Gentoo Linux to function properly, \"${svcdir}\" need to exist." 54 eerror "For Gentoo Linux to function properly, \"$1\" need to exist."
53 eerror "Please mount your root partition read/write, and execute:" 55 eerror "Please mount your root partition read/write, and execute:"
54 echo 56 echo
55 eerror " # mkdir -p ${svcdir}" 57 eerror " # mkdir -p $1"
56 echo; echo 58 echo; echo
57 /sbin/sulogin ${CONSOLE} 59 /sbin/sulogin ${CONSOLE}
58 einfo "Unmounting filesystems" 60 einfo "Unmounting filesystems"
59 /bin/mount -a -o remount,ro & >/dev/null 61 /bin/mount -a -o remount,ro & >/dev/null
60 einfo "Rebooting" 62 einfo "Rebooting"
102 echo 104 echo
103 echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}" 105 echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}"
104 echo -e " Copyright 2001-2003 Gentoo Technologies, Inc.; Distributed under the GPL" 106 echo -e " Copyright 2001-2003 Gentoo Technologies, Inc.; Distributed under the GPL"
105 echo 107 echo
106 108
109 check_statedir /proc
110
107 ebegin "Mounting proc at /proc" 111 ebegin "Mounting proc at /proc"
108 try try mount -n -t proc none /proc 112 try try mount -n -t proc none /proc
109 eend $? 113 eend $?
110 114
111 if [ -d /sys -a "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ] 115 if [ -d /sys -a "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ]
116 120
117 elif [ "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ] 121 elif [ "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ]
118 then 122 then
119 ewarn "No /sys to mount sysfs needed in 2.6 and later kernels!" 123 ewarn "No /sys to mount sysfs needed in 2.6 and later kernels!"
120 fi 124 fi
125
126 check_statedir /dev
121 127
122 devfs="yes" 128 devfs="yes"
123 udev="yes" 129 udev="yes"
124 130
125 # Check if we can use udev, and that the user did not disable 131 # Check if we can use udev, and that the user did not disable
207 # Only try to create /dev/pts if we have /dev mounted as devfs, 213 # Only try to create /dev/pts if we have /dev mounted as devfs,
208 # else it might fail as / might be still mounted readonly. 214 # else it might fail as / might be still mounted readonly.
209 if [ ! -d /dev/pts -a -e "/dev/.devfsd" -a "${mymounts}" = "yes" ] 215 if [ ! -d /dev/pts -a -e "/dev/.devfsd" -a "${mymounts}" = "yes" ]
210 then 216 then
211 # Make sure we have /dev/pts 217 # Make sure we have /dev/pts
212 mkdir -p /dev/pts &> /dev/null 218 mkdir -p /dev/pts &>/dev/null || \
219 ewarn "Could not create /dev/pts!"
220
213 fi 221 fi
214 222
215 if [ -d /dev/pts ] 223 if [ -d /dev/pts ]
216 then 224 then
217 ebegin "Mounting devpts at /dev/pts" 225 ebegin "Mounting devpts at /dev/pts"
248 fi 256 fi
249 257
250 # Mount either a ramdisk or tmpfs if requested. 258 # Mount either a ramdisk or tmpfs if requested.
251 # we do this to temp mount, until we can get /var mounted ... 259 # we do this to temp mount, until we can get /var mounted ...
252 tsvcdir="/mnt/.init.d" 260 tsvcdir="/mnt/.init.d"
253 261
254 # Should we use tmpfs or a ramdisk for caching dependency and 262 # Should we use tmpfs or a ramdisk for caching dependency and
255 # general initscript data? Note that the 'gentoo=tmpfs' kernel 263 # general initscript data? Note that the 'gentoo=tmpfs' kernel
256 # option should override most settings ... 264 # option should override most settings ...
257 if get_bootparam "tmpfs" || \ 265 if get_bootparam "tmpfs" || \
258 [ "${svcmount}" = "yes" -a "${svcfstype}" = "tmpfs" ] 266 [ "${svcmount}" = "yes" -a "${svcfstype}" = "tmpfs" ]
259 then 267 then
260 mkdir -p "${tsvcdir}" &> /dev/null 268 check_statedir "${tsvcdir}"
261 269
262 ebegin "Mounting tmpfs at ${tsvcdir}" 270 ebegin "Mounting tmpfs at ${tsvcdir}"
263 try mount -n -t tmpfs tmpfs "${tsvcdir}" \ 271 try mount -n -t tmpfs tmpfs "${tsvcdir}" \
264 -o rw,mode=0644,size="${svcsize}"k 272 -o rw,mode=0644,size="${svcsize}"k
265 eend 0 273 eend 0
266 274
267 elif get_bootparam "ramfs" || \ 275 elif get_bootparam "ramfs" || \
268 [ "${svcmount}" = "yes" -a "${svcfstype}" = "ramfs" ] 276 [ "${svcmount}" = "yes" -a "${svcfstype}" = "ramfs" ]
269 then 277 then
270 mkdir -p "${tsvcdir}" 278 check_statedir "${tsvcdir}"
271 279
272 ebegin "Mounting ramdisk 0 at ${tsvcdir}" 280 ebegin "Mounting ramdisk 0 at ${tsvcdir}"
273 try dd if=/dev/zero of=/dev/ram0 bs=1k count="${svcsize}" 281 try dd if=/dev/zero of=/dev/ram0 bs=1k count="${svcsize}"
274 try /sbin/mke2fs -i 1024 -vm0 /dev/ram0 "${svcsize}" 282 try /sbin/mke2fs -i 1024 -vm0 /dev/ram0 "${svcsize}"
275 try mount -n -t ext2 /dev/ram0 "${tsvcdir}" -o rw 283 try mount -n -t ext2 /dev/ram0 "${tsvcdir}" -o rw
276 eend 0 284 eend 0
340 einfo "Rebooting" 348 einfo "Rebooting"
341 /sbin/reboot -f 349 /sbin/reboot -f
342 fi 350 fi
343 done 351 done
344 # Check that $svcdir exists ... 352 # Check that $svcdir exists ...
345 check_statedir 353 check_statedir "${svcdir}"
346 354
347 # Since we are using tmpfs or ramfs, just bin to $tsvcdir to $svcdir 355 # Since we are using tmpfs or ramfs, just bin to $tsvcdir to $svcdir
348 if get_bootparam "tmpfs" || get_bootparam "ramfs" || [ "${svcmount}" = "yes" ] 356 if get_bootparam "tmpfs" || get_bootparam "ramfs" || [ "${svcmount}" = "yes" ]
349 then 357 then
350 mount --bind "${tsvcdir}" "${svcdir}" 358 mount --bind "${tsvcdir}" "${svcdir}"

Legend:
Removed from v.440  
changed lines
  Added in v.441

  ViewVC Help
Powered by ViewVC 1.1.20