]>
git.ipfire.org Git - people/ms/strongswan.git/blob - testing/scripts/build-umlrootfs
ba103838f857536e06e1a54448d82d1d5882ca5d
2 # Create UML root filesystem
4 # Copyright (C) 2004 Eric Marchionni, Patrik Rayo
5 # Zuercher Hochschule Winterthur
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the
9 # Free Software Foundation; either version 2 of the License, or (at your
10 # option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 # RCSID $Id: build-umlrootfs,v 1.11 2006/01/08 22:29:56 as Exp $
21 source $DIR/function.sh
23 [ -f $DIR/..
/testing.conf
] || die
"!! Configuration file 'testing.conf' not found"
25 source $DIR/..
/testing.conf
27 STRONGSWANVERSION
=`basename $STRONGSWAN .tar.bz2`
29 cecho-n
" * Looking for strongSwan at '$STRONGSWAN'.."
30 if [ -f "$STRONGSWAN" ]
33 cecho
" * strongSwan version is '$STRONGSWANVERSION'"
39 cecho-n
" * Looking for gentoo root filesystem at '$ROOTFS'.."
48 [ -d $BUILDDIR ] || die
"!! Directory '$BUILDDIR' does not exist"
50 HOSTCONFIGDIR
=$BUILDDIR/hosts
52 [ -d $HOSTCONFIGDIR ] || die
"!! Directory '$HOSTCONFIGDIR' does not exist"
54 LOGFILE
=$BUILDDIR/testing.log
58 cecho-n
" * Logfile '$LOGFILE' does not exist..creating.."
63 ROOTFSDIR
=$BUILDDIR/root-fs
65 if [ ! -d $ROOTFSDIR ]
67 cecho-n
" * Root file system directory '$ROOTFSDIR' does not exist..creating.."
74 LOOPDIR
=$ROOTFSDIR/loop
81 ######################################################
82 # creating reiser-based uml root filesystem
85 cecho-n
" * Building basic root filesystem (gentoo).."
86 dd if=/dev
/zero of
=gentoo-fs count
=$ROOTFSSIZE bs
=1M
>> $LOGFILE 2>&1
87 mkreiserfs
-q -f gentoo-fs
>> $LOGFILE 2>&1
88 mount
-o loop gentoo-fs
$LOOPDIR >> $LOGFILE 2>&1
89 tar xjpf
$ROOTFS -C $LOOPDIR >> $LOGFILE 2>&1
93 ######################################################
94 # copying default /etc/hosts to the root filesystem
96 cecho
" * Copying '$HOSTCONFIGDIR/default/etc/hosts' to the root filesystem"
97 cp -fp $HOSTCONFIGDIR/default
/etc
/hosts
$LOOPDIR/etc
/hosts
100 #####################################################
101 # extracting strongSwan into the root filesystem
104 cecho
" * Extracting strongSwan into the root filesystem"
105 tar xjf
$STRONGSWAN -C $LOOPDIR/root
>> $LOGFILE 2>&1
108 ######################################################
109 # installing strongSwan and setting the local timezone
112 INSTALLSHELL
=${LOOPDIR}/install.sh
114 cecho
" * Preparing strongSwan installation script"
115 echo "ln -sf /usr/share/zoneinfo/${TZUML} /etc/localtime" >> $INSTALLSHELL
117 if [ "$USE_LIBCURL" = "yes" ]
119 echo "export USE_LIBCURL=true" >> $INSTALLSHELL
122 if [ "$USE_LDAP" = "yes" ]
124 echo "export USE_LDAP=true" >> $INSTALLSHELL
127 echo "export USERCOMPILE=\'-DRANDOM_DEVICE=\\\"/dev/urandom\\\"\'" >> $INSTALLSHELL
128 echo "cd /root/${STRONGSWANVERSION}" >> $INSTALLSHELL
129 echo "make programs" >> $INSTALLSHELL
130 echo "make install" >> $INSTALLSHELL
132 cecho-n
" * Compiling $STRONGSWANVERSION within the root file system as chroot.."
133 chroot
$LOOPDIR /bin
/bash
/install.sh
>> $LOGFILE 2>&1
139 ######################################################
140 # copying the host's ssh public key
143 if [ ! -d $LOOPDIR/root
/.
ssh ]
145 mkdir
$LOOPDIR/root
/.
ssh
147 cp ~
/.ssh
/id_rsa.pub
$LOOPDIR/root
/.ssh
/authorized_keys
149 ######################################################
150 # setup public key based login among all hosts
152 cp $LOOPDIR/etc
/ssh
/ssh_host_rsa_key
$LOOPDIR/root
/.ssh
/id_rsa
154 for host in $STRONGSWANHOSTS
156 eval ip
="`echo $HOSTNAMEIPS | sed -n -e "s
/^.
*${host}://gp
" | awk -F : '{ print $1 }' | awk '{ print $1 }'`"
157 echo "$host,$ip `cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub`" >> $LOOPDIR/root
/.ssh
/known_hosts
158 echo "`cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root
/.ssh
/authorized_keys
161 ######################################################
162 # defining an empty modules.dep
167 mkdir
$LOOPDIR/lib
/modules
/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um
168 touch $LOOPDIR/lib
/modules
/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um
/modules.dep
170 mkdir
$LOOPDIR/lib
/modules
/$KERNELVERSION
171 touch $LOOPDIR/lib
/modules
/$KERNELVERSION/modules.dep