Log fatal error messages even in "quiet" mode. Allow overriding more of the

default values needed by the system startup script.


git-svn-id: https://shellinabox.googlecode.com/svn/trunk@101 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
zodiac 2009-03-30 16:09:37 +00:00
parent e5b964a311
commit 81845fd5f7
8 changed files with 31 additions and 10 deletions

View file

@ -1,6 +1,11 @@
2009-03-30 Markus Gutschke <markus@shellinabox.com> 2009-03-30 Markus Gutschke <markus@shellinabox.com>
* Added initial revision of demo application * Added initial revision of demo application.
* Show fatal error message even when running in "quiet" mode.
* Make it easier to override parameters needed by the system startup
scripts.
2009-03-29 Markus Gutschke <markus@shellinabox.com> 2009-03-29 Markus Gutschke <markus@shellinabox.com>

View file

@ -95,7 +95,7 @@
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Most recent revision number in the version control system */ /* Most recent revision number in the version control system */
#define VCS_REVISION "93" #define VCS_REVISION "101"
/* Version number of package */ /* Version number of package */
#define VERSION "2.5" #define VERSION "2.5"

2
configure vendored
View file

@ -2056,7 +2056,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
VCS_REVISION=93 VCS_REVISION=101
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF

View file

@ -2,7 +2,7 @@ AC_PREREQ(2.57)
dnl This is the one location where the authoritative version number is stored dnl This is the one location where the authoritative version number is stored
AC_INIT(shellinabox, 2.5, markus@shellinabox.com) AC_INIT(shellinabox, 2.5, markus@shellinabox.com)
VCS_REVISION=93 VCS_REVISION=101
AC_SUBST(VCS_REVISION) AC_SUBST(VCS_REVISION)
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
[Most recent revision number in the version control system]) [Most recent revision number in the version control system])

View file

@ -4,6 +4,12 @@ SHELLINABOX_DAEMON_START=1
# TCP port that shellinboxd's webserver listens on # TCP port that shellinboxd's webserver listens on
SHELLINABOX_PORT=4200 SHELLINABOX_PORT=4200
# Parameters that are managed by the system and usually should not need
# changing:
# SHELLINABOX_DATADIR=/var/lib/shellinabox
# SHELLINABOX_USER=shellinabox
# SHELLINABOX_GROUP=shellinabox
# Any optional arguments (e.g. extra service definitions) # Any optional arguments (e.g. extra service definitions)
# We disable beeps, as there have been reports of the VLC plugin crashing # We disable beeps, as there have been reports of the VLC plugin crashing
# Firefox on Linux/x86_64. # Firefox on Linux/x86_64.

View file

@ -25,6 +25,12 @@ test -x $DAEMON || exit 0
# Include shellinabox defaults if available. # Include shellinabox defaults if available.
test -f /etc/default/shellinabox && . /etc/default/shellinabox test -f /etc/default/shellinabox && . /etc/default/shellinabox
# Set some default values
SHELLINABOX_DATADIR="${SHELLINABOX_DATADIR:-/var/lib/shellinabox}"
SHELLINABOX_PORT="${SHELLINABOX_PORT:-4200}"
SHELLINABOX_USER="${SHELLINABOX_USER:-shellinabox}"
SHELLINABOX_GROUP="${SHELLINABOX_GROUP:-shellinabox}"
# #
# Function that starts the daemon/service. # Function that starts the daemon/service.
# #
@ -34,10 +40,11 @@ d_start() {
return 0 return 0
fi fi
start-stop-daemon --start --oknodo --quiet --pidfile "$PIDFILE" \ start-stop-daemon --start --oknodo --pidfile "$PIDFILE" \
--exec "$DAEMON" -- -q --background="$PIDFILE" \ --exec "$DAEMON" -- -q --background="$PIDFILE" \
-c /var/lib/shellinabox -p ${SHELLINABOX_PORT:-4200} \ -c "${SHELLINABOX_DATADIR}" -p "${SHELLINABOX_PORT}" \
-u shellinabox -g shellinabox ${SHELLINABOX_ARGS} -u "${SHELLINABOX_USER}" -g "${SHELLINABOX_GROUP}" \
${SHELLINABOX_ARGS}
} }
# #

View file

@ -99,7 +99,7 @@ void message(const char *fmt, ...) {
void fatal(const char *fmt, ...) { void fatal(const char *fmt, ...) {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
debugMsg(MSG_MESSAGE, fmt, ap); debugMsg(MSG_QUIET, fmt, ap);
va_end(ap); va_end(ap);
_exit(1); _exit(1);
} }

View file

@ -682,7 +682,10 @@ static void parseArgs(int argc, char * const argv[]) {
if (idx-- <= 0) { if (idx-- <= 0) {
// Help (or invalid argument) // Help (or invalid argument)
usage(); usage();
exit(idx != -1); if (idx == -1) {
fatal("Failed to parse command line");
}
exit(0);
} else if (!idx--) { } else if (!idx--) {
// Background // Background
if (cgi) { if (cgi) {
@ -834,7 +837,7 @@ static void parseArgs(int argc, char * const argv[]) {
} }
if (optind != argc) { if (optind != argc) {
usage(); usage();
exit(1); fatal("Failed to parse command line");
} }
char *buf = NULL; char *buf = NULL;
check(argc >= 1); check(argc >= 1);