mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Initial 'configure' based compilation (buildconf generates configure script).
This commit is contained in:
130
apache2/build/PrintPath
Executable file
130
apache2/build/PrintPath
Executable file
@@ -0,0 +1,130 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
#
|
||||
# Look for program[s] somewhere in $PATH.
|
||||
#
|
||||
# Options:
|
||||
# -s
|
||||
# Do not print out full pathname. (silent)
|
||||
# -pPATHNAME
|
||||
# Look in PATHNAME instead of $PATH
|
||||
#
|
||||
# Usage:
|
||||
# PrintPath [-s] [-pPATHNAME] program [program ...]
|
||||
#
|
||||
# Initially written by Jim Jagielski for the Apache configuration mechanism
|
||||
# (with kudos to Kernighan/Pike)
|
||||
|
||||
##
|
||||
# Some "constants"
|
||||
##
|
||||
pathname=$PATH
|
||||
echo="yes"
|
||||
|
||||
##
|
||||
# Find out what OS we are running for later on
|
||||
##
|
||||
os=`(uname) 2>/dev/null`
|
||||
|
||||
##
|
||||
# Parse command line
|
||||
##
|
||||
for args in $*
|
||||
do
|
||||
case $args in
|
||||
-s ) echo="no" ;;
|
||||
-p* ) pathname="`echo $args | sed 's/^..//'`" ;;
|
||||
* ) programs="$programs $args" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
##
|
||||
# Now we make the adjustments required for OS/2 and everyone
|
||||
# else :)
|
||||
#
|
||||
# First of all, all OS/2 programs have the '.exe' extension.
|
||||
# Next, we adjust PATH (or what was given to us as PATH) to
|
||||
# be whitespace separated directories.
|
||||
# Finally, we try to determine the best flag to use for
|
||||
# test/[] to look for an executable file. OS/2 just has '-r'
|
||||
# but with other OSs, we do some funny stuff to check to see
|
||||
# if test/[] knows about -x, which is the prefered flag.
|
||||
##
|
||||
|
||||
if [ "x$os" = "xOS/2" ]
|
||||
then
|
||||
ext=".exe"
|
||||
pathname=`echo -E $pathname |
|
||||
sed 's/^;/.;/
|
||||
s/;;/;.;/g
|
||||
s/;$/;./
|
||||
s/;/ /g
|
||||
s/\\\\/\\//g' `
|
||||
test_exec_flag="-r"
|
||||
else
|
||||
ext="" # No default extensions
|
||||
pathname=`echo $pathname |
|
||||
sed 's/^:/.:/
|
||||
s/::/:.:/g
|
||||
s/:$/:./
|
||||
s/:/ /g' `
|
||||
# Here is how we test to see if test/[] can handle -x
|
||||
testfile="pp.t.$$"
|
||||
|
||||
cat > $testfile <<ENDTEST
|
||||
#!/bin/sh
|
||||
if [ -x / ] || [ -x /bin ] || [ -x /bin/ls ]; then
|
||||
exit 0
|
||||
fi
|
||||
exit 1
|
||||
ENDTEST
|
||||
|
||||
if `/bin/sh $testfile 2>/dev/null`; then
|
||||
test_exec_flag="-x"
|
||||
else
|
||||
test_exec_flag="-r"
|
||||
fi
|
||||
rm -f $testfile
|
||||
fi
|
||||
|
||||
for program in $programs
|
||||
do
|
||||
for path in $pathname
|
||||
do
|
||||
if [ $test_exec_flag $path/${program}${ext} ] && \
|
||||
[ ! -d $path/${program}${ext} ]; then
|
||||
if [ "x$echo" = "xyes" ]; then
|
||||
echo $path/${program}${ext}
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Next try without extension (if one was used above)
|
||||
if [ "x$ext" != "x" ]; then
|
||||
if [ $test_exec_flag $path/${program} ] && \
|
||||
[ ! -d $path/${program} ]; then
|
||||
if [ "x$echo" = "xyes" ]; then
|
||||
echo $path/${program}
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
exit 1
|
||||
|
54
apache2/build/buildcheck.sh
Executable file
54
apache2/build/buildcheck.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo "buildconf: checking installation..."
|
||||
|
||||
# autoconf 2.50 or newer
|
||||
ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;q'`
|
||||
if test -z "$ac_version"; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version 2.50 or newer installed"
|
||||
echo " to build APR from SVN."
|
||||
exit 1
|
||||
fi
|
||||
IFS=.; set $ac_version; IFS=' '
|
||||
if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoconf version $ac_version found."
|
||||
echo " You need autoconf version 2.50 or newer installed"
|
||||
echo " to build APR from SVN."
|
||||
exit 1
|
||||
else
|
||||
echo "buildconf: autoconf version $ac_version (ok)"
|
||||
fi
|
||||
|
||||
# Sample libtool --version outputs:
|
||||
# ltmain.sh (GNU libtool) 1.3.3 (1.385.2.181 1999/07/02 15:49:11)
|
||||
# ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
|
||||
# output is multiline from 1.5 onwards
|
||||
|
||||
# Require libtool 1.4 or newer
|
||||
libtool=`build/PrintPath glibtool libtool libtool15 libtool14`
|
||||
lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
|
||||
if test -z "$lt_pversion"; then
|
||||
echo "buildconf: libtool not found."
|
||||
echo " You need libtool version 1.4 or newer installed"
|
||||
echo " to build APR from SVN."
|
||||
exit 1
|
||||
fi
|
||||
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
|
||||
IFS=.; set $lt_version; IFS=' '
|
||||
lt_status="good"
|
||||
if test "$1" = "1"; then
|
||||
if test "$2" -lt "4"; then
|
||||
lt_status="bad"
|
||||
fi
|
||||
fi
|
||||
if test $lt_status = "good"; then
|
||||
echo "buildconf: libtool version $lt_pversion (ok)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "buildconf: libtool version $lt_pversion found."
|
||||
echo " You need libtool version 1.4 or newer installed"
|
||||
echo " to build APR from SVN."
|
||||
|
||||
exit 1
|
57
apache2/build/find_apr.m4
Normal file
57
apache2/build/find_apr.m4
Normal file
@@ -0,0 +1,57 @@
|
||||
dnl Check for APR Libraries
|
||||
dnl CHECK_APR(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||
dnl Sets:
|
||||
dnl APR_CFLAGS
|
||||
dnl APR_LIBS
|
||||
|
||||
APR_CONFIG="apr-config"
|
||||
APR_CFLAGS=""
|
||||
APR_LIBS=""
|
||||
|
||||
AC_DEFUN([CHECK_APR],
|
||||
[dnl
|
||||
|
||||
AC_ARG_WITH(
|
||||
apr,
|
||||
[AC_HELP_STRING([--with-apr=PATH],[Path to the apr prefix])],
|
||||
apr_path="$withval",
|
||||
:)
|
||||
|
||||
dnl # Determine apr lib directory
|
||||
if test -z "${apr_path}"; then
|
||||
test_paths="/usr/local /usr"
|
||||
else
|
||||
test_paths="${apr_path}"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for ${APR_CONFIG}])
|
||||
for x in ${test_paths}; do
|
||||
if test -e "${x}/bin/${APR_CONFIG}"; then
|
||||
with_apr="${x}"
|
||||
break
|
||||
else
|
||||
with_apr=""
|
||||
fi
|
||||
done
|
||||
if test -n "${with_apr}"; then
|
||||
APR_CONFIG="${with_apr}/bin/${APR_CONFIG}"
|
||||
AC_MSG_RESULT([${APR_CONFIG}])
|
||||
APR_CFLAGS="`${APR_CONFIG} --cflags`"
|
||||
APR_LIBS="`${APR_CONFIG} --libs`"
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_SUBST(APR_LIBS)
|
||||
AC_SUBST(APR_CFLAGS)
|
||||
|
||||
if test -z "${APR_LIBS}"; then
|
||||
AC_MSG_NOTICE([*** apr library not found.])
|
||||
ifelse([$2], , AC_MSG_ERROR([apr library is required]), $2)
|
||||
else
|
||||
AC_MSG_NOTICE([using '${APR_LIBS}' for apr Library])
|
||||
ifelse([$1], , , $1)
|
||||
fi
|
||||
])
|
57
apache2/build/find_apu.m4
Normal file
57
apache2/build/find_apu.m4
Normal file
@@ -0,0 +1,57 @@
|
||||
dnl Check for APU Libraries
|
||||
dnl CHECK_APU(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||
dnl Sets:
|
||||
dnl APU_CFLAGS
|
||||
dnl APU_LIBS
|
||||
|
||||
APU_CONFIG="apu-1-config"
|
||||
APU_CFLAGS=""
|
||||
APU_LIBS=""
|
||||
|
||||
AC_DEFUN([CHECK_APU],
|
||||
[dnl
|
||||
|
||||
AC_ARG_WITH(
|
||||
apu,
|
||||
[AC_HELP_STRING([--with-apu=PATH],[Path to the apu prefix])],
|
||||
apu_path="$withval",
|
||||
:)
|
||||
|
||||
dnl # Determine apu lib directory
|
||||
if test -z "${apu_path}"; then
|
||||
test_paths="/usr/local /usr"
|
||||
else
|
||||
test_paths="${apu_path}"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for ${APU_CONFIG}])
|
||||
for x in ${test_paths}; do
|
||||
if test -e "${x}/bin/${APU_CONFIG}"; then
|
||||
with_apu="${x}"
|
||||
break
|
||||
else
|
||||
with_apu=""
|
||||
fi
|
||||
done
|
||||
if test -n "${with_apu}"; then
|
||||
APU_CONFIG="${with_apu}/bin/${APU_CONFIG}"
|
||||
AC_MSG_RESULT([${APU_CONFIG}])
|
||||
APU_CFLAGS="`${APU_CONFIG} --cflags`"
|
||||
APU_LIBS="`${APU_CONFIG} --libs`"
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_SUBST(APU_LIBS)
|
||||
AC_SUBST(APU_CFLAGS)
|
||||
|
||||
if test -z "${APU_LIBS}"; then
|
||||
AC_MSG_NOTICE([*** apu library not found.])
|
||||
ifelse([$2], , AC_MSG_ERROR([apu library is required]), $2)
|
||||
else
|
||||
AC_MSG_NOTICE([using '${APU_LIBS}' for apu Library])
|
||||
ifelse([$1], , , $1)
|
||||
fi
|
||||
])
|
58
apache2/build/find_lua.m4
Normal file
58
apache2/build/find_lua.m4
Normal file
@@ -0,0 +1,58 @@
|
||||
dnl Check for LUA Libraries
|
||||
dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||
dnl Sets:
|
||||
dnl LUA_CFLAGS
|
||||
dnl LUA_LIBS
|
||||
|
||||
LUA_CONFIG="pkg-config"
|
||||
LUA_PKGNAME="lua5.1"
|
||||
LUA_CFLAGS=""
|
||||
LUA_LIBS=""
|
||||
|
||||
AC_DEFUN([CHECK_LUA],
|
||||
[dnl
|
||||
|
||||
AC_ARG_WITH(
|
||||
lua,
|
||||
[AC_HELP_STRING([--with-lua=PATH],[Path to the lua prefix])],
|
||||
lua_path="$withval",
|
||||
:)
|
||||
|
||||
dnl # Determine lua lib directory
|
||||
if test -z "${lua_path}"; then
|
||||
test_paths="/usr/local /usr"
|
||||
else
|
||||
test_paths="${lua_path}"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for ${LUA_CONFIG} for Lua])
|
||||
for x in ${test_paths}; do
|
||||
if test -e "${x}/bin/${LUA_CONFIG}"; then
|
||||
with_lua="${x}"
|
||||
break
|
||||
else
|
||||
with_lua=""
|
||||
fi
|
||||
done
|
||||
if test -n "${with_lua}"; then
|
||||
LUA_CONFIG="${with_lua}/bin/${LUA_CONFIG}"
|
||||
AC_MSG_RESULT([${LUA_CONFIG} ${LUA_PKGNAME}])
|
||||
LUA_CFLAGS="`${LUA_CONFIG} ${LUA_PKGNAME} --cflags`"
|
||||
LUA_LIBS="`${LUA_CONFIG} ${LUA_PKGNAME} --libs`"
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_SUBST(LUA_LIBS)
|
||||
AC_SUBST(LUA_CFLAGS)
|
||||
|
||||
if test -z "${LUA_LIBS}"; then
|
||||
AC_MSG_NOTICE([*** lua library not found.])
|
||||
ifelse([$2], , AC_MSG_ERROR([lua library is required]), $2)
|
||||
else
|
||||
AC_MSG_NOTICE([using '${LUA_LIBS}' for lua Library])
|
||||
ifelse([$1], , , $1)
|
||||
fi
|
||||
])
|
57
apache2/build/find_pcre.m4
Normal file
57
apache2/build/find_pcre.m4
Normal file
@@ -0,0 +1,57 @@
|
||||
dnl Check for PCRE Libraries
|
||||
dnl CHECK_PCRE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||
dnl Sets:
|
||||
dnl PCRE_CFLAGS
|
||||
dnl PCRE_LIBS
|
||||
|
||||
PCRE_CONFIG="pcre-config"
|
||||
PCRE_CFLAGS=""
|
||||
PCRE_LIBS=""
|
||||
|
||||
AC_DEFUN([CHECK_PCRE],
|
||||
[dnl
|
||||
|
||||
AC_ARG_WITH(
|
||||
pcre,
|
||||
[AC_HELP_STRING([--with-pcre=PATH],[Path to the pcre prefix])],
|
||||
pcre_path="$withval",
|
||||
:)
|
||||
|
||||
dnl # Determine pcre lib directory
|
||||
if test -z "${pcre_path}"; then
|
||||
test_paths="/usr/local /usr"
|
||||
else
|
||||
test_paths="${pcre_path}"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for ${PCRE_CONFIG}])
|
||||
for x in ${test_paths}; do
|
||||
if test -e "${x}/bin/${PCRE_CONFIG}"; then
|
||||
with_pcre="${x}"
|
||||
break
|
||||
else
|
||||
with_pcre=""
|
||||
fi
|
||||
done
|
||||
if test -n "${with_pcre}"; then
|
||||
PCRE_CONFIG="${with_pcre}/bin/${PCRE_CONFIG}"
|
||||
AC_MSG_RESULT([${PCRE_CONFIG}])
|
||||
PCRE_CFLAGS="`${PCRE_CONFIG} --cflags`"
|
||||
PCRE_LIBS="`${PCRE_CONFIG} --libs`"
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_SUBST(PCRE_LIBS)
|
||||
AC_SUBST(PCRE_CFLAGS)
|
||||
|
||||
if test -z "${PCRE_LIBS}"; then
|
||||
AC_MSG_NOTICE([*** pcre library not found.])
|
||||
ifelse([$2], , AC_MSG_ERROR([pcre library is required]), $2)
|
||||
else
|
||||
AC_MSG_NOTICE([using '${PCRE_LIBS}' for pcre Library])
|
||||
ifelse([$1], , , $1)
|
||||
fi
|
||||
])
|
57
apache2/build/find_xml.m4
Normal file
57
apache2/build/find_xml.m4
Normal file
@@ -0,0 +1,57 @@
|
||||
dnl Check for XML Libraries
|
||||
dnl CHECK_LIBXML(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||
dnl Sets:
|
||||
dnl LIBXML_CFLAGS
|
||||
dnl LIBXML_LIBS
|
||||
|
||||
LIBXML_CONFIG="xml2-config"
|
||||
LIBXML_CFLAGS=""
|
||||
LIBXML_LIBS=""
|
||||
|
||||
AC_DEFUN([CHECK_LIBXML],
|
||||
[dnl
|
||||
|
||||
AC_ARG_WITH(
|
||||
libxml,
|
||||
[AC_HELP_STRING([--with-libxml=PATH],[Path to the libxml2 prefix])],
|
||||
libxml_path="$withval",
|
||||
:)
|
||||
|
||||
dnl # Determine xml lib directory
|
||||
if test -z "${libxml_path}"; then
|
||||
test_paths="/usr/local /usr"
|
||||
else
|
||||
test_paths="${libxml_path}"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for ${LIBXML_CONFIG}])
|
||||
for x in ${test_paths}; do
|
||||
if test -e "${x}/bin/${LIBXML_CONFIG}"; then
|
||||
with_libxml="${x}"
|
||||
break
|
||||
else
|
||||
with_libxml=""
|
||||
fi
|
||||
done
|
||||
if test -n "${with_libxml}"; then
|
||||
LIBXML_CONFIG="${with_libxml}/bin/${LIBXML_CONFIG}"
|
||||
AC_MSG_RESULT([${LIBXML_CONFIG}])
|
||||
LIBXML_CFLAGS="`${LIBXML_CONFIG} --cflags`"
|
||||
LIBXML_LIBS="`${LIBXML_CONFIG} --libs`"
|
||||
CFLAGS=$save_CFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBXML_LIBS)
|
||||
AC_SUBST(LIBXML_CFLAGS)
|
||||
|
||||
if test -z "${LIBXML_LIBS}"; then
|
||||
AC_MSG_NOTICE([*** libxml2 library not found.])
|
||||
ifelse([$2], , AC_MSG_ERROR([libxml2 library is required]), $2)
|
||||
else
|
||||
AC_MSG_NOTICE([using '${LIBXML_LIBS}' for libxml Library])
|
||||
ifelse([$1], , , $1)
|
||||
fi
|
||||
])
|
224
apache2/build/install.sh
Executable file
224
apache2/build/install.sh
Executable file
@@ -0,0 +1,224 @@
|
||||
#!/bin/sh
|
||||
##
|
||||
## install.sh -- install a program, script or datafile
|
||||
##
|
||||
## Based on `install-sh' from the X Consortium's X11R5 distribution
|
||||
## as of 89/12/18 which is freely available.
|
||||
## Cleaned up for Apache's Autoconf-style Interface (APACI)
|
||||
## by Ralf S. Engelschall <rse@apache.org>
|
||||
##
|
||||
#
|
||||
# This script falls under the Apache License.
|
||||
# See http://www.apache.org/docs/LICENSE
|
||||
|
||||
|
||||
#
|
||||
# put in absolute paths if you don't have them in your path;
|
||||
# or use env. vars.
|
||||
#
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
|
||||
#
|
||||
# parse argument line
|
||||
#
|
||||
instcmd="$mvprog"
|
||||
chmodcmd=""
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
ext=""
|
||||
src=""
|
||||
dst=""
|
||||
while [ "x$1" != "x" ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift; continue
|
||||
;;
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-s) stripcmd="$stripprog"
|
||||
shift; continue
|
||||
;;
|
||||
-S) stripcmd="$stripprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-e) ext="$2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
*) if [ "x$src" = "x" ]; then
|
||||
src=$1
|
||||
else
|
||||
dst=$1
|
||||
fi
|
||||
shift; continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "x$src" = "x" ]; then
|
||||
echo "install.sh: no input file specified"
|
||||
exit 1
|
||||
fi
|
||||
if [ "x$dst" = "x" ]; then
|
||||
echo "install.sh: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# If destination is a directory, append the input filename; if
|
||||
# your system does not like double slashes in filenames, you may
|
||||
# need to add some logic
|
||||
#
|
||||
if [ -d $dst ]; then
|
||||
dst="$dst/`basename $src`"
|
||||
fi
|
||||
|
||||
# Add a possible extension (such as ".exe") to src and dst
|
||||
src="$src$ext"
|
||||
dst="$dst$ext"
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
dstdir=`dirname $dst`
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
$instcmd $src $dsttmp
|
||||
|
||||
# And set any options; do chmod last to preserve setuid bits
|
||||
if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
|
||||
if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
|
||||
if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
|
||||
if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$rmcmd $dst
|
||||
$mvcmd $dsttmp $dst
|
||||
|
||||
exit 0
|
||||
|
||||
#!/bin/sh
|
||||
##
|
||||
## install.sh -- install a program, script or datafile
|
||||
##
|
||||
## Based on `install-sh' from the X Consortium's X11R5 distribution
|
||||
## as of 89/12/18 which is freely available.
|
||||
## Cleaned up for Apache's Autoconf-style Interface (APACI)
|
||||
## by Ralf S. Engelschall <rse@apache.org>
|
||||
##
|
||||
#
|
||||
# This script falls under the Apache License.
|
||||
# See http://www.apache.org/docs/LICENSE
|
||||
|
||||
|
||||
#
|
||||
# put in absolute paths if you don't have them in your path;
|
||||
# or use env. vars.
|
||||
#
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
|
||||
#
|
||||
# parse argument line
|
||||
#
|
||||
instcmd="$mvprog"
|
||||
chmodcmd=""
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
ext=""
|
||||
src=""
|
||||
dst=""
|
||||
while [ "x$1" != "x" ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift; continue
|
||||
;;
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-s) stripcmd="$stripprog"
|
||||
shift; continue
|
||||
;;
|
||||
-S) stripcmd="$stripprog $2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
-e) ext="$2"
|
||||
shift; shift; continue
|
||||
;;
|
||||
*) if [ "x$src" = "x" ]; then
|
||||
src=$1
|
||||
else
|
||||
dst=$1
|
||||
fi
|
||||
shift; continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "x$src" = "x" ]; then
|
||||
echo "install.sh: no input file specified"
|
||||
exit 1
|
||||
fi
|
||||
if [ "x$dst" = "x" ]; then
|
||||
echo "install.sh: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# If destination is a directory, append the input filename; if
|
||||
# your system does not like double slashes in filenames, you may
|
||||
# need to add some logic
|
||||
#
|
||||
if [ -d $dst ]; then
|
||||
dst="$dst/`basename $src`"
|
||||
fi
|
||||
|
||||
# Add a possible extension (such as ".exe") to src and dst
|
||||
src="$src$ext"
|
||||
dst="$dst$ext"
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
dstdir=`dirname $dst`
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
$instcmd $src $dsttmp
|
||||
|
||||
# And set any options; do chmod last to preserve setuid bits
|
||||
if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
|
||||
if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
|
||||
if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
|
||||
if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$rmcmd $dst
|
||||
$mvcmd $dsttmp $dst
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user