📄 install-viewer.in
字号:
#!/bin/sh## This script has to be built by configure.## This is a script to install Jumpshot-3. It can be invoked with## make install ( if you used -prefix at configure time ) ## or,## make install PREFIX=Path_to_the_installation_of_Jumpshot-3## in the top-level jumpshot-3 __build__ directory which could be the same # or different from the source directory#MAKE="@MAKE@"# Source locationstop_srcdir=@top_srcdir_abs@# Build locationslibbuild_dir=@libbuild_dir@binbuild_dir=@binbuild_dir@docbuild_dir=@docbuild_dir@logfilesbuild_dir=@logfilesbuild_dir@etcbuild_dir=@etcbuild_dir@sharebuild_dir=@sharebuild_dir@sbinbuild_dir=@sbinbuild_dir@swingbuild_dir=@swingbuild_dir@# Installation directories: Default paths (set at configure time)prefix=@prefix@exec_prefix=@exec_prefix@libdir=@libdir@bindir=@bindir@sbindir=@sbindir@datadir=@datadir@sysconfdir=@sysconfdir@docdir=$prefix/doclogfilesdir=$prefix/logfilesetcdir=$sysconfdirsharedir=$datadirif [ -n "$swingbuild_dir" ] ; then swingdir=$prefix/swingelse swingdir=fi# File access modeMODE=0644XMODE=0755replace=1# set failmode to soft to let failures accumulatefailmode="hard"# chmod can fail for various reasons. Let it?chmodfailmode="hard"Show=eval# set verbose to 0 to suppress success outputverbose=0just_testing=0prefix_override=0# filelist records files that have been installedfilelist=""# dirlist records directories createddirlist=""# initialize the error code return countererrs=0# The variable, appendUninstall, is to signal this script to allow uninstall# information to append to an existing uninstall file. Default is NO.appendUninstall=0# Set uninstall file# Should replace basename which is NOT available on all machine# For now, Unix machine which has JAVA should be new enough to have basename ?# Uninstall filenameif [ -z "$UNINSTALLFILE" ] ; then INSTALL_base=`basename $0` UNINSTALL_base=`echo $INSTALL_base | sed -e 's/install/uninstall/'` UNINSTALLFILE=${sbindir}/${UNINSTALL_base}fi# Update the $prefix if necessaryfor arg in "$@" ; do case "$arg" in -prefix=*) prefix=`echo $arg | sed -e 's/-prefix=//'` prefix_override=1 ;; -uninstall=*) UNINSTALLFILE=`echo A$arg | sed -e 's/A-uninstall=//g'` appendUninstall=1 ;; -mode=*) MODE=`echo $arg | sed -e 's/-mode=//g'` ;; -xmode=*) XMODE=`echo $arg | sed -e 's/-xmode=//g'` ;; -echo) set -x ;; -noreplace|-no_replace) replace=0 ;; -replace) replace=1 ;; -no_verbose|-noverbose) verbose=0 ;; -verbose) verbose=1 ;; -soft) failmode="soft" ; chmodfailmode="soft" ;; -hard) failmode="hard" ; chmodfailmode="hard" ;; -softchmod) chmodfailmode="soft" ;; -help|-u|-usage|-h)cat <<EOFInstall Jumpshot-3 into $prefix.-prefix=path - Destination directory.-uninstall=file - File to append uninstall information to-mode=nnnn - mode for regular files. Default is $MODE .-xmode=nnnn - mode for execuables and directories. Default is $XMODE .-noreplace - Do not replace files found in the installation directory-soft - Do not abort on failure-softchmod - Do not abort on failure of chmodEOF exit 1 ;; *) echo "install-viewer: Unrecognized argument $arg ." exit 1 ;; esacdoneif [ "$SHELL_ECHO" = "on" ] ; then set -xfi################################################################################ Start of Routines################################################################################ We could use install, but install is too different and too hard to # test. So here are the routines to copy file, make directories, and # replace #...# and @...@ in filesCP=cp#CopyFile() {if [ -z "$3" ] ; then mode=$MODEelse mode=$3fiif [ -d $2 ] ; then dest=$2/`basename $1`else dest=$2fiif [ $replace = 0 -a -f $dest ] ; then if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fielif [ -d $1 ] ; then echo ">>> $1 is a directory; not copied <<<" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit 1 ; fielif [ ! -f $1 ] ; then echo "**File $1 does not exist (or is not a regular file)!" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit 1 ; fielse if [ $verbose = 1 ] ; then echo "Copying $1 to $dest" ; fi # We don't delete the file in the event that we are copying the # file over itself (we SHOULD check for that separately, by checking # that directories are distinct) #if [ -f $dest ] ; then $Show /bin/rm -f $dest ; fi $Show $CP $1 $dest rc=$? if [ $rc != 0 ] ; then echo "**Error copying file $1 to $dest **" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else # store the destination filename copied filelist="$filelist $dest" fi $Show chmod $mode $dest rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on file $dest**" errs=`expr $errs + 1` if [ $chmodefailmode = "hard" ] ; then exit $rc ; fi fifi}## A version of copy file that preserves file datesCPRP=cpCopyFileP() { CP="$CPRP -p" CopyFile $1 $2 $3 CP=cp}## A version of recursive directory copy that preserves file dates# but does NOT copy CVS, old, tex directory. # $1 is the src directory, $2 is dest directory, $3 is $MODE or $XMODECopyDirRecurP() {if [ -n "$1" -a -n "$2" ] ; then if [ -d $1 ] ; then MkDir $2 # use $4 as a local variable # & set it as the original PWD before "cd $1" set $1 $2 ${3:-$MODE} `pwd` cd $1 for file in * ; do if [ -f $file -a ! -f $2/$file ] ; then CopyFileP $file $2/$file $3 fi done for dir in * ; do if [ -d $dir \ -a "$dir" != "CVS" -a "$dir" != "old" \ -a "$dir" != "tex" \ ] ; then CopyDirRecurP $dir $2/$dir $3 fi done # cd back where it comes from # counter the effect of "cd $1" above, # so "for" loop stiil works cd $4 fi fi}## Make the given directory. This handles building intermediate directories# as required, and maintains a list of created directories in dirlist.MkDir() {if [ ! -d $1 ] ; then dir=`echo $1 | sed 's%/% /%g'` path_to_date='' for path in $dir ; do path_to_date="$path_to_date$path" if [ ! -d $path_to_date ] ; then if [ $verbose = 1 ] ; then echo "Creating directory $1" ; fi $Show "mkdir $path_to_date" rc=$? if [ $rc != 0 ] ; then echo "**Error making directory $1**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi echo "Failed to create directory $path_to_date" exit 1 else # Note that we store in inverse order dirlist="$1 $dirlist" fi $Show chmod $XMODE $path_to_date rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on directory $path_to_date**" errs=`expr $errs + 1` if [ $chmodfailmode = "hard" ] ; then exit $rc ; fi fi fi donefi}## This is a version of FixupFile that handles @...@ instead of #...#.# This is a little trickier, since this file itself is processed by# with @...@ replacements. We take advantage of the fact that [char] # matches the same things as char.# This has a few more fields than FixupFile#FixupFileForInstall() { # Change the FIRST libpath to the new form. This allows # the LIB_PATH to contain multiple names, as long as the MPICH libpath # is firstif [ -d $2 ] ; then dest=$2/`basename $1`else dest=$2fiif [ $replace = 0 -a -f $dest ] ; then if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fielif [ -d $1 ] ; then echo "$1 is a directory; not copied"else if [ -f $dest ] ; then $Show /bin/rm -f $dest ; fi if [ $just_testing = 0 ] ; then sed \ -e "s%^SWING_LIBDIR=.*%SWING_LIBDIR=$swingdir%g" \ -e "s%^GUI_LIBDIR=.*%GUI_LIBDIR=$libdir%g" \ $1 > $dest rc=$? if [ $rc != 0 ] ; then echo "**Error fixing up file $dest**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else # store the destination filename copied filelist="$filelist $dest" fi else if [ $verbose = 1 ] ; then echo "Fixup $1.in and copy to $dest" ; fi fifiif [ -z "$3" ] ; then mode=$MODEelse mode=$3fi$Show chmod $mode $2rc=$?if [ $rc != 0 ] ; then echo "**Error setting mode on file $2**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fifi}################################################################################ End of Routines###############################################################################if [ ! -n "$prefix" ] ; then echo "Set an installation location with -prefix=<location> ." exit 1fiif [ $verbose = 1 ] ; then echo "Install into $prefix"fiif [ -d $prefix ] ; then if [ $verbose = 1 ] ; then echo "using existing directory $prefix" ; fielse MkDir $prefixfiif [ "$prefix_override" = 1 ] ; then libdir=$prefix/lib bindir=$prefix/bin sbindir=$prefix/sbin docdir=$prefix/doc logfilesdir=$prefix/logfiles etcdir=$prefix/etc sharedir=$prefix/share if [ -n "$swingbuild_dir" ] ; then swingdir=$prefix/swing else swingdir= fi if [ $appendUninstall = 0 ] ; then UNINSTALLFILE=${sbindir}/${UNINSTALL_base} fifi# echo "UNINSTALLFILE = $UNINSTALLFILE"MkDir $sbindirCopyFileP $sbinbuild_dir/exejar $sbindirif [ -f $sbindir/exejar ] ; then chmod u+x $sbindir/exejarfifor type in lib doc etc share logfiles swing ; do fromdir_name=${type}build_dir todir_name=${type}dir eval fromdir_value=\$"$fromdir_name" eval todir_value=\$"$todir_name" if [ -n "$fromdir_value" ] ; then if [ -d $fromdir_value ] ; then echo "Copying Jumpshot-3's $type" if [ $verbose = 1 ] ; then echo "$fromdir_value -> $todir_value" fi CopyDirRecurP $fromdir_value $todir_value $MODE fi fi doneif [ -n "$binbuild_dir" ] ; then if [ -d $binbuild_dir ] ; then MkDir $bindir if [ -x $binbuild_dir/jumpshot ] ; then FixupFileForInstall $binbuild_dir/jumpshot $bindir/jumpshot \ $XMODE fi if [ -x $binbuild_dir/slog_print ] ; then FixupFileForInstall $binbuild_dir/slog_print $bindir/slog_print \ $XMODE fi fifiCopyFileP $top_srcdir/README $prefixCopyFileP $top_srcdir/README.slog $prefixCopyFileP $top_srcdir/TourStepByStep.txt $prefixCopyFileP $top_srcdir/UserGuide.txt $prefix# Remove old uninstall file & Prepare the UNINSTALLFILE for appendingif [ $appendUninstall = 0 -a -f $UNINSTALLFILE ] ; then /bin/rm -f $UNINSTALLFILEfi## Open an uninstall file and force strong echo if one does NOT existif [ ! -f $UNINSTALLFILE ] ; then cat > $UNINSTALLFILE <<EOF#! /bin/shset -xEOFfichmod u+x $UNINSTALLFILE# Add the files to be removed to the UNINSTALLFILEfor file in $filelist ; do echo "/bin/rm -f $file" >> $UNINSTALLFILEdoneecho "/bin/rm -f $UNINSTALLFILE" >> $UNINSTALLFILE# Add the directories to be removed to the UNINSTALLFILEfor dir in $dirlist ; do echo "if [ -d $dir ] ; then rmdir $dir ; fi" >> $UNINSTALLFILEdone#echo "Installed Jumpshot-3 in $prefix"echo "$UNINSTALLFILE may be used to remove the installation"#if [ $errs -gt 0 ] ; then rc=1else rc=0fiexit $rc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -