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

📄 mkbuildtree

📁 xen虚拟机源代码安装包
💻
字号:
#!/bin/bash# mkbuildtree <build tree>## Creates symbolic links in <build tree> for the sparse tree# in the current directory.# Script to determine the relative path between two directories.# Copyright (c) D. J. Hawkey Jr. 2002# Fixed for Xen project by K. Fraser in 2003.  abs_to_rel (){	local CWD SRCPATH                	if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then		SRCPATH=${1%?}	else		SRCPATH=$1	fi	if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then		DESTPATH=${2%?}	else		DESTPATH=$2	fi	CWD=$PWD	[ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD	[ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD	[ "$CWD" != "$PWD" ] && cd $CWD	BASEPATH=$SRCPATH	[ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return	[ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return	while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do          BASEPATH=${BASEPATH%/*}	done	SRCPATH=${SRCPATH#$BASEPATH}        DESTPATH=${DESTPATH#$BASEPATH}        DESTPATH=${DESTPATH#?}	while [ -n "$SRCPATH" ]; do		SRCPATH=${SRCPATH%/*}		DESTPATH="../$DESTPATH"	done	[ -z "$BASEPATH" ] && BASEPATH="/"	[ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}}# relative_lndir <target_dir># Creates a tree of symlinks in the current working directory that mirror# real files in <target_dir>. <target_dir> should be relative to the current# working directory. Symlinks in <target_dir> are ignored. Source-control files# are ignored.relative_lndir (){  local SYMLINK_DIR REAL_DIR pref i j  SYMLINK_DIR=$PWD  REAL_DIR=$1  (  cd $REAL_DIR  for i in `find . -type d | grep -v SCCS`; do    [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i    (    cd $i    pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`    for j in `find . -type f -o -type l -maxdepth 1`; do      ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j    done    )  done  )}[ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }# Get absolute path to the destination directorypushd . >/dev/nullcd ${1}AD=$PWDpopd >/dev/null  # Get absolute path to the source directoryAS=`pwd`# Get name of sparse directorySDN=$(basename $AS)# Get path to source, relative to destinationabs_to_rel ${AD} ${AS}RS=$DESTPATH# We now work from the destination directorycd ${AD}# Remove old symlinksfind sys -type l | while read fdo  case $(readlink $f) in  */$SDN/*)    rm -f $f    ;;  esacdoneif [ -f ${AD}/BUILDING ]; then  # Create symlinks of files and directories which exist in the sparse source  (cd sys && relative_lndir ../${RS}/sys)else  # Create symlinks of files and directories which exist in the sparse source  relative_lndir ${RS}  rm -f mkbuildtreefi

⌨️ 快捷键说明

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