various updates to i2prouter

- check status of i2psvc with ldd
- only warn about libiconv in FreeBSD if the package isn't installed. In recent
  versions of FreeBSD, OpenJDK depends on libiconv so it should always be
  available.
This commit is contained in:
kytv
2013-09-19 20:56:56 +00:00
parent ce2d0b0e12
commit 65b1124d81
2 changed files with 61 additions and 41 deletions

View File

@@ -71,10 +71,13 @@ Debian wrapper.config to try to prevent confusion.
# Priority at which to run the wrapper. See "man nice" for valid priorities.
# nice is only used if a priority is specified.
@@ -175,48 +166,6 @@
# Workaround for Gentoo
JAVABINARY=$(awk -F'=' '/^ *wrapper\.java\.command/{print $2}' "$WRAPPER_CONF")
@@ -172,64 +163,6 @@
exit 1
fi
-# Workaround for Gentoo
-JAVABINARY=$(awk -F'=' '/^ *wrapper\.java\.command/{print $2}' "$WRAPPER_CONF")
-
-if [ -e /etc/gentoo-release ]; then
- if [ $JAVABINARY = java ]; then
- if [ -x /etc/java-config-2/current-system-vm/bin/java ]; then
@@ -103,44 +106,54 @@ Debian wrapper.config to try to prevent confusion.
- echo "**`gettext 'Failed to load the wrapper'`**"
- case `uname -s` in
- FreeBSD)
- # We should never get here on recent versions of FreeBSD
- if ! $(pkg_info -E 'libiconv*' > /dev/null 2>&1); then
- echo
- echo "The wrapper requires libiconv."
- echo
- echo "The wrapper requires libiconv to be on your system."
- echo "It can be installed with pkg_add -r libiconv"
- echo
- exit 1
- fi
- ;;
- *)
- echo
- unsupported
- exit 1
- ;;
- esac
- exit 1
-}
-
-if $(which ldd > /dev/null 2>&1); then
- # This should cover every *NIX other than OSX since OSX doesn't have ldd.
- # OSX has otool. Is otool on every OSX installation? Is otool's output the same as ldd's?
- # The wrapper we ship for OSX are for PPC and Intel, so maybe we don't need to worry about OSX?
- if (ldd "$WRAPPER_CMD" |grep -q 'not found') > /dev/null 2>&1 || \
- ! (ldd "$WRAPPER_CMD" > /dev/null 2>&1); then
- failed
- fi
-fi
-
if [ -n "$FIXED_COMMAND" ]
then
COMMAND="$FIXED_COMMAND"
@@ -928,9 +877,6 @@
@@ -940,7 +873,7 @@
# The string passed to eval must handles spaces in paths correctly.
COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.java.command=\"$JAVABINARY\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $COMMANDPROP $LOCKPROP $LOGPROP wrapper.script.version=3.5.20 $ADDITIONAL_PARA"
eval $COMMAND_LINE
- if [ "$?" -ne "0" ]; then
- failed
- fi
- eval $COMMAND_LINE || failed
+ eval $COMMAND_LINE
else
eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1
@@ -1054,9 +1000,6 @@
# The string passed to eval must handles spaces in paths correctly.
COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.java.command=\"$JAVABINARY\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP $LOGPROP wrapper.script.version=3.5.20 $ADDITIONAL_PARA"
eval $COMMAND_LINE
- if [ "$?" -ne "0" ]; then
@@ -997,7 +930,6 @@
if [ "X$pid" = "X" ]
then
eval echo " `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`"
- failed
- fi
else
eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1
@@ -1793,7 +1736,7 @@
eval echo ' running: PID:$pid'
fi
@@ -1800,7 +1732,7 @@
}
showsetusermesg() {
@@ -149,7 +162,7 @@ Debian wrapper.config to try to prevent confusion.
}
checkifstartingasroot() {
@@ -1801,7 +1744,7 @@
@@ -1808,7 +1740,7 @@
echo "`gettext 'Running I2P as the root user is *not* recommended.'`"
showsetusermesg
echo
@@ -158,7 +171,7 @@ Debian wrapper.config to try to prevent confusion.
exit 1
fi
}
@@ -1866,24 +1809,10 @@
@@ -1873,24 +1805,10 @@
status
;;

View File

@@ -203,20 +203,33 @@ failed() {
echo "**`gettext 'Failed to load the wrapper'`**"
case `uname -s` in
FreeBSD)
# We should never get here on recent versions of FreeBSD
if ! $(pkg_info -E 'libiconv*' > /dev/null 2>&1); then
echo
echo "The wrapper requires libiconv."
echo
echo "The wrapper requires libiconv to be on your system."
echo "It can be installed with pkg_add -r libiconv"
echo
exit 1
fi
;;
*)
echo
unsupported
exit 1
;;
esac
exit 1
}
if $(which ldd > /dev/null 2>&1); then
# This should cover every *NIX other than OSX since OSX doesn't have ldd.
# OSX has otool. Is otool on every OSX installation? Is otool's output the same as ldd's?
# The wrapper we ship for OSX are for PPC and Intel, so maybe we don't need to worry about OSX?
if (ldd "$WRAPPER_CMD" |grep -q 'not found') > /dev/null 2>&1 || \
! (ldd "$WRAPPER_CMD" > /dev/null 2>&1); then
failed
fi
fi
if [ -n "$FIXED_COMMAND" ]
then
COMMAND="$FIXED_COMMAND"
@@ -927,10 +940,7 @@ console() {
# The string passed to eval must handles spaces in paths correctly.
COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.java.command=\"$JAVABINARY\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $COMMANDPROP $LOCKPROP $LOGPROP wrapper.script.version=3.5.20 $ADDITIONAL_PARA"
eval $COMMAND_LINE
if [ "$?" -ne "0" ]; then
failed
fi
eval $COMMAND_LINE || failed
else
eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1
@@ -987,7 +997,7 @@ startwait() {
if [ "X$pid" = "X" ]
then
eval echo " `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`"
exit 1
failed
else
eval echo ' running: PID:$pid'
fi
@@ -1054,9 +1064,6 @@ start() {
# The string passed to eval must handles spaces in paths correctly.
COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.java.command=\"$JAVABINARY\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $COMMANDPROP $LOCKPROP $LOGPROP wrapper.script.version=3.5.20 $ADDITIONAL_PARA"
eval $COMMAND_LINE
if [ "$?" -ne "0" ]; then
failed
fi
else
eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1