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

📄 shtool

📁 linux下的E_MAIL客户端源码
💻
📖 第 1 页 / 共 2 页
字号:
##case $tool ininstall )    ##    ##  install -- Install a program, script or datafile    ##  Copyright (c) 1997-2000 Ralf S. Engelschall <rse@engelschall.com>    ##  Originally written for shtool    ##        #   determine source(s) and destination     argc=$#    srcs=""    while [ $# -gt 1 ]; do        srcs="$srcs $1"        shift    done    dstpath="$1"        #   type check for destination    dstisdir=0    if [ -d $dstpath ]; then        dstpath=`echo "$dstpath" | sed -e 's:/$::'`        dstisdir=1    fi        #   consistency check for destination    if [ $argc -gt 2 -a $dstisdir = 0 ]; then        echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2        exit 1    fi        #   iterate over all source(s)    for src in $srcs; do        dst=$dstpath            #  If destination is a directory, append the input filename        if [ $dstisdir = 1 ]; then            dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`            dst="$dst/$dstfile"        fi            #  Add a possible extension to src and dst        if [ ".$opt_e" != . ]; then            src="$src$opt_e"            dst="$dst$opt_e"        fi            #  Check for correct arguments        if [ ".$src" = ".$dst" ]; then            echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2            continue        fi        if [ -d "$src" ]; then            echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2            continue        fi            #  Make a temp file name in the destination directory        dsttmp=`echo $dst |\                sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \                    -e "s;\$;/#INST@$$#;"`            #  Verbosity        if [ ".$opt_v" = .yes ]; then            echo "$src -> $dst" 1>&2        fi            #  Copy or move the file name to the temp name        #  (because we might be not allowed to change the source)        if [ ".$opt_C" = .yes ]; then            opt_c=yes        fi        if [ ".$opt_c" = .yes ]; then            if [ ".$opt_t" = .yes ]; then                echo "cp $src $dsttmp" 1>&2            fi            cp $src $dsttmp || exit $?        else            if [ ".$opt_t" = .yes ]; then                echo "mv $src $dsttmp" 1>&2            fi            mv $src $dsttmp || exit $?        fi            #  Adjust the target file        #  (we do chmod last to preserve setuid bits)        if [ ".$opt_s" = .yes ]; then            if [ ".$opt_t" = .yes ]; then                echo "strip $dsttmp" 1>&2            fi            strip $dsttmp || exit $?        fi        if [ ".$opt_o" != . ]; then            if [ ".$opt_t" = .yes ]; then                echo "chown $opt_o $dsttmp" 1>&2            fi            chown $opt_o $dsttmp || exit $?        fi        if [ ".$opt_g" != . ]; then            if [ ".$opt_t" = .yes ]; then                echo "chgrp $opt_g $dsttmp" 1>&2            fi            chgrp $opt_g $dsttmp || exit $?        fi        #   If no mode set explicitly, assume 755        if [ ".$opt_m" = . ]; then            opt_m="755"        fi        if [ ".$opt_t" = .yes ]; then            echo "chmod $opt_m $dsttmp" 1>&2        fi        chmod $opt_m $dsttmp || exit $?            #   Determine whether to do a quick install        #   (has to be done _after_ the strip was already done)        quick=no        if [ ".$opt_C" = .yes ]; then            if [ -r $dst ]; then                if cmp -s $src $dst; then                    quick=yes                fi            fi        fi            #   Finally install the file to the real destination        if [ $quick = yes ]; then            if [ ".$opt_t" = .yes ]; then                echo "rm -f $dsttmp" 1>&2            fi            rm -f $dsttmp        else            if [ ".$opt_t" = .yes ]; then                echo "rm -f $dst && mv $dsttmp $dst" 1>&2            fi            rm -f $dst && mv $dsttmp $dst        fi    done    ;;mkdir )    ##    ##  mkdir -- Make one or more directories    ##  Copyright (c) 1996-2000 Ralf S. Engelschall <rse@engelschall.com>    ##  Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>    ##  Cleaned up and enhanced for shtool    ##        errstatus=0    for p in ${1+"$@"}; do        #   if the directory already exists...        if [ -d "$p" ]; then            if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then                echo "$msgprefix:Error: directory already exists: $p" 1>&2                errstatus=1                break            else                continue            fi        fi        #   if the directory has to be created...        if [ ".$opt_p" = .no ]; then            if [ ".$opt_t" = .yes ]; then                echo "mkdir $p" 1>&2            fi            mkdir $p || errstatus=$?        else            #   the smart situation            set fnord `echo ":$p" |\                       sed -e 's/^:\//%/' \                           -e 's/^://' \                           -e 's/\// /g' \                           -e 's/^%/\//'`            shift            pathcomp=''            for d in ${1+"$@"}; do                pathcomp="$pathcomp$d"                case "$pathcomp" in                    -* ) pathcomp="./$pathcomp" ;;                esac                if [ ! -d "$pathcomp" ]; then                    if [ ".$opt_t" = .yes ]; then                        echo "mkdir $pathcomp" 1>&2                    fi                    mkdir $pathcomp || errstatus=$?                    if [ ".$opt_m" != . ]; then                        if [ ".$opt_t" = .yes ]; then                            echo "chmod $opt_m $pathcomp" 1>&2                        fi                        chmod $opt_m $pathcomp || errstatus=$?                    fi                fi                pathcomp="$pathcomp/"            done        fi    done    exit $errstatus    ;;mkshadow )    ##    ##  mkshadow -- Make a shadow tree through symbolic links    ##  Copyright (c) 1998-2000 Ralf S. Engelschall <rse@engelschall.com>    ##  Originally written for Apache    ##        #   source and destination directory    src=`echo "$1" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'`    dst=`echo "$2" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'`        #   check whether source exists    if [ ! -d $src ]; then        echo "$msgprefix:Error: source directory not found: \`$src'" 1>&2        exit 1    fi        #   determine if one of the paths is an absolute path,    #   because then we have to use an absolute symlink    oneisabs=0    case $src in        /* ) oneisabs=1 ;;    esac    case $dst in        /* ) oneisabs=1 ;;    esac        #   determine reverse directory for destination directory    dstrevdir=''    if [ $oneisabs = 0 ]; then        #   derive reverse path from forward path        pwd=`pwd`        OIFS="$IFS"; IFS='/'        for pe in $dst; do            if [ "x$pe" = "x.." ]; then                OIFS2="$IFS"; IFS="$DIFS"                eval `echo "$pwd" |\                      sed -e 's:\([^/]*\)$:; dir="\1":' \                          -e 's:^\(.*\)/[^/]*;:pwd="\1";:'\                          -e 's:^;:pwd="";:'`                dstrevdir="$dir/$dstrevdir"                IFS="$OIFS2"            else                dstrevdir="../$dstrevdir"            fi        done        IFS="$OIFS"    else        src="`cd $src; pwd`";    fi        #   create directory tree at destination    if [ ! -d $dst ]; then        if [ ".$opt_t" = .yes ]; then            echo "mkdir $dst" 1>&2        fi        mkdir $dst    fi    if [ ".$opt_a" = .yes ]; then        DIRS=`cd $src; find . -type d -print |\              sed -e '/^\.$/d' -e 's:^\./::'`    else        DIRS=`cd $src; find . -type d -print |\              sed -e '/\/CVS/d' -e '/^\.$/d' -e 's:^\./::'`    fi    for dir in $DIRS; do        if [ ".$opt_t" = .yes ]; then            echo "mkdir $dst/$dir" 1>&2        fi        mkdir $dst/$dir    done        #   fill directory tree with symlinks to files    if [ ".$opt_a" = .yes ]; then        FILES="`cd $src; find . -depth -print |\                sed -e 's/^\.\///'`"    else        FILES="`cd $src; find . -depth -print |\                sed -e '/\.o$/d' -e '/\.a$/d' -e '/\.so$/d' \                    -e '/\.cvsignore$/d' -e '/\/CVS/d' \                    -e '/\/\.#/d' -e '/\.orig$/d' \                    -e 's/^\.\///'`"    fi    for file in $FILES; do         #  don't use `-type f' above for find because of symlinks         if [ -d "$src/$file" ]; then             continue         fi         basename=`echo $file | sed -e 's:^.*/::'`         dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'`         from=`echo "$src/$file" | sed -e 's/^\.\///'`         to="$dst/$dir$basename"         if [ $oneisabs = 0 ]; then             if [ ".$dir" != . ]; then                 subdir=`echo $dir | sed -e 's:/$::'`                 #   derive reverse path from forward path                 revdir=''                 OIFS="$IFS"; IFS='/'                 for pe in $subdir; do                     revdir="../$revdir"                 done                 IFS="$OIFS"                 #   finalize from                 from="$revdir$from"             fi             from="$dstrevdir$from"         fi         if [ ".$opt_v" = .yes ]; then             echo "    $to" 1>&2         fi         if [ ".$opt_t" = .yes ]; then             echo "ln -s $from $to" 1>&2         fi         ln -s $from $to    done    ;;esacexit 0##EOF##

⌨️ 快捷键说明

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