Re: Scripting sysinstall

2008-02-29 Thread Andrew Von Cid
Hi Jeff,

 I'm having problems with sysinstall used from a script.  (Before you
 ask, yes I've read the man page and yes I know sysinstall is greatly
 in need of death but I've not yet found a plausible alternative.  I'm
 all ears if you've got one to suggest.)  

I had a lot of drama trying to get a similar thing working with
sysinstall a while ago and never got it the way I wanted.  Have you
considered partitioning the disk manually with fdisk  bsdlabel and
installing the freebsd distributions using the install.sh scripts
provided on the freebsd install cd's (e.g. DESTDIR=/mnt ./install.sh)?
I think this would be easier to script in sh rather than fight with
sysinstall.  

I've read an article[1] that tells you how to install freebsd on a usb
stick using this technique, and I don't see a reason why this cannot be
done with a normal disk.

Hope this helps,


Andrew.

[1] 
http://typo.submonkey.net/articles/2006/4/13/installing-freebsd-on-usb-stick-episode-2|
-- 
accidents happen... 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Scripting sysinstall

2008-02-29 Thread Jeff Gold
On Fri, Feb 29, 2008 at 8:16 AM, jedrek [EMAIL PROTECTED] wrote:
  Have you considered partitioning the disk manually with fdisk  bsdlabel and 
 [...]

Not only have I considered it, I've done it!  I've been meaning to
post a follow up message to explain exactly how in case other people
are stuck in the same place but hadn't got around to it yet.  Below is
the shell script I'm using to create a bootable FreeBSD system.  I've
tested it successfully under QEMU and plan to try it on real hardware
soon.  This was indeed much easier to write that than to figure out
why sysinstall doesn't work.  Thanks for the link.  I'll read it and
see if there's anything in there I can use to improve my script.

   Jeff

#! /bin/sh
set -ex
disk=${1:-ad0}
source=${2:-`echo /usr/pressgang/*-RELEASE | head -1`}

dd if=/dev/zero of=/dev/$disk bs=1k count=1
fdisk -BI $disk
bsdlabel -B -w ${disk}s1 auto
size=`fdisk -s $disk | sed -En 's,^ *1: *[0-9]+ *([0-9]+) .*,\1,p'`
used=0
slice() {
letter=${1?missing letter};   shift
percent=${1?missing percent}; shift
fixed=${1?missing fixed}; shift
fstype=${1?missing fstype};   shift
if [ x$fixed = xG ]; then
ssize=`expr $percent \* 2097152`
else
ssize=`expr $size / 100 \* $percent`
fi
if expr $ssize \ $size - $used /dev/null; then
ssize=`expr $size - $used`
fi
echo $letter: $ssize $used $fstype $*
used=`expr $used + $ssize`
}
echo 8 partitions:  /tmp/bsdlabel.conf
slice a 1   G 4.2BSD 2048 16384 32776  /tmp/bsdlabel.conf
slice b 2   G swap  /tmp/bsdlabel.conf
echo c: $size 0 unused 0 0  /tmp/bsdlabel.conf
slice d 10  p 4.2BSD 2048 16384 28552  /tmp/bsdlabel.conf
slice e 15  p 4.2BSD 2048 16384 8  /tmp/bsdlabel.conf
slice f 100 p 4.2BSD 2048 16384 28552  /tmp/bsdlabel.conf
bsdlabel -R ${disk}s1 /tmp/bsdlabel.conf
rm -f /tmp/bsdlabel.conf

newfs /dev/${disk}s1a
newfs /dev/${disk}s1d
newfs /dev/${disk}s1e
newfs -U /dev/${disk}s1f

DESTDIR=/mnt
export DESTDIR
mount /dev/${disk}s1a $DESTDIR
mkdir -p $DESTDIR/usr $DESTDIR/tmp $DESTDIR/var
mount /dev/${disk}s1d $DESTDIR/usr
mount /dev/${disk}s1e $DESTDIR/tmp
mount /dev/${disk}s1f $DESTDIR/var

for dist in base dict doc manpages ports; do
cd $source/$dist
yes | ./install.sh /dev/null
# stdout goes to null so that obnoxious install questions are
# not visible to the user, who might mistake them for something
# that requires a response.
done
cd $source/kernels
./install.sh GENERIC
rmdir $DESTDIR/boot/kernel
mv $DESTDIR/boot/GENERIC $DESTDIR/boot/kernel

cat EOF  $DESTDIR/etc/fstab
# device mountpoint  fstype  options dumppass
/dev/${disk}s1b  noneswapsw  0   0
/dev/${disk}s1a  /   ufs rw  1   1
/dev/${disk}s1d  /usrufs rw  2   2
/dev/${disk}s1e  /tmpufs rw  2   2
/dev/${disk}s1f  /varufs rw  2   2
EOF
if [ -e /dev/acd0 ]; then
mkdir -p $DESTDIR/cdrom
cat EOF  $DESTDIR/etc/fstab
/dev/acd0/cdrom  cd9660  ro,noauto   0   0
EOF
fi
cat EOF  $DESTDIR/etc/rc.conf
# FIXME: something should go in here.
EOF

cd $source/packages/All
cp *.tbz $DESTDIR/
chroot $DESTDIR pkg_add dependencies-*.tbz
rm -f $DESTDIR/*.tbz

umount $DESTDIR/var
umount $DESTDIR/tmp
umount $DESTDIR/usr
umount $DESTDIR
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Scripting sysinstall

2008-02-29 Thread Jeff Gold
On Fri, Feb 29, 2008 at 4:20 PM, Mel
[EMAIL PROTECTED] wrote:
  Missing a few echo's there

What's missing?  This seems to work...

 and better off for ease of editing in the future,
  to use the cat EOF /tmp/bsdlabel.conf syntax. It will expand variables:

As you can see I use here documents in the rest of the script, but it
doesn't work this time due to the (somewhat misnamed) slice function
which permits specifying the size of partitions either in GiB or a
percentage of the entire disk.  Using backticks in a here document
didn't work because the value of the used shell variable doesn't get
updated.

  Yea, probably:
  ifconfig_${iface}=DHCP
  keyrate=fast
  sshd_enable=YES

I've also enabled a bunch of other things like usbd and moused in my
working tree.  What does keyrate=fast do?

Note that this script is not presented as advanced technology but
rather a proof of concept for installing without intervention.  There
are many ways it could be improved but my hope is that the next person
who wants to do this will find this thread in a web or list archive
search and have a starting point to work with.

Jeff
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Scripting sysinstall

2008-02-29 Thread Mel
On Friday 29 February 2008 21:40:47 Jeff Gold wrote:

 echo 8 partitions:  /tmp/bsdlabel.conf
 slice a 1   G 4.2BSD 2048 16384 32776  /tmp/bsdlabel.conf
 slice b 2   G swap  /tmp/bsdlabel.conf
 echo c: $size 0 unused 0 0  /tmp/bsdlabel.conf
 slice d 10  p 4.2BSD 2048 16384 28552  /tmp/bsdlabel.conf
 slice e 15  p 4.2BSD 2048 16384 8  /tmp/bsdlabel.conf
 slice f 100 p 4.2BSD 2048 16384 28552  /tmp/bsdlabel.conf
 bsdlabel -R ${disk}s1 /tmp/bsdlabel.conf

Missing a few echo's there and better off for ease of editing in the future, 
to use the cat EOF /tmp/bsdlabel.conf syntax. It will expand variables:

$ cat t.sh
#!/bin/sh

FOO=bar
cat EOF /tmp/out
foo is $FOO
EOF

$ sh t.sh  cat /tmp/out
foo is bar

 cat EOF  $DESTDIR/etc/rc.conf
 # FIXME: something should go in here.
 EOF

Yea, probably:
ifconfig_${iface}=DHCP
keyrate=fast
sshd_enable=YES

Otherwise, nicely done :)
-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Scripting sysinstall

2008-02-15 Thread Jeff Gold
I'm having problems with sysinstall used from a script.  (Before you
ask, yes I've read the man page and yes I know sysinstall is greatly
in need of death but I've not yet found a plausible alternative.  I'm
all ears if you've got one to suggest.)  I'm using a custom built live
CD based on FreeSBIE and the script attached below.  When I invoke
this sysinstall certainly seems busy -- it claims to be unpacking the
distribution set I specified -- but it doesn't actually accomplish
anything.  No boot loader is installed and no changes are made to the
partition table.

I'm sure I've missed something obvious but I haven't been able to work
it out through searching the documentation on http://freebsd.org/, the
archive for this list or Google in general.  What am I doing wrong?

   Jeff

debug=true
ufs=/6.2-RELEASE
mediaSetUFS

disk=ad0
partition=all
bootManager=boot
diskPartitionEditor
ad0s1-1=ufs 1048576 /
ad0s1-2=swap 4194304 none
ad0s1-3=ufs 2097152 /tmp
ad0s1-4=ufs 16777216 /usr
ad0s1-5=ufs 0 /var 1
diskLabelEditor

dists=base kernels dict doc manpages ports
distSetCustom

installCommit
shutdown
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Scripting sysinstall

2008-02-15 Thread Jeff Gold
On Fri, Feb 15, 2008 at 12:14 PM, Jeff Gold [EMAIL PROTECTED] wrote:
  When I invoke this sysinstall certainly seems busy -- it claims to be 
 unpacking the
  distribution set I specified -- but it doesn't actually accomplish
  anything.  No boot loader is installed and no changes are made to the
  partition table.

I'm still trying to figure this out, but I've got a few more details
that might be revealing for someone who understands FreeBSD and
sysinstall better than I do.  First, I'm not sure where the
distributions are being placed.  They don't appear to end up in the
live CD file system, as those have older time stamps and /usr/ports
doesn't exist before or after. There are no error messages, which
either means it worked in some strange way or the errors are
ignored.  There's nothing informative in /var/log/messages.  What
gives?

Second, I've added a packageAdd statement just to see what would
happen.  It fails with errors on md1 which I believe is mounted on
/var.  I think this means the package is being installed on the
current file system rather than the new system root.  I haven't yet
found any command in the sysinstall man page to redirect that.  Is
there one?

Finally, after the install (just like before) I see /dev/ad0, but
nothing resembling /dev/ad0s1a and friends.  And of course when I
attempt to boot afterward there is no boot loader, just a BIOS error
message.  Shouldn't the appropriate device nodes get added, either by
sysinstall or some deeper mechanism?

I'm still puzzled.  Has anyone else attempted this sort of thing or do
custom FreeBSD installations primarily use the network instead?

   Jeff
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: scripting sysinstall for pxeboot

2006-02-12 Thread Ceri Davies


On 11 Feb 2006, at 04:30, Christopher Cowart wrote:

On a not-a-show-stopper note, is there any way to get around  
specifying

the hostname and/or net device? I'd rather not specify the hostname so
that I can have one generic script for many machines. Further, what if
a some other machine has a different kind of NIC? By hardcoding these
values into install.cfg, the solution becomes much less maintainable.
Why can't it obtain the hostname from DHCP? Any thoughts on this?


Net device, I think you're out of luck.  As for the hostname, if the
DHCP server actually sends a hostname, then you *can* leave it out of
install.cfg.

Ceri
--
That must be wonderful!  I don't understand it at all.
  -- Moliere





PGP.sig
Description: This is a digitally signed message part


scripting sysinstall for pxeboot

2006-02-10 Thread Christopher Cowart
Hello-

I'm working on a project to netboot servers and perform a custom
installation of FreeBSD. I have pxeboot working with tftp, providing an
mfs image over the network.

sysinstall runs as init and attempts to follow my install.cfg. However,
when running my mediaSetFTP command, sysinstall errors with:
The fxp0 device is not configured. You will need to do so in the
Networking configuration menu before proceeding.

However, I did set tryDHCP=YES. DHCP is working because 1) it just
netbooted from it; and 2) I tried with the installation CD. It doesn't
appear to be honoring my request that it try DHCP.

If I take sysinstall over manually, specifying the network information,
it works just fine.

I want the installation to work with DHCP. Does anyone have any
suggestions for debugging sysinstall in this way?

On a not-a-show-stopper note, is there any way to get around specifying 
the hostname and/or net device? I'd rather not specify the hostname so 
that I can have one generic script for many machines. Further, what if 
a some other machine has a different kind of NIC? By hardcoding these 
values into install.cfg, the solution becomes much less maintainable. 
Why can't it obtain the hostname from DHCP? Any thoughts on this? 

Thanks for your help,
Chris

===

My install.cfg:

# This is the installation configuration file for our rackmounted FreeBSD 
# cluster machines

# Turn on extra debugging.
debug=YES
nonInteractive=YES
noWarn=NO
tryDHCP=YES
noConfirm=YES
releaseName=6.0-RELEASE



# My host specific data
#hostname=firefly
#domainname=rescomp.berkeley.edu
netDev=fxp0
hostname=firefly
_ftpPath=ftp://ftp.FreeBSD.org/pub/FreeBSD/
#nameserver=169.229.70.164
#defaultrouter=169.229.70.1
#ipaddr=169.229.70.170
#netmask=255.255.254.0
#


# Which installation device to use 
RC
##Need to set this!
##
#nfs=MyNfsServer:/export/ari_scratch2/gallatin/freebsd-dist

mediaSetFTP
#mediaSetNFS


[[SNIP]]


===

-- 
Christopher Cowart
Unix Systems Administrator
Residential Computing, UC Berkeley
May all your pushes be popped


pgpCT4ovf0iPr.pgp
Description: PGP signature


scripting sysinstall / how to get NIC name in config file

2005-05-08 Thread User vr
hi,
i'm trying to customize a CD for remote office
installations and one of the problems I need to figure
out is how to get the name for the first network
interface to stick it in install.cfg. In linux it will
always be eth0. In my case 
I am dealing with either xl, fxp, rl or ed interfaces,
but I don't know what hardware will be used before
hand. Is there a way to reference the first ethernet
interface in sysinstall config file without knowing
what its exact name will be?

thanks in advance,
slava.




Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]