diff options
author | Roy Marples <roy@marples.name> | 2009-04-16 23:39:37 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2009-04-16 23:39:37 +0000 |
commit | 95d954e7b58e55534f393a1249db2becf74ee9f9 (patch) | |
tree | 3c80240bc843032e1f6dc45bcd365b50da92438f /init.d | |
parent | 744a8bbb4a2e2d58a2118f7796528b593905fc50 (diff) |
Improve utmp handling
Diffstat (limited to 'init.d')
-rw-r--r-- | init.d/bootmisc.in | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in index bfa959e6..b4044bb8 100644 --- a/init.d/bootmisc.in +++ b/init.d/bootmisc.in @@ -1,5 +1,5 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples <roy@marples.name> +# Copyright 2007-2009 Roy Marples <roy@marples.name> # All rights reserved. Released under the 2-clause BSD license. depend() @@ -61,9 +61,16 @@ cleanup_tmp_dir() fi } +mkutmp() +{ + : >"$1" + chgrp utmp "$1" + chmod 0664 "$1" +} + start() { - local logw=false + local logw=false runw=false # Ensure that our basic dirs exist for x in /var/log /var/run /tmp; do if ! [ -d "${x}" ]; then @@ -76,15 +83,12 @@ start() if dir_writeable /var/run; then ebegin "Creating user login records" - cp /dev/null /var/run/utmp - chgrp utmp /var/run/utmp - chmod 0664 /var/run/utmp - if dir_writeable /var/log; then - logw=true - [ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp - chgrp utmp /var/log/wtmp - chmod 0664 /var/log/wtmp - fi + local xtra= + [ "${RC_UNAME}" = NetBSD ] && extra=x + for x in "" $xtra; do + mkutmp /var/run/utmp${x} + done + [ -e /var/log/wtmp ] && mkutmp /var/log/wtmp eend 0 ebegin "Cleaning /var/run" |