summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-07-13 00:04:20 +0000
committerRoy Marples <roy@marples.name>2007-07-13 00:04:20 +0000
commitcffbaa6c4e90835cf50be79ac304cccf27605b39 (patch)
tree6e80b33f3254274f987f47f3c57d7335a278f64d /init.d
parent639024a04a34dea5e32812ce7c1e9e6f0b5f7e5c (diff)
downloadopenrc-cffbaa6c4e90835cf50be79ac304cccf27605b39.tar.gz
openrc-cffbaa6c4e90835cf50be79ac304cccf27605b39.tar.bz2
openrc-cffbaa6c4e90835cf50be79ac304cccf27605b39.tar.xz
Use echo instead of touch - saves on forking
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/bootmisc14
-rwxr-xr-xinit.d/checkroot7
2 files changed, 9 insertions, 12 deletions
diff --git a/init.d/bootmisc b/init.d/bootmisc
index 6fdbfcd..4fadb62 100755
--- a/init.d/bootmisc
+++ b/init.d/bootmisc
@@ -26,15 +26,16 @@ start() {
fi
fi
- if ! touch -c /var/run 2> /dev/null ; then
+ if ! echo 2>/dev/null >/var/run/.test.$$ ; then
ewarn "Skipping /var and /tmp initialization (ro root?)"
return 0
fi
+ rm -f /var/run/.test.$$
if [ "${RC_UNAME}" = "Linux" ] ; then
# Setup login records
- > /var/run/utmp
- touch /var/log/wtmp
+ echo > /var/run/utmp
+ [ -e /var/log/wtmp ] || echo > /var/log/wtmp
chgrp utmp /var/run/utmp /var/log/wtmp
chmod 0664 /var/run/utmp /var/log/wtmp
fi
@@ -72,7 +73,7 @@ start() {
fi
# Create the .keep to stop portage from removing /var/lock
- > /var/lock/.keep
+ echo > /var/lock/.keep
eend 0
# Clean up /tmp directory
@@ -120,13 +121,12 @@ start() {
# Create an 'after-boot' dmesg log
if [ "${RC_SYS}" != "VPS" ] ; then
- touch /var/log/dmesg
- chmod 640 /var/log/dmesg
dmesg > /var/log/dmesg
+ chmod 640 /var/log/dmesg
fi
# Check for /etc/resolv.conf, and create if missing
- [ -f /etc/resolv.conf ] || touch /etc/resolv.conf 2>/dev/null
+ [ -e /etc/resolv.conf ] || echo >/etc/resolv.conf
}
stop() {
diff --git a/init.d/checkroot b/init.d/checkroot
index a7a8b3e..a35d458 100755
--- a/init.d/checkroot
+++ b/init.d/checkroot
@@ -7,14 +7,11 @@ and optionally repair them."
do_mtab() {
# Don't create mtab if /etc is readonly
- if ! touch /etc/mtab 2> /dev/null ; then
+ if ! echo 2>/dev/null >/etc/mtab ; then
ewarn "Skipping /etc/mtab initialization" "(ro root?)"
return 0
fi
- # Clear the existing mtab
- > /etc/mtab
-
# Add the entry for / to mtab
mount -f /
@@ -43,7 +40,7 @@ do_fsck() {
return 0
fi
- if touch /.test.$$ 2> /dev/null ; then
+ if echo 2>/dev/null >/.test.$$ ; then
einfo "root filesystem is mounted read-write - skipping"
rm -f /.test.$$
return 0