blob: 6ed91aa7e3ed282a9d2ea3734c8c8f7db9b9f39b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# void single_user()
#
# Drop to a shell, remount / ro, and then reboot
#
single_user() {
einfo "Rebooting"
/sbin/reboot -f
}
source "${svclib}"/sh/init-functions.sh
source "${svclib}"/sh/init-common-pre.sh
echo
echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}"
echo -e " Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2"
echo
check_statedir /proc
check_statedir /dev
# OpenVZ needs to mount proc from inside
if [[ ! -e /proc/self ]]; then
mount -t proc none /proc
fi
# OpenVZ also needs devpts for vzctl enter
if [[ ! -e /dev/pts/0 ]]; then
have_devpts="$(awk '($2 == "devpts") { print "yes"; exit 0 }' /proc/filesystems)"
if [ "${have_devpts}" = "yes" ] ; then
# Make sure we have /dev/pts
mkdir -p /dev/pts &>/dev/null || \
ewarn "Could not create /dev/pts!"
if [[ -d /dev/pts ]] ; then
ebegin "Mounting devpts at /dev/pts"
mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts
eend $?
fi
fi
fi
source "${svclib}"/sh/init-common-post.sh
# Setup login records ... this has to be done here because when
# we exit this runlevel, init will write a boot record to utmp
# If /var/run is readonly, then print a warning, not errors
if touch /var/run/utmp 2>/dev/null ; then
> /var/run/utmp
touch /var/log/wtmp
chgrp utmp /var/run/utmp /var/log/wtmp
chmod 0664 /var/run/utmp /var/log/wtmp
# Remove /var/run/utmpx (bug from the past)
rm -f /var/run/utmpx
else
ewarn "Skipping /var/run/utmp initialization (ro root?)"
fi
# vim:ts=4
|