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"
then
/sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA"
/sbin/runuser -s /bin/sh - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA"
else
su - $RUN_AS_USER -c "\"$REALPATH\" $ADDITIONAL_PARA"
su - $RUN_AS_USER -s /bin/sh -c "\"$REALPATH\" $ADDITIONAL_PARA"
fi
RUN_AS_USER_EXITCODE=$?
# Now that we are the original user again, we may need to clean up the lock file.
@@ -1777,7 +1777,7 @@ showUsage() {
}
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() {
@@ -1785,7 +1785,7 @@ checkifstartingasroot() {
echo "`gettext 'Running I2P as the root user is *not* recommended.'`"
showsetusermesg
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
fi
}
@@ -1853,11 +1853,16 @@ docommand() {
'install')
installdaemon
if [ ! `grep ^RUN_AS_USER $0` ]; then
echo
showsetusermesg
fi
echo
echo "You may want to disable the browser from launching at startup at"
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')