⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make-uml.sh

📁 This a good VPN source
💻 SH
字号:
#!/bin/sh## # $Id: make-uml.sh,v 1.40 2004/09/06 04:47:05 mcr Exp $## show me#set -x# fail if any command failsset -ecase $# in    1) OPENSWANSRCDIR=$1; shift;;esac## configuration for this file has moved to $OPENSWANSRCDIR/umlsetup.sh# By default, that file does not exist. A sample is at umlsetup-sample.sh# in this directory. Copy it to $OPENSWANSRCDIR and edit it.#OPENSWANSRCDIR=${OPENSWANSRCDIR-../..}if [ ! -f ${OPENSWANSRCDIR}/umlsetup.sh ]then    echo No umlsetup.sh. Please read instructions in doc/umltesting.html and testing/utils/umlsetup-sample.sh.    exit 1fi. ${OPENSWANSRCDIR}/umlsetup.sh. ${OPENSWANSRCDIR}/testing/utils/uml-functions.shKERNVER=${KERNVER-}    case $KERNVER in 	26) KERNVERSION=2.6;;	*) KERNVERSION=2.4;;esacecho Setting up for kernel KERNVER=$KERNVER and KERNVERSION=$KERNVERSION# set the default for thisNATTPATCH=${NATTPATCH-true}# make absolute so that we can reference it from POOLSPACEOPENSWANSRCDIR=`cd $OPENSWANSRCDIR && pwd`;export OPENSWANSRCDIR# what this script does is create some Makefile#  (if they do not already exist)# that will copy everything where it needs to go.if [ -d $OPENSWANSRCDIR/testing/kernelconfigs ]then    TESTINGROOT=$OPENSWANSRCDIR/testingfiTESTINGROOT=${TESTINGROOT-/c2/freeswan/sandbox/testing}if [ -z "$NONINTPATCH" ]then    if [ -f ${TESTINGROOT}/kernelconfigs/linux-${KERNVERSION}.0-nonintconfig.patch ]    then	NONINTPATCH=${TESTINGROOT}/kernelconfigs/linux-${KERNVERSION}.0-nonintconfig.patch	echo "Found non-int patch $NONINTPATCH"    else	echo "Can not find +$NONINTPATCH+"	exit 1    fifi# more defaultsNONINTCONFIG=oldconfig# hack for version specific stuffUMLVERSION=`basename $UMLPATCH .bz2 | sed -e 's/uml-patch-//'`EXTRAPATCH=${TESTINGROOT}/kernelconfigs/extras.$UMLVERSION.patch# dig the kernel revision out.KERNEL_MAJ_VERSION=`${OPENSWANSRCDIR}/packaging/utils/kernelversion-short $KERNPOOL/Makefile`echo -n Looking for Extra patch at $EXTRAPATCH..if [ -f "${EXTRAPATCH}" ]then    echo found it.else    echo none.    EXTRAPATCH=fimkdir -p $POOLSPACEUMLMAKE=$POOLSPACE/MakefileNOW=`date`USER=${USER-`id -un`}echo '#' built by $0 on $NOW by $USER >|$UMLMAKEecho '#' >>$UMLMAKE# okay, copy the kernel, apply the UML patches, and build a plain kernel.UMLPLAIN=$POOLSPACE/plain${KERNVER}mkdir -p $UMLPLAINsetup_make >>$UMLMAKE# now, setup up root dirfor host in $REGULARHOSTSdo    setup_host_make $host $UMLPLAIN/linux regular ${KERNVER} >>$UMLMAKEdoneif [ ! -x $UMLPLAIN/linux ]then    cd $UMLPLAIN    lndir -silent $KERNPOOL .        if [ ! -d arch/um/.PATCHAPPLIED ]     then	echo Applying $UMLPATCH	if bzcat $UMLPATCH | patch -p1 	then	    :	else	    echo "Failed to apply UML patch: $UMLPATCH"	    exit 1;        fi	if [ -n "$NONINTPATCH" ] && [ "$NONINTPATCH" != "none" ]	then	    if [ -f "$NONINTPATCH" ]	    then		echo Applying non-interactive config patch		cat $NONINTPATCH | patch -p1		NONINTCONFIG=oldconfig_nonint	    else		echo Can not find +$NONINTPATCH+		exit 1	    fi	fi	if [ -n "$EXTRAPATCH" ]	then	    echo Applying other version specific stuff	    cat $EXTRAPATCH | patch -p1	fi	for patch in ${TESTINGROOT}/kernelconfigs/local_${KERNEL_MAJ_VERSION}_*.patch	do	    if [ -f $patch ] 	    then		echo Applying local patch $patch		cat $patch | patch -p1	    fi	done	mkdir -p arch/um/.PATCHAPPLIED	if $NATTPATCH	then	    echo Applying the NAT-Traversal patch	    (cd $OPENSWANSRCDIR && make nattpatch ) | patch -p1	else            echo Not applying the NAT-Traversal patch	fi    fi    echo Copying kernel config ${TESTINGROOT}/kernelconfigs/umlplain${KERNVER}.config     rm -f .config    cp ${TESTINGROOT}/kernelconfigs/umlplain${KERNVER}.config .config        (make ARCH=um $NONINTCONFIG && make ARCH=um dep && make ARCH=um linux ) || exit 1 </dev/null fi# now, execute the Makefile that we have created!cd $POOLSPACE && make $REGULARHOSTS # now, copy the kernel, apply the UML patches.# then, make FreeSWAN patches as well.#UMLSWAN=$POOLSPACE/swan${KERNVER}# we could copy the UMLPLAIN to make this tree. This would be faster, as we# already built most everything. We could also just use a FreeSWAN-enabled# kernel on sunrise/sunset. We avoid this as we actually want them to always# work.# where to install FreeSWAN toolsDESTDIR=$POOLSPACE/root# do not generate .depend by defaultKERNDEP=''mkdir -p $UMLSWANif [ ! -x $UMLSWAN/linux ]then    cd $UMLSWAN    lndir -silent $KERNPOOL .        if [ ! -d arch/um/.PATCHAPPLIED ]     then	if bzcat $UMLPATCH | patch -p1 	then	    :	else	    echo "Failed to apply UML patch: $UMLPATCH"	    exit 1;        fi	if [ -n "$NONINTPATCH" ] && [ "$NONINTPATCH" != "none" ]	then	    if [ -f "$NONINTPATCH" ]	    then		echo Applying non-interactive config patch		cat $NONINTPATCH | patch -p1		NONINTCONFIG=oldconfig_nonint	    else		echo Can not find +$NONINTPATCH+		exit 1	    fi	fi	if [ -n "$EXTRAPATCH" ]	then	    echo Applying other version specific stuff	    cat $EXTRAPATCH | patch -p1	fi	for patch in ${TESTINGROOT}/kernelconfigs/local_${KERNEL_MAJ_VERSION}_*.patch	do	    if [ -f $patch ] 	    then		echo Applying local patch $patch		cat $patch | patch -p1	    fi	done	mkdir -p arch/um/.PATCHAPPLIED	if $NATTPATCH	then	    echo Applying the NAT-Traversal patch	    (cd $OPENSWANSRCDIR && make nattpatch ) | patch -p1	else            echo Not applying the NAT-Traversal patch	fi    fi        # copy the config file    rm -f .config    cp ${TESTINGROOT}/kernelconfigs/umlswan${KERNVER}.config .config    # nuke final executable here since we will do FreeSWAN in a moment.    rm -f linux .depend    KERNDEP=depfigrep CONFIG_KLIPS $UMLSWAN/.config || exit 1if [ ! -x $UMLSWAN/linux ]then    cd $OPENSWANSRCDIR || exit 1     make KERNMAKEOPTS='ARCH=um' KERNELSRC=$UMLSWAN KERNCLEAN='' KERNDEP=$KERNDEP KERNEL=linux DESTDIR=$DESTDIR NONINTCONFIG=${NONINTCONFIG} verset kpatch rcf kernel || exit 1 </dev/null ficd $OPENSWANSRCDIR || exit 1make programs# now, setup up root dirfor host in $OPENSWANHOSTSdo    setup_host_make $host $UMLSWAN/linux openswan ${KERNVER} >>$UMLMAKEdone# now, execute the Makefile that we have created!cd $POOLSPACE && make $OPENSWANHOSTS     ## $Log: make-uml.sh,v $# Revision 1.40  2004/09/06 04:47:05  mcr# 	make sure to pass $KERNVER into setup_host_make.## Revision 1.39  2004/08/22 03:31:29  mcr# 	added -p to PATCHAPPLIED mkdir.## Revision 1.38  2004/08/18 02:10:49  mcr# 	kernel 2.6 changes.## Revision 1.37  2004/08/14 03:30:15  mcr# 	make sure to set KERNVER/KERNVERSION after umlsetup.sh.## Revision 1.36  2004/08/03 23:25:34  mcr# 	find noninteraction patch properly.## Revision 1.35  2004/08/03 23:23:55  mcr# 	set default value for NONINTCONFIG.## Revision 1.34  2004/07/26 15:05:34  mcr# 	introduce kernel versioning to the UML setup script.## Revision 1.33  2004/04/03 19:44:52  ken# FREESWANSRCDIR -> OPENSWANSRCDIR (patch by folken)## Revision 1.32  2004/02/03 03:33:08  mcr# 	apply NAT-T patch unless we are told not to (maybe it is# 	already applied)## Revision 1.31  2003/04/10 02:41:15  mcr# 	fix location of </dev/null redirects.## Revision 1.30  2003/04/09 04:21:52  build# 	make sure that stdin is /dev/null when building kernels to# 	keep "rm" from thinking it should prompt!## Revision 1.29  2003/04/03 23:41:46  mcr# 	note if we couldn't find a patch we were told exists## Revision 1.28  2002/12/18 17:33:33  mcr# 	apply local patches, if any are found.## Revision 1.27  2002/11/11 02:44:25  mcr# 	add ability to provide per-UML-patch patches in case we need# 	to use a particular iteration of UML, but there are still# 	problems with it.## Revision 1.26  2002/08/26 15:37:27  mcr# 	used wrong sense when looking for NONINTPATCH, -z is needed.## Revision 1.25  2002/08/25 19:39:15  mcr# 	added missing "then" to NONINTPATCH test.## Revision 1.24  2002/08/25 17:39:45  mcr# 	apply the RH nonint-config patch if we can find it# 	either in $TESTINGROOT, or via $NONINTPATCH.## Revision 1.23  2002/08/05 00:27:43  mcr# 	do not install FreeSWAN for "regular hosts"## Revision 1.22  2002/08/02 22:33:30  mcr# 	call setup_make for common makefile portions.## Revision 1.21  2002/07/29 02:46:09  mcr# 	move setting of TESTINGROOT to before setup_host_make where it# 	is in fact used.# 	make the regular hosts after making their kernel.## Revision 1.20  2002/07/29 01:02:20  mcr# 	instead of actually doing all the operations, build# 	a makefile in $POOLSPACE that will do it whenever necessary.## Revision 1.18  2002/06/17 04:23:13  mcr# 	make-uml.sh is mature enough to not need set -x now.## Revision 1.17  2002/06/03 01:23:36  mcr# 	added "nopromptgo" and "rcf" to provide documented "oldgo" and "ocf"# 	functionality.# 	"oldgo" and "ocf" now will permit interaction with the user as# 	permitted (and undocumented) by many users.## Revision 1.16  2002/04/24 07:55:32  mcr# 	#include patches and Makefiles for post-reorg compilation.## Revision 1.15  2002/04/05 01:21:39  mcr# 	make-uml script was building statically linked FreeSWAN kernels# 	only by fluke - turns out that "make oldconfig" blows away# 	any options in .config that weren't defined. Thus, the initial# 	build of a non-SWAN kernel before building FreeSWAN would# 	blow away the CONFIG_IPSEC options- specifically the CONFIG_IPSEC=y# 	(vs =m). This worked before because "make insert" put the# 	options back in, but now that the default has changed to modules,# 	the it defaults the wrong way.# 	Solution: copy the .config file in again after the plain build.## Revision 1.14  2002/04/03 23:42:18  mcr# 	force copy of swan kernel config file to get right IPSEC=y options.# 	redirect some build output to a local file.## Revision 1.13  2002/02/16 20:56:06  rgb# Force make programs so UML does not depend on top level make programs.## Revision 1.12  2002/02/13 21:39:16  mcr# 	change to use uml*.config files instead.# 	uml*.config files have been updated for 2.4.7-10 UML patch.## Revision 1.11  2002/01/11 05:26:03  rgb# Fixed missing semicolon bug.## Revision 1.10  2001/11/27 05:36:30  mcr# 	just look for a kernel in build directory. This# 	type of "optomization" is dumb - it should be a makefile.## Revision 1.9  2001/11/23 00:36:01  mcr# 	take $FREESWANDIR as command line argument.# 	use HS's "devready" instead of fudging our own.## Revision 1.8  2001/11/22 05:46:07  henry# new version stuff makes version.c obsolete## Revision 1.7  2001/11/07 20:10:20  mcr# 	revised setup comments after RGB consultation.# 	removed all non-variables from umlsetup-sample.sh.## Revision 1.6  2001/11/07 19:25:17  mcr# 	split out some functions from make-uml.## Revision 1.5  2001/10/28 23:52:22  mcr# 	pathnames need to be fully qualified.## Revision 1.4  2001/10/23 16:32:08  mcr# 	make log files unique to each UML.## Revision 1.3  2001/10/15 05:41:46  mcr# 	moved variables for UML setup to common file.# 	provided sample of this file.## Revision 1.2  2001/09/25 01:09:53  mcr# 	some minor changes to whether to run "KERNDEP"## Revision 1.1  2001/09/25 00:52:16  mcr# 	a script to build a UML+FreeSWAN testing environment.##    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -