Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=MITgcm at /usr/local/share/lxr/lib/LXR/Common.pm line 1224.
Last-Modified: Sat, 26 Dec 2025 06:09:09 GMT
Content-Type: text/html; charset=utf-8
MITgcm/MITgcm/tools/mpack-1.6/install-sh
ec6cf3b09d Ed H*0001 #!/bin/sh
0002 #
0003 # install - install a program, script, or datafile
0004 # This comes from X11R5 (mit/util/scripts/install.sh).
0005 #
0006 # Copyright 1991 by the Massachusetts Institute of Technology
0007 #
0008 # Permission to use, copy, modify, distribute, and sell this software and its
0009 # documentation for any purpose is hereby granted without fee, provided that
0010 # the above copyright notice appear in all copies and that both that
0011 # copyright notice and this permission notice appear in supporting
0012 # documentation, and that the name of M.I.T. not be used in advertising or
0013 # publicity pertaining to distribution of the software without specific,
0014 # written prior permission. M.I.T. makes no representations about the
0015 # suitability of this software for any purpose. It is provided "as is"
0016 # without express or implied warranty.
0017 #
0018 # Calling this script install-sh is preferred over install.sh, to prevent
0019 # `make' implicit rules from creating a file called install from it
0020 # when there is no Makefile.
0021 #
0022 # This script is compatible with the BSD install script, but was written
0023 # from scratch. It can only install one file at a time, a restriction
0024 # shared with many OS's install programs.
002500260027 # set DOITPROG to echo to test this script
00280029 # Don't use :- since 4.3BSD and earlier shells don't like it.
0030 doit="${DOITPROG-}"
003100320033 # put in absolute paths if you don't have them in your path; or use env. vars.
00340035 mvprog="${MVPROG-mv}"
0036 cpprog="${CPPROG-cp}"
0037 chmodprog="${CHMODPROG-chmod}"
0038 chownprog="${CHOWNPROG-chown}"
0039 chgrpprog="${CHGRPPROG-chgrp}"
0040 stripprog="${STRIPPROG-strip}"
0041 rmprog="${RMPROG-rm}"
0042 mkdirprog="${MKDIRPROG-mkdir}"
00430044 transformbasename=""
0045 transform_arg=""
0046 instcmd="$mvprog"
0047 chmodcmd="$chmodprog 0755"
0048 chowncmd=""
0049 chgrpcmd=""
0050 stripcmd=""
0051 rmcmd="$rmprog -f"
0052 mvcmd="$mvprog"
0053 src=""
0054 dst=""
0055 dir_arg=""
00560057 while [ x"$1" != x ]; do
0058 case $1 in
0059 -c) instcmd="$cpprog"
0060 shift
0061 continue;;
00620063 -d) dir_arg=true
0064 shift
0065 continue;;
00660067 -m) chmodcmd="$chmodprog $2"
0068 shift
0069 shift
0070 continue;;
00710072 -o) chowncmd="$chownprog $2"
0073 shift
0074 shift
0075 continue;;
00760077 -g) chgrpcmd="$chgrpprog $2"
0078 shift
0079 shift
0080 continue;;
00810082 -s) stripcmd="$stripprog"
0083 shift
0084 continue;;
00850086 -t=*) transformarg=`echo $1 | sed 's/-t=//'`
0087 shift
0088 continue;;
00890090 -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
0091 shift
0092 continue;;
00930094 *) if [ x"$src" = x ]
0095 then
0096 src=$1
0097 else
0098 # this colon is to work around a 386BSD /bin/sh bug
0099 :
0100 dst=$1
0101 fi
0102 shift
0103 continue;;
0104 esac
0105 done
01060107 if [ x"$src" = x ]
0108 then
0109 echo "install: no input file specified"
0110 exit 1
0111 else
0112 true
0113 fi
01140115 if [ x"$dir_arg" != x ]; then
0116 dst=$src
0117 src=""
01180119 if [ -d $dst ]; then
0120 instcmd=:
0121 chmodcmd=""
0122 else
0123 instcmd=mkdir
0124 fi
0125 else
01260127 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
0128 # might cause directories to be created, which would be especially bad
0129 # if $src (and thus $dsttmp) contains '*'.
01300131 if [ -f $src -o -d $src ]
0132 then
0133 true
0134 else
0135 echo "install: $src does not exist"
0136 exit 1
0137 fi
01380139 if [ x"$dst" = x ]
0140 then
0141 echo "install: no destination specified"
0142 exit 1
0143 else
0144 true
0145 fi
01460147 # If destination is a directory, append the input filename; if your system
0148 # does not like double slashes in filenames, you may need to add some logic
01490150 if [ -d $dst ]
0151 then
0152 dst="$dst"/`basename $src`
0153 else
0154 true
0155 fi
0156 fi
01570158 ## this sed command emulates the dirname command
0159 dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
01600161 # Make sure that the destination directory exists.
0162 # this part is taken from Noah Friedman's mkinstalldirs script
01630164 # Skip lots of stat calls in the usual case.
0165 if [ ! -d "$dstdir" ]; then
0166 defaultIFS='
0167 '
0168 IFS="${IFS-${defaultIFS}}"
01690170 oIFS="${IFS}"
0171 # Some sh's can't handle IFS=/ for some reason.
0172 IFS='%'
0173 set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
0174 IFS="${oIFS}"
01750176 pathcomp=''
01770178 while [ $# -ne 0 ] ; do
0179 pathcomp="${pathcomp}${1}"
0180 shift
01810182 if [ ! -d "${pathcomp}" ] ;
0183 then
0184 $mkdirprog "${pathcomp}"
0185 else
0186 true
0187 fi
01880189 pathcomp="${pathcomp}/"
0190 done
0191 fi
01920193 if [ x"$dir_arg" != x ]
0194 then
0195 $doit $instcmd $dst &&
01960197 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
0198 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
0199 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
0200 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
0201 else
02020203 # If we're going to rename the final executable, determine the name now.
02040205 if [ x"$transformarg" = x ]
0206 then
0207 dstfile=`basename $dst`
0208 else
0209 dstfile=`basename $dst $transformbasename |
0210 sed $transformarg`$transformbasename
0211 fi
02120213 # don't allow the sed command to completely eliminate the filename
02140215 if [ x"$dstfile" = x ]
0216 then
0217 dstfile=`basename $dst`
0218 else
0219 true
0220 fi
02210222 # Make a temp file name in the proper directory.
02230224 dsttmp=$dstdir/#inst.$$#
02250226 # Move or copy the file name to the temp name
02270228 $doit $instcmd $src $dsttmp &&
02290230 trap "rm -f ${dsttmp}" 0 &&
02310232 # and set any options; do chmod last to preserve setuid bits
02330234 # If any of these fail, we abort the whole thing. If we want to
0235 # ignore errors from any of these, just make sure not to ignore
0236 # errors from the above "$doit $instcmd $src $dsttmp" command.
02370238 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
0239 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
0240 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
0241 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
02420243 # Now rename the file to the real destination.
02440245 $doit $rmcmd -f $dstdir/$dstfile &&
0246 $doit $mvcmd $dsttmp $dstdir/$dstfile
02470248 fi &&
024902500251 exit 0