[scponly] setup_chroot.sh

Lupe Christoph lupe at lupe-christoph.de
Thu Nov 20 19:38:36 EST 2003


On Wednesday, 2003-11-19 at 16:12:22 -0800, wby oblyr wrote:

> the idea here is that the generic case (setup_chroot.sh) will take a best guess approach, but any customizations required
> for the various platforms can be located in a seperate file. 

> the pathname of this file will be "build_extras/arch/`uname -sr`.pre.sh"

Please avoid spaces in filenames, better use
  uname -sr | tr ' ' '_'

And I believe this is too kernel version specific on Linux and FreeBSD:

Linux_2.4.22-1-k7
FreeBSD_4.8-RELEASE-p10
SunOS_5.8

And we do not have the Linux distribution in that string, which plays a
bigger role than the kernel rev. 2.2 and 2.4 will behave pretty much the
same from the standpoint of scponly, but will all the myriad dists that
use them?

I believe the only truely flexible approach would be to have plugins by
platform (uname -s) and for the truely weird cases have the plugins
determine if the platform is one they have been written for.

Like this (untested):

PLATFORM=`uname -s`
if [ -d $PLATFORM.d ]; then
  for plugin in $PLATFORM.d/*; do
    if $plugin; then
      PLATFORM=$PLATFORM-`basename $plugin`
    fi
  done
fi

if [ -f $PLATFORM/pre.sh ]; then
  . build_extras/arch/$PLATFORM.pre.sh
else
  . build_extras/generic/pre.sh
fi

I.e. try to find a specific plugin, fall back to platform-generic, fall
back to generic.

The $PLATFORM.d/* could probe /etc/issue, or whatever they like, to
determine if they are called for. Remaining issue: how to avoid
multiple plugins signaling they are "it".

Lupe Christoph
-- 
| lupe at lupe-christoph.de       |           http://www.lupe-christoph.de/ |
| "Violence is the resort of the violent" Lu Tze                         |
| "Thief of Time", Terry Pratchett                                       |


More information about the scponly mailing list