installer/resources/i2prouter: various bugfixes

- Explicitly specify shell when RUN_AS_USER is set. This allows I2P to start
  under limited accounts that do not have a defined shell.
- When installing as a service, point out that I2P_CONFIG_DIR may need to be
  set. I2P_CONFIG_DIR defaults to $HOME/.i2p for the user that installed I2P
  and when running as a service this may not be desired.
  (e.g., RUN_AS_USER=i2p & I2P_CONFIG_DIR=/root/.i2p)

(The RUN_AS_USER shell problem was spotted at https://github.com/mattias-ohlsson/i2p/blob/master/i2p.spec)
This commit is contained in:
kytv
2013-05-15 13:04:46 +00:00
parent c1da7f778b
commit b096834a54
7 changed files with 25 additions and 20 deletions

View File

@ -702,9 +702,9 @@ checkUser() {
# #
if test -f "/sbin/runuser" if test -f "/sbin/runuser"
then then
/sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA" /sbin/runuser -s /bin/sh - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA"
else else
su - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA" su - $RUN_AS_USER -s /bin/sh -c "\"$REALPATH\" $ADDITIONAL_PARA"
fi fi
RUN_AS_USER_EXITCODE=$? RUN_AS_USER_EXITCODE=$?
# Now that we are the original user again, we may need to clean up the lock file. # Now that we are the original user again, we may need to clean up the lock file.
@ -1777,7 +1777,7 @@ showUsage() {
} }
showsetusermesg() { showsetusermesg() {
echo "`gettext 'Please edit $0 and set the variable RUN_AS_USER'`." echo "`gettext 'Please edit i2prouter and set the variable RUN_AS_USER'`."
} }
checkifstartingasroot() { checkifstartingasroot() {
@ -1785,7 +1785,7 @@ checkifstartingasroot() {
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
echo "`gettext 'To run as root anyway, edit $0 and set ALLOW_ROOT=true.'`" echo "`gettext 'To run as root anyway, edit i2prouter and set ALLOW_ROOT=true.'`"
exit 1 exit 1
fi fi
} }
@ -1853,11 +1853,16 @@ docommand() {
'install') 'install')
installdaemon installdaemon
if [ ! `grep ^RUN_AS_USER $0` ]; then if [ ! `grep ^RUN_AS_USER $0` ]; then
echo
showsetusermesg showsetusermesg
fi fi
echo echo
echo "You may want to disable the browser from launching at startup at" echo "You may want to disable the browser from launching at startup at"
echo "http://127.0.0.1:7657/configclients" echo "http://127.0.0.1:7657/configclients"
echo
echo "I2P_CONFIG_DIR is currently set to $I2P_CONFIG_DIR."
echo "Change the value in $0 if this is not"
echo "appropriate for your configuration."
;; ;;
'remove' | 'uninstall') 'remove' | 'uninstall')

View File

@ -189,14 +189,14 @@ msgid "Request a Java thread dump if running."
msgstr "Falls gestartet, fordere einen Java Thread dump an" msgstr "Falls gestartet, fordere einen Java Thread dump an"
#: ../i2prouter:1780 #: ../i2prouter:1780
msgid "Please edit $0 and set the variable RUN_AS_USER" msgid "Please edit i2prouter and set the variable RUN_AS_USER"
msgstr "Bitte bearbeite $0 und setze die Variable RUN_AS_USER" msgstr "Bitte bearbeite i2prouter und setze die Variable RUN_AS_USER"
#: ../i2prouter:1785 #: ../i2prouter:1785
msgid "Running I2P as the root user is *not* recommended." msgid "Running I2P as the root user is *not* recommended."
msgstr "I2P als root Benutzer auszuführen ist *nicht* empfehlenswert." msgstr "I2P als root Benutzer auszuführen ist *nicht* empfehlenswert."
#: ../i2prouter:1788 #: ../i2prouter:1788
msgid "To run as root anyway, edit $0 and set ALLOW_ROOT=true." msgid "To run as root anyway, edit i2prouter and set ALLOW_ROOT=true."
msgstr "" msgstr ""
"Um I2P trotzdem als root auszuführen bearbeite $0 und setze ALLOW_ROOT=true." "Um I2P trotzdem als root auszuführen bearbeite i2prouter und setze ALLOW_ROOT=true."

View File

@ -185,7 +185,7 @@ msgid "Request a Java thread dump if running."
msgstr "" msgstr ""
#: ../i2prouter:1780 #: ../i2prouter:1780
msgid "Please edit $0 and set the variable RUN_AS_USER" msgid "Please edit i2prouter and set the variable RUN_AS_USER"
msgstr "" msgstr ""
#: ../i2prouter:1785 #: ../i2prouter:1785
@ -193,5 +193,5 @@ msgid "Running I2P as the root user is *not* recommended."
msgstr "" msgstr ""
#: ../i2prouter:1788 #: ../i2prouter:1788
msgid "To run as root anyway, edit $0 and set ALLOW_ROOT=true." msgid "To run as root anyway, edit i2prouter and set ALLOW_ROOT=true."
msgstr "" msgstr ""

View File

@ -187,7 +187,7 @@ msgid "Request a Java thread dump if running."
msgstr "" msgstr ""
#: ../i2prouter:1780 #: ../i2prouter:1780
msgid "Please edit $0 and set the variable RUN_AS_USER" msgid "Please edit i2prouter and set the variable RUN_AS_USER"
msgstr "" msgstr ""
#: ../i2prouter:1785 #: ../i2prouter:1785
@ -196,5 +196,5 @@ msgstr ""
"Faire fonctionner I2P en tant qu'utilisateur root n'est *pas* recommandé." "Faire fonctionner I2P en tant qu'utilisateur root n'est *pas* recommandé."
#: ../i2prouter:1788 #: ../i2prouter:1788
msgid "To run as root anyway, edit $0 and set ALLOW_ROOT=true." msgid "To run as root anyway, edit i2prouter and set ALLOW_ROOT=true."
msgstr "" msgstr ""

View File

@ -187,7 +187,7 @@ msgid "Request a Java thread dump if running."
msgstr "" msgstr ""
#: ../i2prouter:1780 #: ../i2prouter:1780
msgid "Please edit $0 and set the variable RUN_AS_USER" msgid "Please edit i2prouter and set the variable RUN_AS_USER"
msgstr "" msgstr ""
#: ../i2prouter:1785 #: ../i2prouter:1785
@ -195,5 +195,5 @@ msgid "Running I2P as the root user is *not* recommended."
msgstr "" msgstr ""
#: ../i2prouter:1788 #: ../i2prouter:1788
msgid "To run as root anyway, edit $0 and set ALLOW_ROOT=true." msgid "To run as root anyway, edit i2prouter and set ALLOW_ROOT=true."
msgstr "" msgstr ""

View File

@ -188,7 +188,7 @@ msgid "Request a Java thread dump if running."
msgstr "" msgstr ""
#: ../i2prouter:1780 #: ../i2prouter:1780
msgid "Please edit $0 and set the variable RUN_AS_USER" msgid "Please edit i2prouter and set the variable RUN_AS_USER"
msgstr "" msgstr ""
#: ../i2prouter:1785 #: ../i2prouter:1785
@ -196,5 +196,5 @@ msgid "Running I2P as the root user is *not* recommended."
msgstr "" msgstr ""
#: ../i2prouter:1788 #: ../i2prouter:1788
msgid "To run as root anyway, edit $0 and set ALLOW_ROOT=true." msgid "To run as root anyway, edit i2prouter and set ALLOW_ROOT=true."
msgstr "" msgstr ""

View File

@ -187,13 +187,13 @@ msgid "Request a Java thread dump if running."
msgstr "Fråga efter en Java thread dump vid drift." msgstr "Fråga efter en Java thread dump vid drift."
#: ../i2prouter:1780 #: ../i2prouter:1780
msgid "Please edit $0 and set the variable RUN_AS_USER" msgid "Please edit i2prouter and set the variable RUN_AS_USER"
msgstr "Var god ändra $0 och sätt variabeln RUN_AS_USER" msgstr "Var god ändra i2prouter och sätt variabeln RUN_AS_USER"
#: ../i2prouter:1785 #: ../i2prouter:1785
msgid "Running I2P as the root user is *not* recommended." msgid "Running I2P as the root user is *not* recommended."
msgstr "Att köra I2P som användare root är *inte* rekommenderat." msgstr "Att köra I2P som användare root är *inte* rekommenderat."
#: ../i2prouter:1788 #: ../i2prouter:1788
msgid "To run as root anyway, edit $0 and set ALLOW_ROOT=true." msgid "To run as root anyway, edit i2prouter and set ALLOW_ROOT=true."
msgstr "För att köra som root iallafall, ändra $0 och sätt ALLOW_ROOT=true" msgstr "För att köra som root iallafall, ändra i2prouter och sätt ALLOW_ROOT=true"