From 6fbbfbaa43d0e71147f28c9911dbb2240cb1b32f Mon Sep 17 00:00:00 2001
From: jrandom <jrandom>
Date: Thu, 2 Sep 2004 04:47:02 +0000
Subject: [PATCH] bourne-ified (damn borne agains)

---
 installer/resources/osid           | 38 ++++++++++++++++++++----------
 installer/resources/postinstall.sh |  6 +++--
 2 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/installer/resources/osid b/installer/resources/osid
index dffc26ae06..cc23918496 100644
--- a/installer/resources/osid
+++ b/installer/resources/osid
@@ -25,51 +25,64 @@
 
 HOST_OS=`uname -a`
 
-if [ ! '$HOST_OS' ]; then
+if [ "X$HOST_OS" = "X" ]; then
     echo unknown
     exit 0
 fi
 
-if [[ `echo "$HOST_OS" | grep Darwin` && `echo "$HOST_OS" | grep Mac` ]]; then
+DARWIN=`echo "$HOST_OS" | grep Darwin`
+MAC=`echo "$HOST_OS" | grep Mac`
+FREEBSD=`echo "$HOST_OS" | grep FreeBSD`
+LINUX=`echo "$HOST_OS" | grep Linux`
+SOLARIS=`echo "$HOST_OS" | grep Solaris`
+SUNOS=`echo "$HOST_OS" | grep SunOS`
+
+if [ ! "X$DARWIN" = "X" -o ! "X$MAC" = "X" ]; then
     echo osx
     exit 0
 fi
 
-if [[ `echo "$HOST_OS" | grep FreeBSD` ]]; then
+if [ ! "X$FREEBSD" = "X" ]; then
     echo freebsd
     exit 0
 fi
 
-if [[ `echo "$HOST_OS" | grep Linux` ]]; then
+if [ ! "X$LINUX" = "X" ]; then
 
     LINUX_DISTRO=`cat /proc/version`
-
-    if [[ `echo "$LINUX_DISTRO" | grep Debian` ]]; then
+    DEBIAN=`echo $LINUX_DISTRO | grep Debian`
+    FEDORA=`echo $LINUX_DISTRO | grep Fedora`
+    GENTOO=`echo $LINUX_DISTRO | grep Gentoo`
+    MANDRAKE=`echo $LINUX_DISTRO | grep Mandrake`
+    REDHAT=`echo $LINUX_DISTRO | grep "Red Hat"`
+    SUSE=`echo $LINUX_DISTRO | grep Suse`
+
+    if [ ! "X$DEBIAN" = "X" ]; then
         echo debian
         exit 0
     fi
 
-    if [[ `echo "$LINUX_DISTRO" | grep Fedora` ]]; then
+    if [ ! "X$FEDORA" = "X" ]; then
         echo fedora
         exit 0
     fi
 
-    if [[ `echo "$LINUX_DISTRO" | grep Gentoo` ]]; then
+    if [ ! "X$GENTOO" = "X" ]; then
         echo gentoo
         exit 0
     fi
 
-    if [[ `echo "$LINUX_DISTRO" | grep Mandrake` ]]; then
+    if [ ! "X$MANDRAKE" = "X" ]; then
         echo mandrake
         exit 0
     fi
 
-    if [[ `echo "$LINUX_DISTRO" | grep "Red Hat"` ]]; then
+    if [ ! "X$REDHAT" = "X" ]; then
         echo redhat
         exit 0
     fi
 
-    if [[ `echo "$LINUX_DISTRO" | grep Suse` ]]; then
+    if [ ! "X$SUSE" = "X" ]; then
         echo suse
         exit 0
     fi
@@ -78,10 +91,11 @@ if [[ `echo "$HOST_OS" | grep Linux` ]]; then
     exit 0
 fi
 
-if [[ `echo "$HOST_OS" | grep Solaris` ]]; then
+if [ ! "X$SOLARIS" = "X" -o ! "X$SUNOS" = "X" ]; then
     echo solaris
     exit 0
 fi
 
 echo unknown
 exit 0
+
diff --git a/installer/resources/postinstall.sh b/installer/resources/postinstall.sh
index 590749b3c2..0ba3415090 100644
--- a/installer/resources/postinstall.sh
+++ b/installer/resources/postinstall.sh
@@ -12,7 +12,7 @@
 # Installs the appropriate set of Java Service Wrapper support files for the
 # user's OS then launches the I2P router as a background service.
 
-if [ $1 ]; then
+if [ ! "X$1" = "X" ]; then
     cd $1
 fi
 
@@ -22,9 +22,10 @@ chmod 744 ./osid
 chmod 744 ./uninstall_i2p_service_unix
 
 ERROR_MSG="Cannot determine operating system type. From the subdirectory in lib/wrapper matching your operating system, please move i2psvc to your base I2P directory, and move the remaining two files to the lib directory."
+
 HOST_OS=`./osid`
 
-if [[ ! $HOST_OS || $HOST_OS = "unknown" ]]; then
+if [ "X$HOST_OS" = "X" -o $HOST_OS = "unknown" ]; then
     echo "$ERROR_MSG"
     exit 1
 fi
@@ -57,3 +58,4 @@ cp $wrapperpath/i2psvc .
 chmod 744 ./i2psvc
 ./i2prouter start
 exit 0
+
-- 
GitLab