Search the web
Sign In
New User? Sign Up
FreeBSD-rc · Improving FreeBSD startup scripts
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Improving cleanvar, re diskless boot   Message List  
Reply | Forward Message #386 of 729 |
Guys,

Please see very interesting suggestions below from phk regarding ways to
improve cleanvar, especially in the presence of a diskless boot. I like
these ideas, but wanted to run them by y'all first.

Doug

---------- Forwarded message ----------
From: Poul-Henning Kamp <phk@...>
To: Doug Barton <DougB@...>
Date: Fri, 10 Oct 2003 16:38:11 +0200
Subject: Re: "send patches" :-)


By all means forward to whoever you think appropriate.

Basically what I want to be able to do is run my embedded
systems with an /etc/fstab which looks like:

ad0s1a / ufs ro 1 1
md /tmp mfs rw,-s1m 2 0
md /var mfs rw,-s8m 2 0

Poul-Henning


>On Thu, 9 Oct 2003, Poul-Henning Kamp wrote:
>
>>
>> The first patch does the /var initialization like I talked about.
>> it should be possible to remove the equivalent code in diskless.
>>
>> Index: cleanvar
>> ===================================================================
>> RCS file: /home/ncvs/src/etc/rc.d/cleanvar,v
>> retrieving revision 1.5
>> diff -u -r1.5 cleanvar
>> --- cleanvar 14 Jul 2003 13:02:36 -0000 1.5
>> +++ cleanvar 9 Oct 2003 13:21:56 -0000
>> @@ -7,6 +7,12 @@
>> # REQUIRE: mountcritlocal
>> # KEYWORD: FreeBSD
>>
>> +. /etc/rc.subr
>> +
>> +name="cleanvar"
>> +
>> +load_rc_config $name
>> +
>> purgedir()
>> {
>> local dir file
>> @@ -31,6 +37,46 @@
>> done
>> fi
>> }
>> +
>> +# Provide a function for normalizing the mounting of memory
>> +# filesystems. This should allow the rest of the code here to remain
>> +# as close as possible between 5-current and 4-stable.
>> +# $1 = size
>> +# $2 = mount point
>> +# $3 = (optional) bytes-per-inode
>> +mount_md() {
>> + if [ -n "$3" ]; then
>> + bpi="-i $3"
>> + fi
>> + /sbin/mdmfs $bpi -s $1 -M md $2
>> +}
>> +
>> +# If we do not have a writable /var, create a memory
>> +# filesystem for /var. We don't have /usr yet so
>> +# use mkdir instead of touch to test. We want mount
>> +# to record its mounts so we have to make sure /var/db
>> +# exists before doing the mount -a.
>> +#
>> +
>> +if (/bin/mkdir /var/.diskless 2> /dev/null); then
>> + rmdir /var/.diskless
>> +else
>> + mkdir -p /var
>> + mount_md ${varsize:=32m} /var
>> +fi
>> +
>> +# Populate /var if it looks empty
>> +if [ -d /var/run -a -d /var/db -a -d /var/empty ] ; then
>> + true
>> +else
>> + /usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null 2>&1
>> + LOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } '
/etc/newsyslog.conf`
>> + if [ -n "$LOGFILES" ]; then
>> + /usr/bin/touch $LOGFILES
>> + fi
>> + /usr/bin/touch /var/log/lastlog
>> +
>> +fi
>>
>> # These files must be removed only the first time this script is run
>> # on boot.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@... | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.




Mon Oct 13, 2003 8:48 am

DougB@...
Send Email Send Email

Forward
Message #386 of 729 |
Expand Messages Author Sort by Date

Guys, Please see very interesting suggestions below from phk regarding ways to improve cleanvar, especially in the presence of a diskless boot. I like these...
Doug Barton
DougB@...
Send Email
Oct 13, 2003
9:45 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help