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. # Priority at which to run the wrapper. See "man nice" for valid priorities.
# nice is only used if a priority is specified. # nice is only used if a priority is specified.
@@ -175,48 +166,6 @@ @@ -172,64 +163,6 @@
# Workaround for Gentoo exit 1
JAVABINARY=$(awk -F'=' '/^ *wrapper\.java\.command/{print $2}' "$WRAPPER_CONF") fi
-# Workaround for Gentoo
-JAVABINARY=$(awk -F'=' '/^ *wrapper\.java\.command/{print $2}' "$WRAPPER_CONF")
-
-if [ -e /etc/gentoo-release ]; then -if [ -e /etc/gentoo-release ]; then
- if [ $JAVABINARY = java ]; then - if [ $JAVABINARY = java ]; then
- if [ -x /etc/java-config-2/current-system-vm/bin/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'`**" - echo "**`gettext 'Failed to load the wrapper'`**"
- case `uname -s` in - case `uname -s` in
- FreeBSD) - FreeBSD)
- echo - # We should never get here on recent versions of FreeBSD
- echo "The wrapper requires libiconv to be on your system." - if ! $(pkg_info -E 'libiconv*' > /dev/null 2>&1); then
- echo "It can be installed with pkg_add -r libiconv" - echo
- echo - echo "The wrapper requires libiconv."
- exit 1 - echo
- echo "It can be installed with pkg_add -r libiconv"
- echo
- fi
- ;; - ;;
- *) - *)
- echo - echo
- unsupported - unsupported
- exit 1
- ;; - ;;
- esac - 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" ] if [ -n "$FIXED_COMMAND" ]
then then
COMMAND="$FIXED_COMMAND" COMMAND="$FIXED_COMMAND"
@@ -928,9 +877,6 @@ @@ -940,7 +873,7 @@
# The string passed to eval must handles spaces in paths correctly. # 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" 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 - eval $COMMAND_LINE || failed
- if [ "$?" -ne "0" ]; then + eval $COMMAND_LINE
- failed
- fi
else else
eval echo `gettext '$APP_LONG_NAME is already running.'` eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1 exit 1
@@ -1054,9 +1000,6 @@ @@ -997,7 +930,6 @@
# The string passed to eval must handles spaces in paths correctly. if [ "X$pid" = "X" ]
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" then
eval $COMMAND_LINE eval echo " `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`"
- if [ "$?" -ne "0" ]; then - failed
- failed else
- fi eval echo ' running: PID:$pid'
else fi
eval echo `gettext '$APP_LONG_NAME is already running.'` @@ -1800,7 +1732,7 @@
exit 1
@@ -1793,7 +1736,7 @@
} }
showsetusermesg() { showsetusermesg() {
@@ -149,7 +162,7 @@ Debian wrapper.config to try to prevent confusion.
} }
checkifstartingasroot() { checkifstartingasroot() {
@@ -1801,7 +1744,7 @@ @@ -1808,7 +1740,7 @@
echo "`gettext 'Running I2P as the root user is *not* recommended.'`" echo "`gettext 'Running I2P as the root user is *not* recommended.'`"
showsetusermesg showsetusermesg
echo echo
@@ -158,7 +171,7 @@ Debian wrapper.config to try to prevent confusion.
exit 1 exit 1
fi fi
} }
@@ -1866,24 +1809,10 @@ @@ -1873,24 +1805,10 @@
status status
;; ;;

View File

@@ -203,20 +203,33 @@ failed() {
echo "**`gettext 'Failed to load the wrapper'`**" echo "**`gettext 'Failed to load the wrapper'`**"
case `uname -s` in case `uname -s` in
FreeBSD) FreeBSD)
echo # We should never get here on recent versions of FreeBSD
echo "The wrapper requires libiconv to be on your system." if ! $(pkg_info -E 'libiconv*' > /dev/null 2>&1); then
echo "It can be installed with pkg_add -r libiconv" echo
echo echo "The wrapper requires libiconv."
exit 1 echo
echo "It can be installed with pkg_add -r libiconv"
echo
fi
;; ;;
*) *)
echo echo
unsupported unsupported
exit 1
;; ;;
esac 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" ] if [ -n "$FIXED_COMMAND" ]
then then
COMMAND="$FIXED_COMMAND" COMMAND="$FIXED_COMMAND"
@@ -927,10 +940,7 @@ console() {
# The string passed to eval must handles spaces in paths correctly. # 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" 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 eval $COMMAND_LINE || failed
if [ "$?" -ne "0" ]; then
failed
fi
else else
eval echo `gettext '$APP_LONG_NAME is already running.'` eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1 exit 1
@@ -987,7 +997,7 @@ startwait() {
if [ "X$pid" = "X" ] if [ "X$pid" = "X" ]
then then
eval echo " `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`" eval echo " `gettext 'WARNING: $APP_LONG_NAME may have failed to start.'`"
exit 1 failed
else else
eval echo ' running: PID:$pid' eval echo ' running: PID:$pid'
fi fi
@@ -1054,9 +1064,6 @@ start() {
# The string passed to eval must handles spaces in paths correctly. # 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" 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 eval $COMMAND_LINE
if [ "$?" -ne "0" ]; then
failed
fi
else else
eval echo `gettext '$APP_LONG_NAME is already running.'` eval echo `gettext '$APP_LONG_NAME is already running.'`
exit 1 exit 1