diff options
author | bk@work.mysql.com <> | 2000-07-31 21:29:14 +0200 |
---|---|---|
committer | bk@work.mysql.com <> | 2000-07-31 21:29:14 +0200 |
commit | f4c589ff6c653d1d2a09c26e46ead3c8a15655d8 (patch) | |
tree | d253a359142dfc1ed247d5d4365d86972ea31109 /dbug/install.sh | |
parent | 7eec25e393727b16bb916b50d82b0aa3084e065c (diff) | |
download | mariadb-git-f4c589ff6c653d1d2a09c26e46ead3c8a15655d8.tar.gz |
Import changeset
Diffstat (limited to 'dbug/install.sh')
-rw-r--r-- | dbug/install.sh | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/dbug/install.sh b/dbug/install.sh new file mode 100644 index 00000000000..7226e01b1cf --- /dev/null +++ b/dbug/install.sh @@ -0,0 +1,64 @@ + +# WARNING -- first line intentionally left blank for sh/csh/ksh +# compatibility. Do not remove it! FNF, UniSoft Systems. +# +# Usage is: +# install <from> <to> +# +# The file <to> is replaced with the file <from>, after first +# moving <to> to a backup file. The backup file name is created +# by prepending the filename (after removing any leading pathname +# components) with "OLD". +# +# This script is currently not real robust in the face of signals +# or permission problems. It also does not do (by intention) all +# the things that the System V or BSD install scripts try to do +# + +if [ $# -ne 2 ] +then + echo "usage: $0 <from> <to>" + exit 1 +fi + +# Now extract the dirname and basename components. Unfortunately, BSD does +# not have dirname, so we do it the hard way. + +fd=`expr $1'/' : '\(/\)[^/]*/$' \| $1'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \| .` +ff=`basename $1` +td=`expr $2'/' : '\(/\)[^/]*/$' \| $2'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \| .` +tf=`basename $2` + +# Now test to make sure that they are not the same files. + +if [ $fd/$ff = $td/$tf ] +then + echo "install: input and output are same files" + exit 2 +fi + +# Save a copy of the "to" file as a backup. + +if test -f $td/$tf +then + if test -f $td/OLD$tf + then + rm -f $td/OLD$tf + fi + mv $td/$tf $td/OLD$tf + if [ $? != 0 ] + then + exit 3 + fi +fi + +# Now do the copy and return appropriate status + +cp $fd/$ff $td/$tf +if [ $? != 0 ] +then + exit 4 +else + exit 0 +fi + |