From 2d45a35c8f43a73672fde6dc8aaa24b509093a02 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 25 Jul 2009 07:44:53 -0700 Subject: [PATCH] Make PREFIX work under Cygwin - Take 2 --- Shorewall-lite/install.sh | 39 +++++++++++++++++++++++--------------- Shorewall/install.sh | 7 +++++-- Shorewall6-lite/install.sh | 7 +++++-- Shorewall6/install.sh | 7 +++++-- 4 files changed, 39 insertions(+), 21 deletions(-) diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index bd562ce9e..8fe57d5ca 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -107,14 +107,6 @@ if [ -z "$RUNLEVELS" ] ; then RUNLEVELS="" fi -if [ -z "$OWNER" ] ; then - OWNER=root -fi - -if [ -z "$GROUP" ] ; then - GROUP=root -fi - while [ $# -gt 0 ] ; do case "$1" in -h|help|?) @@ -138,17 +130,34 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin # Determine where to install the firewall script # DEBIAN= +CYGWIN= + +case $(uname) in + CYGWIN*) + if [ -z "$PREFIX" ]; then + DEST= + INIT= + fi + + OWNER=$(id -un) + GROUP=$(id -gn) + ;; + *) + [ -z "$OWNER" ] && OWNER=root + [ -z "$GROUP" ] && GROUP=root + ;; +esac OWNERSHIP="-o $OWNER -g $GROUP" if [ -n "$PREFIX" ]; then - if [ `id -u` != 0 ] ; then - echo "Not setting file owner/group permissions, not running as root." - OWNERSHIP="" - fi - - install -d $OWNERSHIP -m 755 ${PREFIX}/sbin - install -d $OWNERSHIP -m 755 ${PREFIX}${DEST} + if [ `id -u` != 0 ] ; then + echo "Not setting file owner/group permissions, not running as root." + OWNERSHIP="" + fi + + install -d $OWNERSHIP -m 755 ${PREFIX}/sbin + install -d $OWNERSHIP -m 755 ${PREFIX}${DEST} elif [ -d /etc/apt -a -e /usr/bin/dpkg ]; then DEBIAN=yes elif [ -f /etc/slackware-version ] ; then diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 295cc3de7..0edc3a666 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -113,8 +113,11 @@ MANDIR=${MANDIR:-"/usr/share/man"} case $(uname) in CYGWIN*) - DEST= - INIT= + if [ -z "$PREFIX" ]; then + DEST= + INIT= + fi + OWNER=$(id -un) GROUP=$(id -gn) CYGWIN=Yes diff --git a/Shorewall6-lite/install.sh b/Shorewall6-lite/install.sh index 5beba742a..6581edab8 100755 --- a/Shorewall6-lite/install.sh +++ b/Shorewall6-lite/install.sh @@ -133,8 +133,11 @@ DEBIAN= case $(uname) in CYGWIN*) - DEST= - INIT= + if [ -z "$PREFIX" ]; then + DEST= + INIT= + fi + OWNER=$(id -un) GROUP=$(id -gn) ;; diff --git a/Shorewall6/install.sh b/Shorewall6/install.sh index db1374889..e8fb2938d 100755 --- a/Shorewall6/install.sh +++ b/Shorewall6/install.sh @@ -113,8 +113,11 @@ MANDIR=${MANDIR:-"/usr/share/man"} case $(uname) in CYGWIN*) - DEST= - INIT= + if [ -z "$PREFIX" ]; then + DEST= + INIT= + fi + OWNER=$(id -un) GROUP=$(id -gn) CYGWIN=Yes