📄 patch_script.sh
字号:
######################################################################### # # # AUTHORIZATION TO USE AND DISTRIBUTE # # # # Redistribution and use in source and binary forms, with or without # # modification, are permitted provided that: # # # # (1) source code distributions retain this paragraph in its entirety, # # # # (2) distributions including binary code include this paragraph in # # its entirety in the documentation or other materials provided # # with the distribution, and # # # # (3) all advertising materials mentioning features or use of this # # software display the following acknowledgment: # # # # "This product includes software written and developed # # by Ian Downard of the Naval Research Laboratory (NRL)." # # # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR # # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ################################################################################### AUTHOR: Tiago Camilo Based on work made by: Ian Downard# DATE: Mar 2005## PURPOSE:## This script will patch the standard ns-2.27 or ns-2.28 distribution so that it # includes Source Specific extension.## PRECONDITIONS:## This script must be run BEFORE the ns-allinone-27/8/install script is run.# # This script should be run BEFORE any modifications are made to any file in # the ns-allinone archive distributed by USC/ISI. Otherwise, some of the # patches might fail.#################################################################################!/usr/bin/perlecho ""echo "CHECKING PATH AND PERMISSIONS ON ../ns-allinone-2.27/"echo ""if [ -d "../ns-allinone-2.27/" ] && [ -x "../ns-allinone-2.27/" ]; then echo "Trying to patch ../ns-allinone-2.27/..." echo "PATH AND PERMISSIONS ARE GOOD" echo "" VERSION=2.27else echo "" echo "CHECKING PATH AND PERMISSIONS ON ../ns-allinone-2.28/" echo "" if [ -d "../ns-allinone-2.28/" ] && [ -x "../ns-allinone-2.28/" ]; then echo "Trying to patch ../ns-allinone-2.28/..." echo "PATH AND PERMISSIONS ARE GOOD" echo "" VERSION=2.28 else echo "3333333333" echo "PATH AND/OR PERMISSIONS ARE INCORRECT!!!" echo "Be sure ../ns-allinone-2.27 or ../ns-allinone-2.28 exists and you have write permissions to it." echo "" echo " ABORTING !!!" echo "" exit 1 fifiecho ""sleep 2echo "Checking for recently modified files in ns2 tree..."if [ "`find ../ns-allinone-$VERSION -mtime -30`" ]; then echo "WARNING!!! IT IS POSSIBLE THAT EXISTS MODIFIED FILES IN THE ../ns-allinone-$VERSION TREE!" echo "PATCHES MAY NOT WORK CORRECTLY ON ALREADY MODIFIED FILES!" echo "" echo "Do you want to try anyway? (yes/no)" read answer if [ "$answer" = "yes" ]; then echo "" echo "Okay, trying anyway..." WARNING="1"; sleep 2 elif [ "$answer" = "no" ]; then echo "" echo " Aborting!" echo "" exit 1 else echo "" echo "Answer must be \"yes\" or \"no\". Assuming no." echo "" echo " Aborting!" echo "" exit 1 fifiecho " NS2 tree is unmodified. Continueing..."echo ""echo "COPYING ssm-mcast DIRECTORIE TO ../ns-allinone-$VERSION/tcl"echo ""sleep 2cp -R -v ssm-mcast ../ns-allinone-$VERSION/ns-$VERSION/tclecho ""echo "DONE COPYING DIRECTORIES"echo ""echo ""echo "PATCHING ns-allinone-$VERSION."echo ""sleep 2patch -b --verbose ../ns-allinone-$VERSION/ns-$VERSION/Makefile.in patches/$VERSION/Makefile.in-patchpatch -b --verbose ../ns-allinone-$VERSION/ns-$VERSION/tcl/lib/ns-packet.tcl patches/$VERSION/ns-packet.tcl-patchpatch -b --verbose ../ns-allinone-$VERSION/ns-$VERSION/tcl/lib/ns-lib.tcl patches/$VERSION/ns-lib.tcl-patchpatch -b --verbose ../ns-allinone-$VERSION/ns-$VERSION/tcl/mcast/ns-mcast.tcl patches/$VERSION/ns-mcast.tcl-patchecho ""echo "PATCHING FINISHED."echo "ORIGINAL FILES BACKED UP TO:"find .. -name "*.orig"echo ""echo "Now cd ../ns-allinone-$VERSION/ns-$VERSION/ and run the install script. (configure; make;)"echo ""echo " Finished."echo ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -