📄 mkdist
字号:
#! /bin/bash -## mkdist - make a distribution directory from a master manifest file## usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version## SRCDIR defaults to src# MANIFEST defaults to $SRCDIR/MANIFEST## Chet Ramey# chet@po.cwru.edu# Copyright (C) 1996-2002 Free Software Foundation, Inc.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.SRCDIR=srcROOTNAME=bashusage(){ echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version 1>&2 exit 2}vmsg(){ if [ -n "$verbose" ]; then echo mkdist: "$@" fi}while getopts m:s:r:v namedo case $name in m) MANIFEST=$OPTARG ;; s) SRCDIR=$OPTARG ;; r) ROOTNAME=$OPTARG ;; v) verbose=yes ;; ?) usage ;; esacdone: ${MANIFEST:=$SRCDIR/MANIFEST}vmsg using $MANIFESTshift $(( $OPTIND - 1 ))if [ $# -lt 1 ]; then usagefiversion=$1newdir=${ROOTNAME}-$versionvmsg creating distribution for $ROOTNAME version $version in $newdirif [ ! -d $newdir ]; then mkdir $newdir || { echo $0: cannot make directory $newdir 1>&2 ; exit 1; }fidirmode=755filmode=644while read fname type modedo [ -z "$fname" ] && continue case "$fname" in \#*) continue ;; esac case "$type" in d) mkdir $newdir/$fname ;; f) cp -p $SRCDIR/$fname $newdir/$fname ;; s) ln -s $mode $newdir/$fname ; mode= ;; # symlink l) ln $mode $newdir/$fname ; mode= ;; # hard link *) echo "unknown file type $type" 1>&2 ;; esac if [ -n "$mode" ]; then chmod $mode $newdir/$fname fidone < $MANIFEST# cut off the `-alpha' in something like `2.0-alpha', leaving just the# numeric version#version=${version%%-*}#case "$version" in#*.*.*) vers=${version%.*} ;;#*.*) vers=${version} ;;#esac#echo $vers > $newdir/.distribution#case "$version" in#*.*.*) plevel=${version##*.} ;;#*) plevel=0 ;;#esac#[ -z "$plevel" ] && plevel=0#echo ${plevel} > $newdir/.patchlevelvmsg $newdir createdexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -