📄 decipher-install
字号:
#!/bin/csh -f## File: decipher-install# Author: Tom Kuhn (original by Victor Abrash)# Date: Fri Aug 26 12:41:03 1994## Description:# This script installs files for submodules of the DECIPHER (TM) system, # when using the make release-* targets. ## It takes a variable number of arguments with this convention: ## decipher-install <mode> <file1> ... <fileN> <directory>## Copyright (c) 1994, SRI International. All Rights Reserved.## RCS ID: $Id: decipher-install,v 1.3 2000/06/08 18:30:31 stolcke Exp $## $Log: decipher-install,v $# Revision 1.3 2000/06/08 18:30:31 stolcke# backup recently used executables before installing new version## Revision 1.2 2000/06/08 17:51:18 stolcke# avoid ginstall and decipher-specific stuff## Revision 1.4 1995/02/22 01:46:58 tmk# Updates from Andreas' Solaris port## Revision 1.3 1994/12/03 23:54:44 decipher# Reorganized the error checking so usage message wasn't always printed.## Revision 1.2 1994/11/24 01:47:35 decipher# Revised to take variable number of arguments. Now uses ginstall instead# of each platforms' local install. More error checking added.## Revision 1.1 1994/08/26 22:24:38 victor# Initial revision### By using this flag, the script runs through all error checking and# reports all errors before exitingunset error# Set these variables now so diagnostic printing on errors works nicelyset FILES DIR MODE# this script can only be run by decipher:#if (`whoami` != decipher) then# echo "ERROR: installation must be done by user 'decipher'."# exit -1#endif# Get the arguments, check usage. Have to bail completely if there# aren't enough arguments.if ($#argv < 3) then echo "WARNING: There are arguments missing" exit -1endifset MODE = $1shiftset DIR = $argv[$#argv]while ($#argv > 1) set FILES = ($FILES $1) shiftend# we should check that these are valid:# First, check the modeif ($MODE !~ 0[1-7][1-7][1-7]) then echo "ERROR: Mode ($MODE) is not a valid permission setting" set errorendif# Now check each fileforeach FILE ($FILES) if (! -e ${FILE}) then echo "ERROR: File to be installed (${FILE}) does not exist." set error endif if (-z ${FILE}) then echo "ERROR: File to be installed (${FILE}) is zero length." set error endif if (! -f ${FILE}) then echo "ERROR: File to be installed (${FILE}) is not a plain file." set error endifendif (! -d ${DIR}) then echo "WARNING: creating directory ${DIR}" mkdir ${DIR}endif# Now check the directoryif (! -e ${DIR}) then echo "ERROR: Installation directory (${DIR}) does not exist." set errorendifif (! -d ${DIR}) then echo "ERROR: Installation target (${DIR}) is not a directory." set errorendifif (! -w ${DIR}) then echo "ERROR: Don't have write permission in installation directory (${DIR})." set errorendif# check that $DIR is a valid destination: # currently, this means we should be able to install files under# /include, /bin/, and /lib/ directories under /home/decipher:#@@ Get rid of '^' in egrep so /tmp_mnt prefix from NFS ok.#if (`echo ${DIR} | egrep '\/home\/decipher'` == "") then# echo "ERROR: You can install files only under /home/decipher"# set error#endifif (`echo ${DIR} | egrep '\/bin|\/include|\/lib\/'` == "") then echo "ERROR: You can install files only in .../include, .../bin/, or .../lib/ directories." set errorendif# Bail out if there have been errors:if ($?error) goto USAGE# Install the files:#echo "ginstall -p -m ${MODE} ${FILES} ${DIR}"#ginstall -p -m ${MODE} ${FILES} ${DIR} foreach file (${FILES}) set base = `basename $file` # remove executable backups not accessed in one day foreach file2 ( `find ${DIR} -name "$base.~[0-9]*" -perm -0500 -atime +1 -print` ) echo "removing old backup $file2" rm -f $file2 end # backup executables accessed within the last day foreach file2 ( `find ${DIR} -name $base -perm -0500 -atime -1 -print` ) echo "$file2 is in use; backing up to $file2.~$$" mv $file2 $file2.~$$ end rm -f ${DIR}/$base cp -p $file ${DIR} chmod ${MODE} ${DIR}/$baseend# exit:exit 0USAGE:echo "Usage: "`basename ${0}`" <mode> <file1> ... <fileN> <directory>"echo " mode: file permission mode, in octal"echo " file1 ... fileN: files to be installed"echo " directory: where the files should be installed"echo ""echo "files = " $FILESecho "directory = " $DIRecho "mode = " $MODEecho ""exit 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -