OpenBSD Journal

changing the installation script

Contributed by jose on from the my-own-private-rollout dept.

Stephen Barr asks: "Greetings,

I am wondering if there is a way to modify what is on the i386 boot floppy that is created with floppy33.fs. My end goal is to customize the install script a bit, so that the answers I need are preprogrammed and there are little or no prompts between insertion of the floppy and my own custom install. For the *.tgz files, they will be stored on an internal anonymous ftp server.

So, my final question is, how do I modify the install script on the boot floppy? Where is the floppy33.fs image generated, and what is doing the generating? Any help is much appreciated."

This certainly is possible, and quite easy to do. Does anyone want to share their recipes?

(Comments are closed)


Comments
  1. By Anonymous Coward () on

    Use the vnd(4) device to make the floppy33.fs file mountable.

    Mount file like any other disk: it's a kernel, plus a FFS file system.

    Edit the file the appropriate files, save, unmount, and try booting it.

    Comments
    1. By Anonymous Coward () on

      Don't answer if you have no clue what you are talking about. How about you go try your great advice and see how well it works? The only files on the floppy filesystem are boot and bsd. The crunchgen'd binary and the install shell script are in a ramdisk inside the kernel.

      To answer the question for real, just edit /usr/src/distrib//common/install.md, /usr/src/distrib/miniroot/install.sh and install.sub, and dot.profile if you don't want to have to pick "install" at the start. Then man release and follow those instructions to get the install sets and custom floppies.

      Comments
      1. By jose () on http://monkey.org/~jose/

        don't forget the site33.tgz file (or whatever version), where you can add arbitrary files to the install. it will be automatically selected and offered, and you can make it an automatic download and install, too. this way you can:

        a) set up NIS or kerberos
        b) set up arbitrary accounts
        c) set up preferences
        d) set up third-party software

        etc etc etc ...

        Comments
        1. By Noob () on

          Exactly what I was thinking ;-)

          4.11 - Customizing the Install Process
          http://www.openbsd.org/faq/faq4.html#site

      2. By Anonymous Coward () on

        Sorry, was thinking of FreeBSD's system.

    2. By Rich () deadly.org@expressive.ltd.uk on mailto:deadly.org@expressive.ltd.uk

      I'm about to do the same to allow me to install OpenBSD on headless boxes. A google groups search on "serial console openbsd install" gives all the detail you need.

      Rich

      Comments
      1. By Anonymous Coward () on

        "man boot.conf" gives even more detail

        Comments
        1. By Rich () deadly.org@expressive.ltd.uk on mailto:deadly.org@expressive.ltd.uk

          That explains how to get a serial console on an already installed machine. The actual creation of the install disk to do this for an install is not covered tho.

          This http://tinyurl.co.uk/2t74 does.

          Comments
          1. By Anonymous Coward () on

            Why not- mount floppy image with vnd and add boot.conf, write that to floppy/cdrom and here you go.
            It is always easier to ask somebody to tell what to do than to put together what you have learned yourself.

    3. By Ben () brb3@pobox.com on mailto:brb3@pobox.com

      This article by Michael Lucas might be helpful:
      http://www.onlamp.com/pub/a/bsd/2002/11/21/Big_Scary_Daemons.html

  2. By Anonymous Coward () on

    You can edit the installation script with emacs or any other text editor.
    Do man emacs.

    Kwame.

    Comments
    1. By Anonymous Coward () on

      In light of quick text editing; There is 'vi', and 'mg' if you prefer Emacs. As 'man mg' tells you, "It is compatible with emacs because there shouldn't be any reason to learn more editor types than emacs or vi(1)".

    2. By Dan () on

      This is public board.
      Please be more polite!

      But than again, It's public, so you can do what you want! But than you behave like a little kid.

    3. By _azure () on

      Wow, I hope this guy doesn't read the whole emacs man page before realizing that it doesn't answer any of his questions. I don't think he was asking for help with the basics of text editing.

  3. By Anonymous Coward () on

    It'd be interesting if you could put together a writeup afterwards, i'd like to read and learn :-)

  4. By uh () on

    http://www.openbsd.org/faq/faq4.html#site

    Comments
    1. By jose () on http://monkey.org/~jose/

      i think the person also wants the questions already filled out.

      this is certainly doable.

      http://marc.theaimsgroup.com/?l=openbsd-misc&m=104062908906138&w=2

      thats a message on a jumpstart like install

  5. By christopher () christopher-->0x90.org on mailto:christopher-->0x90.org

    >>> My end goal is to customize the install script a bit, so that the answers I need are preprogrammed and there are little or no prompts between insertion of the floppy and my own custom install.

    I sure hope you enjoy /bin/sh scripting....

    Here are some of the files you will need to touch:
    distrib/miniroot/install.sh
    distrib/miniroot/install.sub
    distrib/miniroot/list

    install.sh/sub are the main install scripts. the prompts come from the ask() calls. ask() simply fills the global variable "resp" with the answer from the console, so setting "resp=somevalue" bypasses the prompt.

    If you want a serial console for install, simply create a boot.conf setup for console somewhere in your tree and add to distrib/miniroot/list the following "COPY etc/boot.conf"

    distrib//common/install.md

    auto-configuring the disk is more difficult. best bet is to build your own prep_disklabel() function. I use vnconfig(8) to mount the floppy image after booting and simply copy a disktab file to it, then mount it from the install script and read it from there.

    >>> For the *.tgz files, they will be stored on an internal anonymous ftp server.

    install_url() contains the default ftp server, just change it, or stuff the resp= with your own server.



    happy sh-hacking!

    -c-

    Comments
    1. By Anonymous Coward () on

      >>> auto-configuring the disk is more difficult.
      >>> best bet is to build your own prep_disklabel
      >>> () function. I use vnconfig(8) to mount the
      >>> floppy image after booting and simply copy a
      >>> disktab file to it, then mount it from the
      >>> install script and read it from there.

      Could you give a hint on how could that be done without knowing the HD. Sometimes I know the hardware Im installing on, but sometimes not. What could be done then?

      Comments
      1. By Matt () on

        I was thinking that there might be a way to get disklabel to report the total sizes of disks and then use something like bc (basic calculator) to calculate the percentages of hd space you want for each partition, and then call disklabel again to create partitions of those sizes.

        This is just an idea I had a might not work for a few reasons:
        -bc probably isn't a part of the installation diskette you you'd have to add it.
        -you would probably need sed to find/replace values that were given by bc, and again, sed probably isn't a part of the default install floppy.
        -I don't know if disklabel can even return disk sizes.

        I'm sure there are other things I am missing, can anyone poke more holes in my idea?

        Comments
        1. By christopher () christopher at 0x90 dot org on mailto:christopher at 0x90 dot org

          >>> I was thinking that there might be a way to get disklabel to report the total sizes of disks and then use something like bc (basic calculator) to calculate the percentages of hd space you want for each partition, and then call disklabel again to create partitions of those sizes.

          >>> This is just an idea I had a might not work for a few reasons:
          >>> -bc probably isn't a part of the installation diskette you you'd have to add it.

          bc is tiny (~8kb on my box) so should fit.

          >>> -you would probably need sed to find/replace values that were given by bc, and again, sed probably isn't a part of the default install floppy.

          sed is part of the floppy, though awk is not

          >>> -I don't know if disklabel can even return disk sizes.

          it can return the "default" disklabel (which has one huge pa partition) the problem with disktabs are that they are all in sectors, and the sectors have to be aligned properly. Might as well add "automatic sizing" to disklabel(8) rather than try to script it in a restricted floppy.

          >>> I'm sure there are other things I am missing, can anyone poke more holes in my idea?

          If you are doing enough installs that doing the fdisk/disklabel becomes too labour intensive, then you likely are installing on systems that are similar. If you dump a disktab(5) that you have manually made partition sizes onto the floppy, you can have the script choose when the disk make/model matches.

          ...or rewrite disklabel(8) :)

          cheers

          -c-

      2. By openbsd () on


        simply call disklabel with a here document

        device=sd0
        size=550m

        disklabel -E ${device} /dev/null 2>&1
        a


        ${size}


        w


        _EOF

        and oh, to create the swap:

        disklabel -E ${device} /dev/null 2>&1
        a


        ${size}
        swap

        w


        _EOF

        could be nicer i guess

        etc :)

      3. By openbsd () on

        <br> simply call disklabel with a here document <br> <br> device=sd0 <br> size=550m <br> <br> disklabel -E ${device} /dev/null 2>&1 <br> a <br> <br> <br> ${size} <br> <br> <br> w <br> <br> <br> _EOF <br> <br> and oh, to create the swap: <br> <br> disklabel -E ${device} /dev/null 2>&1 <br> a <br> <br> <br> ${size} <br> swap <br> <br> w <br> <br> <br> _EOF <br> <br> could be nicer i guess <br> <br> etc :) <br> <br>

        Comments
        1. By Anonymous Coward () on

          <br> i guess you all know what a here document is, <br> last try: <br> <br> disklabel -E ${device} /dev/null 2>&1 <br> a <br> <br> <br> ${size} <br> swap <br> <br> w <br> <br> <br> _EOF <br>

        2. By Anonymous Coward () on

          i guess you all know what a here document is, last try: disklabel -E ${device} /dev/null 2>&1 a ${size} swap w _EOF

          Comments
          1. By Anonymous Coward () on

            well the editor does not like double <

            nice thing with this is you can more
            or less use any disk size (provided
            it fits) to have same partitions size,
            say:

            /u 128m
            swap 256m
            /usr 512m
            /var 128m
            /var/log 512m etc
            /u rest of the disc (call disklabel with
            an empty size variable)

            btw im sorry about all this noise, but the
            editor (aca textarea) is a mess

  6. By Lupines () on

    man release

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]