setup: Migrate to autotool and use gettext.

This commit is contained in:
Michael Tremer
2014-08-12 12:19:10 +02:00
parent 56774f9ed2
commit e1457ba014
23 changed files with 1474 additions and 253 deletions

View File

@@ -1,2 +1,3 @@
usr/local/sbin/setup
bin/probenic.sh
usr/bin/probenic.sh
usr/sbin/setup
usr/share/locale/de/LC_MESSAGES/setup.mo

View File

@@ -49,12 +49,14 @@ md5 :
$(TARGET) :
@$(PREBUILD)
@rm -rf $(DIR_APP) && mkdir $(DIR_APP) && cp -R $(DIR_SRC)/src/setup/* $(DIR_APP)
cd $(DIR_APP) && make CFLAGS="$(CFLAGS) -Wall \
-DNAME='\"$(NAME)\"' -DSNAME='\"$(SNAME)\"' -DVERSION='\"$(VERSION)\"' \
-DSLOGAN='\"$(SLOGAN)\"' -DCONFIG_ROOT='\"$(CONFIG_ROOT)\"'"
cd $(DIR_APP) && install -m 0755 setup /usr/local/sbin
cd $(DIR_APP) && install -m 0755 probenic.sh /bin
cd $(DIR_APP) && bash autogen.sh
cd $(DIR_APP) && ./configure \
--prefix=/usr \
--with-distro-name="$(NAME)" \
--with-distro-sname="$(SNAME)" \
--with-distro-slogan="$(SLOGAN)" \
--with-config-root="$(CONFIG_ROOT)"
cd $(DIR_APP) && make $(MAKETUNING)
cd $(DIR_APP) && make install
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -40,7 +40,7 @@ clean :
######
OBJS=main.o hostname.o domainname.o passwords.o networking.o misc.o \
dhcp.o keymap.o timezone.o
dhcp.o keymap.o timezone.o netstuff.o
setup: $(OBJS)
$(LINK) $(OBJS) -o $@ $(LIBS)

58
src/setup/Makefile.am Normal file
View File

@@ -0,0 +1,58 @@
# This file is part of the setup tool.
#
# setup is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_MAKEFLAGS = --no-print-directory
AUTOMAKE_OPTIONS = color-tests parallel-tests
SUBDIRS = . po
# remove targets if the command fails
.DELETE_ON_ERROR:
# keep intermediate files
.SECONDARY:
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
$(OUR_CPPFLAGS)
AM_CFLAGS = $(OUR_CFLAGS)
AM_CXXFLAGS = $(OUR_CXXFLAGS)
AM_LDFLAGS = $(OUR_LDFLAGS)
bin_SCRIPTS =
sbin_PROGRAMS =
#- setup -----------------------------------------------------------------------
sbin_PROGRAMS += \
setup
setup_SOURCES = \
dhcp.c \
domainname.c \
hostname.c \
keymap.c \
main.c \
misc.c \
netstuff.c \
networking.c \
passwords.c \
setup.h \
timezone.c
setup_CFLAGS = \
$(AM_CFLAGS) \
$(LIBSMOOTH_CFLAGS)
setup_LDADD = \
$(LIBSMOOTH_LIBS) \
$(NEWT_LIBS)
bin_SCRIPTS += \
probenic.sh

3
src/setup/autogen.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
autoreconf --force --install -I m4

92
src/setup/configure.ac Normal file
View File

@@ -0,0 +1,92 @@
# This file is part of the setup tool.
#
# setup is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
AC_PREREQ([2.64])
AC_INIT([setup],
[001],
[],
[setup],
[http://git.ipfire.org/?p=ipfire-2.x.git;a=summary])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([
foreign
1.11
-Wall
-Wno-portability
silent-rules
tar-pax
no-dist-gzip
dist-xz
subdir-objects
])
AM_SILENT_RULES([yes])
LT_PREREQ(2.2)
LT_INIT([disable-static])
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CC_C_O
AC_PATH_PROG([M4], [m4])
# Gettext
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.18])
AC_CHECK_HEADERS([libintl.h])
# This makes sure pkg.m4 is available.
m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
# newt
LIBS=
AC_SEARCH_LIBS([newtWinMenu], [newt], [], [AC_MSG_ERROR([*** newt library not found])])
NEWT_LIBS="$LIBS"
AC_SUBST(NEWT_LIBS)
LIBS="$save_LIBS"
PKG_CHECK_MODULES(LIBSMOOTH, [libsmooth])
AC_ARG_WITH([distro-name],
AS_HELP_STRING([--with-distro-name] [The name of the distribution]),
AC_DEFINE_UNQUOTED([NAME], "$withval", [The name of the distribution]),
AC_MSG_ERROR([*** you need to set the name with --with-distro-name=]))
AC_ARG_WITH([distro-sname],
AS_HELP_STRING([--with-distro-sname] [The short name of the distribution]),
AC_DEFINE_UNQUOTED([SNAME], "$withval", [The sname of the distribution]),
AC_MSG_ERROR([*** you need to set the sname with --with-distro-sname=]))
AC_ARG_WITH([distro-slogan],
AS_HELP_STRING([--with-distro-slogan] [The slogan of the distribution]),
AC_DEFINE_UNQUOTED([SLOGAN], "$withval", [The slogan of the distribution]),
AC_MSG_ERROR([*** you need to set the slogan with --with-distro-slogan=]))
AC_ARG_WITH([config-root],
AS_HELP_STRING([--with-distro-config-root] [The configuration directory]),
AC_DEFINE_UNQUOTED([CONFIG_ROOT], "$withval", [The config-root]),
AC_MSG_ERROR([*** you need to set CONFIG_ROOT with --with-config-root=]))
AC_CONFIG_FILES([
Makefile
po/Makefile.in
])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION
CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
])

View File

@@ -7,7 +7,11 @@
* Stuff for setting up the DHCP server from the setup prog.
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
#define TOP 4
@@ -24,8 +28,6 @@
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
newtComponent dhcpform;
@@ -44,13 +46,24 @@ int handledhcp(void)
newtComponent labels[MAX_BOXES];
newtComponent ok, cancel;
char message[1000];
char *labeltexts[MAX_BOXES] = { ctr[TR_START_ADDRESS], ctr[TR_END_ADDRESS],
ctr[TR_PRIMARY_DNS], ctr[TR_SECONDARY_DNS], ctr[TR_DEFAULT_LEASE],
ctr[TR_MAX_LEASE], ctr[TR_DOMAIN_NAME_SUFFIX] };
char *varnames[MAX_BOXES] = { "START_ADDR_GREEN", "END_ADDR_GREEN",
"DNS1_GREEN", "DNS2_GREEN",
"DEFAULT_LEASE_TIME_GREEN", "MAX_LEASE_TIME_GREEN",
"DOMAIN_NAME_GREEN"};
char *labeltexts[MAX_BOXES] = {
_("Start address:"),
_("End address:"),
_("Primary DNS:"),
_("Secondary DNS:"),
_("Default lease (mins):"),
_("Max lease (mins):"),
_("Domain name suffix:")
};
char *varnames[MAX_BOXES] = {
"START_ADDR_GREEN",
"END_ADDR_GREEN",
"DNS1_GREEN",
"DNS2_GREEN",
"DEFAULT_LEASE_TIME_GREEN",
"MAX_LEASE_TIME_GREEN",
"DOMAIN_NAME_GREEN"
};
char defaults[MAX_BOXES][STRING_SIZE];
int result;
int c;
@@ -70,14 +83,14 @@ int handledhcp(void)
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
if (!(readkeyvalues(ethernetkv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
if (!(readkeyvalues(mainkv, CONFIG_ROOT "/main/settings")))
@@ -85,7 +98,7 @@ int handledhcp(void)
freekeyvalues(dhcpkv);
freekeyvalues(ethernetkv);
freekeyvalues(mainkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -95,13 +108,13 @@ int handledhcp(void)
strcpy(defaults[DEFAULT_LEASE_TIME], "60");
strcpy(defaults[MAX_LEASE_TIME], "120");
sprintf(message, ctr[TR_DHCP_SERVER_CONFIGURATION]);
newtCenteredWindow(55, 18, message);
newtCenteredWindow(55, 18, _("DHCP server configuration"));
dhcpform = newtForm(NULL, NULL, 0);
sprintf(message, ctr[TR_CONFIGURE_DHCP]);
header = newtTextboxReflowed(1, 1, message, 52, 0, 0, 0);
header = newtTextboxReflowed(1, 1,
_("Configure the DHCP server by entering the settings information."),
52, 0, 0, 0);
newtFormAddComponent(dhcpform, header);
strcpy(temp, ""); findkey(dhcpkv, "ENABLE_GREEN", temp);
@@ -109,7 +122,7 @@ int handledhcp(void)
startenabled = '*';
else
startenabled = ' ';
enabledcheckbox = newtCheckbox(2, TOP + 0, ctr[TR_ENABLED], startenabled, " *", &enabledresult);
enabledcheckbox = newtCheckbox(2, TOP + 0, _("Enabled"), startenabled, " *", &enabledresult);
newtFormAddComponent(dhcpform, enabledcheckbox);
newtComponentAddCallback(enabledcheckbox, dhcpdialogcallbackdhcp, NULL);
@@ -126,13 +139,12 @@ int handledhcp(void)
}
ok = newtButton(10, c + 7, ctr[TR_OK]);
cancel = newtButton(34, c + 7, ctr[TR_CANCEL]);
ok = newtButton(10, c + 7, _("OK"));
cancel = newtButton(34, c + 7, _("Cancel"));
newtFormAddComponents(dhcpform, ok, cancel, NULL);
do
{
do {
error = 0;
newtFormRun(dhcpform, &es);
@@ -141,22 +153,25 @@ int handledhcp(void)
/* OK was pressed; verify the contents of each entry. */
if (enabledresult == '*')
{
strcpy(message, ctr[TR_INVALID_FIELDS]);
strcpy(message, _("The following fields are invalid:\n\n"));
if (inet_addr(results[START_ADDRESS]) == INADDR_NONE)
{
strcat(message, ctr[TR_START_ADDRESS_CR]);
strcat(message, _("Start address"));
strcat(message, "\n");
error = 1;
}
if (inet_addr(results[END_ADDRESS]) == INADDR_NONE)
{
strcat(message, ctr[TR_END_ADDRESS_CR]);
strcat(message, _("End address"));
strcat(message, "\n");
error = 1;
}
if (strlen(results[SECONDARY_DNS]))
{
if (inet_addr(results[PRIMARY_DNS]) == INADDR_NONE)
{
strcat(message, ctr[TR_PRIMARY_DNS_CR]);
strcat(message, _("Primary DNS"));
strcat(message, "\n");
error = 1;
}
}
@@ -164,18 +179,21 @@ int handledhcp(void)
{
if (inet_addr(results[SECONDARY_DNS]) == INADDR_NONE)
{
strcat(message, ctr[TR_SECONDARY_DNS_CR]);
strcat(message, _("Secondary DNS"));
strcat(message, "\n");
error = 1;
}
}
if (!(atol(results[DEFAULT_LEASE_TIME])))
{
strcat(message, ctr[TR_DEFAULT_LEASE_CR]);
strcat(message, _("Default lease time"));
strcat(message, "\n");
error = 1;
}
if (!(atol(results[MAX_LEASE_TIME])))
{
strcat(message, ctr[TR_MAX_LEASE_CR]);
strcat(message, _("Max. lease time"));
strcat(message, "\n");
error = 1;
}
}
@@ -236,8 +254,7 @@ int handledhcp(void)
}
else
result = 0;
}
while (error);
} while (error);
newtFormDestroy(dhcpform);
newtPopWindow();

View File

@@ -6,14 +6,16 @@
* $Id: domainname.c
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
int handledomainname(void)
@@ -29,7 +31,7 @@ int handledomainname(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -37,19 +39,18 @@ int handledomainname(void)
for (;;)
{
rc = newtWinEntries(ctr[TR_DOMAINNAME], ctr[TR_ENTER_DOMAINNAME],
50, 5, 5, 40, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);
rc = newtWinEntries(_("Domain name"), _("Enter Domain name"),
50, 5, 5, 40, entries, _("OK"), _("Cancel"), NULL);
if (rc == 1)
{
if (rc == 1) {
strcpy(domainname, values[0]);
if (!(strlen(domainname)))
errorbox(ctr[TR_DOMAINNAME_CANNOT_BE_EMPTY]);
errorbox(_("Domain name cannot be empty."));
else if (strchr(domainname, ' '))
errorbox(ctr[TR_DOMAINNAME_CANNOT_CONTAIN_SPACES]);
errorbox(_("Domain name cannot contain spaces."));
else if (strlen(domainname) != strspn(domainname,
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-."))
errorbox(ctr[TR_DOMAINNAME_NOT_VALID_CHARS]);
errorbox(_("Domain name may only contain letters, numbers, hyphens and periods."));
else
{
replacekeyvalue(kv, "DOMAINNAME", domainname);

View File

@@ -9,14 +9,16 @@
* $Id: hostname.c,v 1.6.2.1 2004/04/14 22:05:41 gespinasse Exp $
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
int handlehostname(void)
@@ -32,7 +34,7 @@ int handlehostname(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -41,19 +43,19 @@ int handlehostname(void)
for (;;)
{
rc = newtWinEntries(ctr[TR_HOSTNAME], ctr[TR_ENTER_HOSTNAME],
50, 5, 5, 40, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);
rc = newtWinEntries(_("Hostname"), _("Enter the machine's hostname."),
50, 5, 5, 40, entries, _("OK"), _("Cancel"), NULL);
if (rc == 1)
{
strcpy(hostname, values[0]);
if (!(strlen(hostname)))
errorbox(ctr[TR_HOSTNAME_CANNOT_BE_EMPTY]);
errorbox(_("Hostname cannot be empty."));
else if (strchr(hostname, ' '))
errorbox(ctr[TR_HOSTNAME_CANNOT_CONTAIN_SPACES]);
errorbox(_("Hostname cannot contain spaces."));
else if (strlen(hostname) != strspn(hostname,
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"))
errorbox(ctr[TR_HOSTNAME_NOT_VALID_CHARS]);
errorbox(_("Hostname may only contain letters, numbers and hyphens."));
else
{
replacekeyvalue(kv, "HOSTNAME", hostname);

View File

@@ -9,14 +9,16 @@
* $Id: keymap.c,v 1.9.2.1 2004/04/14 22:05:41 gespinasse Exp $
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
#define MAX_FILENAMES 5000
@@ -65,7 +67,7 @@ int handlekeymap(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -79,8 +81,9 @@ int handlekeymap(void)
choice = c;
}
rc = newtWinMenu(ctr[TR_KEYBOARD_MAPPING], ctr[TR_KEYBOARD_MAPPING_LONG], 50, 5, 5, 6, displaynames, &choice,
ctr[TR_OK], ctr[TR_CANCEL], NULL);
rc = newtWinMenu(_("Keyboard mapping"),
_("Choose the type of keyboard you are using from the list below."),
50, 5, 5, 6, displaynames, &choice, _("OK"), _("Cancel"), NULL);
strcpy(keymap, filenames[choice]);

288
src/setup/m4/attributes.m4 Normal file
View File

@@ -0,0 +1,288 @@
dnl Macros to check the presence of generic (non-typed) symbols.
dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
dnl Copyright (c) 2006-2008 xine project
dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
dnl As a special exception, the copyright owners of the
dnl macro gives unlimited permission to copy, distribute and modify the
dnl configure scripts that are the output of Autoconf when processing the
dnl Macro. You need not follow the terms of the GNU General Public
dnl License when using or distributing such scripts, even though portions
dnl of the text of the Macro appear in them. The GNU General Public
dnl License (GPL) does govern all other use of the material that
dnl constitutes the Autoconf Macro.
dnl
dnl This special exception to the GPL applies to versions of the
dnl Autoconf Macro released by this project. When you make and
dnl distribute a modified version of the Autoconf Macro, you may extend
dnl this special exception to the GPL to apply to your modified version as
dnl well.
dnl Check if FLAG in ENV-VAR is supported by compiler and append it
dnl to WHERE-TO-APPEND variable
dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG])
AC_DEFUN([CC_CHECK_FLAG_APPEND], [
AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
AS_TR_SH([cc_cv_$2_$3]),
[eval "AS_TR_SH([cc_save_$2])='${$2}'"
eval "AS_TR_SH([$2])='-Werror $3'"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])],
[eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
[eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
eval "AS_TR_SH([$2])='$cc_save_$2'"])
AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
[eval "$1='${$1} $3'"])
])
dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
for flag in $3; do
CC_CHECK_FLAG_APPEND($1, $2, $flag)
done
])
dnl Check if the flag is supported by linker (cacheable)
dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
AC_DEFUN([CC_CHECK_LDFLAGS], [
AC_CACHE_CHECK([if $CC supports $1 flag],
AS_TR_SH([cc_cv_ldflags_$1]),
[ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $1"
AC_LINK_IFELSE([int main() { return 1; }],
[eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_ldflags_$1])="])
LDFLAGS="$ac_save_LDFLAGS"
])
AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
[$2], [$3])
])
dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for
dnl the current linker to avoid undefined references in a shared object.
AC_DEFUN([CC_NOUNDEFINED], [
dnl We check $host for which systems to enable this for.
AC_REQUIRE([AC_CANONICAL_HOST])
case $host in
dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads
dnl are requested, as different implementations are present; to avoid problems
dnl use -Wl,-z,defs only for those platform not behaving this way.
*-freebsd* | *-openbsd*) ;;
*)
dnl First of all check for the --no-undefined variant of GNU ld. This allows
dnl for a much more readable commandline, so that people can understand what
dnl it does without going to look for what the heck -z defs does.
for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
break
done
;;
esac
AC_SUBST([LDFLAGS_NOUNDEFINED])
])
dnl Check for a -Werror flag or equivalent. -Werror is the GCC
dnl and ICC flag that tells the compiler to treat all the warnings
dnl as fatal. We usually need this option to make sure that some
dnl constructs (like attributes) are not simply ignored.
dnl
dnl Other compilers don't support -Werror per se, but they support
dnl an equivalent flag:
dnl - Sun Studio compiler supports -errwarn=%all
AC_DEFUN([CC_CHECK_WERROR], [
AC_CACHE_CHECK(
[for $CC way to treat warnings as errors],
[cc_cv_werror],
[CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror],
[CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])])
])
])
AC_DEFUN([CC_CHECK_ATTRIBUTE], [
AC_REQUIRE([CC_CHECK_WERROR])
AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
AS_TR_SH([cc_cv_attribute_$1]),
[ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $cc_cv_werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
[eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
CFLAGS="$ac_save_CFLAGS"
])
AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
[AC_DEFINE(
AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
[Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]
)
$4],
[$5])
])
AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
CC_CHECK_ATTRIBUTE(
[constructor],,
[void __attribute__((constructor)) ctor() { int a; }],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
CC_CHECK_ATTRIBUTE(
[format], [format(printf, n, n)],
[void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
CC_CHECK_ATTRIBUTE(
[format_arg], [format_arg(printf)],
[char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
CC_CHECK_ATTRIBUTE(
[visibility_$1], [visibility("$1")],
[void __attribute__((visibility("$1"))) $1_function() { }],
[$2], [$3])
])
AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
CC_CHECK_ATTRIBUTE(
[nonnull], [nonnull()],
[void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
CC_CHECK_ATTRIBUTE(
[unused], ,
[void some_function(void *foo, __attribute__((unused)) void *bar);],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
CC_CHECK_ATTRIBUTE(
[sentinel], ,
[void some_function(void *foo, ...) __attribute__((sentinel));],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
CC_CHECK_ATTRIBUTE(
[deprecated], ,
[void some_function(void *foo, ...) __attribute__((deprecated));],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
CC_CHECK_ATTRIBUTE(
[alias], [weak, alias],
[void other_function(void *foo) { }
void some_function(void *foo) __attribute__((weak, alias("other_function")));],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
CC_CHECK_ATTRIBUTE(
[malloc], ,
[void * __attribute__((malloc)) my_alloc(int n);],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_PACKED], [
CC_CHECK_ATTRIBUTE(
[packed], ,
[struct astructure { char a; int b; long c; void *d; } __attribute__((packed));],
[$1], [$2])
])
AC_DEFUN([CC_ATTRIBUTE_CONST], [
CC_CHECK_ATTRIBUTE(
[const], ,
[int __attribute__((const)) twopow(int n) { return 1 << n; } ],
[$1], [$2])
])
AC_DEFUN([CC_FLAG_VISIBILITY], [
AC_REQUIRE([CC_CHECK_WERROR])
AC_CACHE_CHECK([if $CC supports -fvisibility=hidden],
[cc_cv_flag_visibility],
[cc_flag_visibility_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $cc_cv_werror"
CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden],
cc_cv_flag_visibility='yes',
cc_cv_flag_visibility='no')
CFLAGS="$cc_flag_visibility_save_CFLAGS"])
AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
[AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1,
[Define this if the compiler supports the -fvisibility flag])
$1],
[$2])
])
AC_DEFUN([CC_FUNC_EXPECT], [
AC_REQUIRE([CC_CHECK_WERROR])
AC_CACHE_CHECK([if compiler has __builtin_expect function],
[cc_cv_func_expect],
[ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $cc_cv_werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[int some_function() {
int a = 3;
return (int)__builtin_expect(a, 3);
}])],
[cc_cv_func_expect=yes],
[cc_cv_func_expect=no])
CFLAGS="$ac_save_CFLAGS"
])
AS_IF([test "x$cc_cv_func_expect" = "xyes"],
[AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1,
[Define this if the compiler supports __builtin_expect() function])
$1],
[$2])
])
AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
AC_REQUIRE([CC_CHECK_WERROR])
AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported],
[cc_cv_attribute_aligned],
[ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $cc_cv_werror"
for cc_attribute_align_try in 64 32 16 8 4 2; do
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
int main() {
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
return c;
}])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
done
CFLAGS="$ac_save_CFLAGS"
])
if test "x$cc_cv_attribute_aligned" != "x"; then
AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned],
[Define the highest alignment supported])
fi
])

View File

@@ -8,36 +8,22 @@
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
FILE *flog = NULL;
char *mylog;
char **ctr = NULL;
int automode = 0;
struct nic nics[20] = { { "" , "" , "" , "" } };
struct knic knics[20] = { { "" , "" , "" , "" } };
extern char *en_tr[];
extern char *de_tr[];
extern char *fr_tr[];
extern char *es_tr[];
extern char *pl_tr[];
extern char *ru_tr[];
extern char *nl_tr[];
extern char *tr_tr[];
int main(int argc, char *argv[])
{
#ifdef LANG_EN_ONLY
char *shortlangnames[] = { "en", NULL };
char **langtrs[] = { en_tr, NULL };
#else
char *shortlangnames[] = { "de", "en", "fr", "es", "nl", "pl", "ru", "tr", NULL };
char **langtrs[] = { de_tr, en_tr, fr_tr, es_tr, nl_tr, pl_tr, ru_tr, tr_tr, NULL };
#endif
int choice;
char *sections[11]; /* need to fill this out AFTER knowning lang */
int rc;
@@ -67,6 +53,7 @@ int main(int argc, char *argv[])
if (!setlocale(LC_CTYPE,""))
fprintf(flog, "Locale not spezified. Check LANG, LC_CTYPE, RC_ALL.");
#if 0
kv = initkeyvalues();
if (!(readkeyvalues(kv, CONFIG_ROOT "/main/settings")))
{
@@ -95,15 +82,16 @@ int main(int argc, char *argv[])
goto EXIT;
ctr = langtrs[choice];
}
#endif
sections[0] = ctr[TR_KEYBOARD_MAPPING];
sections[1] = ctr[TR_TIMEZONE];
sections[2] = ctr[TR_HOSTNAME];
sections[3] = ctr[TR_DOMAINNAME];
sections[4] = ctr[TR_NETWORKING];
sections[5] = ctr[TR_ISDN];
sections[6] = ctr[TR_ROOT_PASSWORD];
sections[7] = ctr[TR_ADMIN_PASSWORD];
sections[0] = _("Keyboard mapping");
sections[1] = _("Timezone");
sections[2] = _("Hostname");
sections[3] = _("Domain name");
sections[4] = _("Networking");
sections[5] = _("ISDN");
sections[6] = _("'root' password");
sections[7] = _("'admin' password");
sections[8] = NULL;
newtInit();
@@ -119,16 +107,16 @@ int main(int argc, char *argv[])
sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
}
newtDrawRootText(14, 0, title);
newtPushHelpLine(ctr[TR_HELPLINE]);
newtPushHelpLine(_(" <Tab>/<Alt-Tab> between elements | <Space> selects"));
if (automode == 0)
{
choice = 0;
for (;;)
{
rc = newtWinMenu(ctr[TR_SECTION_MENU],
ctr[TR_SELECT_THE_ITEM], 50, 5, 5, 11,
sections, &choice, ctr[TR_OK], ctr[TR_QUIT], NULL);
rc = newtWinMenu(_("Section menu"),
_("Select the item you wish to configure."), 50, 5, 5, 11,
sections, &choice, _("OK"), _("Quit"), NULL);
if (rc == 2)
break;
@@ -196,15 +184,17 @@ int main(int argc, char *argv[])
autook = 1;
}
EXIT:
EXIT:
if (automode != 0)
{
sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
if (autook)
newtWinMessage(title, ctr[TR_OK], ctr[TR_SETUP_FINISHED]);
else
{
newtWinMessage(ctr[TR_WARNING], ctr[TR_OK], ctr[TR_SETUP_NOT_COMPLETE]);
newtWinMessage(title, _("OK"), _("Setup is complete."));
else {
newtWinMessage(_("Warning"), _("OK"),
_("Initial setup was not entirely complete. "
"You must ensure that Setup is properly finished by running "
"setup again at the shell."));
fprintf(flog, "Setup program has not finished.\n");
fflush(flog);

View File

@@ -7,14 +7,16 @@
* Misc. stuff for the lib.
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
/* This will rewrite /etc/hosts, /etc/hosts.*, and the apache ServerName file. */
@@ -35,7 +37,7 @@ int writehostsfiles(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
findkey(kv, "GREEN_ADDRESS", address);
@@ -47,7 +49,7 @@ int writehostsfiles(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
strcpy(hostname, SNAME );
@@ -57,7 +59,7 @@ int writehostsfiles(void)
if (!(file = fopen(CONFIG_ROOT "/main/hostname.conf", "w")))
{
sprintf (message, ctr[TR_UNABLE_TO_WRITE_VAR_SMOOTHWALL_MAIN_HOSTNAMECONF], CONFIG_ROOT);
sprintf (message, _("Unable to write %s/main/hostname.conf"), CONFIG_ROOT);
errorbox(message);
return 0;
}
@@ -66,12 +68,12 @@ int writehostsfiles(void)
if (!(file = fopen(CONFIG_ROOT "/main/hosts", "r")))
{
errorbox(ctr[TR_UNABLE_TO_OPEN_HOSTS_FILE]);
errorbox(_("Unable to open main hosts file."));
return 0;
}
if (!(hosts = fopen("/etc/hosts", "w")))
{
errorbox(ctr[TR_UNABLE_TO_WRITE_ETC_HOSTS]);
errorbox(_("Unable to write /etc/hosts."));
return 0;
}
fprintf(hosts, "127.0.0.1\tlocalhost\n");
@@ -112,7 +114,7 @@ int writehostsfiles(void)
/* TCP wrappers stuff. */
if (!(file = fopen("/etc/hosts.deny", "w")))
{
errorbox(ctr[TR_UNABLE_TO_WRITE_ETC_HOSTS_DENY]);
errorbox(_("Unable to write /etc/hosts.deny."));
return 0;
}
fprintf(file, "ALL : ALL\n");
@@ -120,7 +122,7 @@ int writehostsfiles(void)
if (!(file = fopen("/etc/hosts.allow", "w")))
{
errorbox(ctr[TR_UNABLE_TO_WRITE_ETC_HOSTS_ALLOW]);
errorbox(_("Unable to write /etc/hosts.allow."));
return 0;
}
fprintf(file, "sshd : ALL\n");
@@ -131,7 +133,7 @@ int writehostsfiles(void)
sprintf(commandstring, "/bin/hostname %s.%s", hostname, domainname);
if (mysystem(commandstring))
{
errorbox(ctr[TR_UNABLE_TO_SET_HOSTNAME]);
errorbox(_("Unable to set hostname."));
return 0;
}
@@ -142,8 +144,8 @@ int handleisdn(void)
{
char command[STRING_SIZE];
sprintf(command, "/etc/rc.d/init.d/mISDN config");
if (runcommandwithstatus(command, ctr[TR_PROBING_ISDN]))
errorbox(ctr[TR_ERROR_PROBING_ISDN]);
if (runcommandwithstatus(command, _("ISDN"), _("Scanning and configuring ISDN devices.")))
errorbox(_("Unable to scan for ISDN devices."));
// Need to write some lines that count the cards and say the names...
return 1;
}

View File

@@ -8,14 +8,18 @@
*
*/
#include "libsmooth.h"
#include <libsmooth.h>
#include <signal.h>
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern struct nic nics[];
extern struct knic knics[];
@@ -79,12 +83,12 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
sprintf(dhcphostnamefield, "%s_DHCP_HOSTNAME", colour);
sprintf(dhcpforcemtufield, "%s_DHCP_FORCE_MTU", colour);
sprintf(message, ctr[TR_INTERFACE], colour);
sprintf(message, _("Interface - %s"), colour);
newtCenteredWindow(44, (typeflag ? 18 : 12), message);
networkform = newtForm(NULL, NULL, 0);
sprintf(message, ctr[TR_ENTER_THE_IP_ADDRESS_INFORMATION], colour);
sprintf(message, _("Enter the IP address information for the %s interface."), colour);
header = newtTextboxReflowed(1, 1, message, 42, 0, 0, 0);
newtFormAddComponent(networkform, header);
@@ -96,18 +100,19 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
if (strcmp(temp, "STATIC") == 0) startstatictype = 1;
if (strcmp(temp, "DHCP") == 0) startdhcptype = 1;
if (strcmp(temp, "PPPOE") == 0) startpppoetype = 1;
statictyperadio = newtRadiobutton(2, 4, ctr[TR_STATIC], startstatictype, NULL);
dhcptyperadio = newtRadiobutton(2, 5, ctr[TR_DHCP], startdhcptype, statictyperadio);
pppoetyperadio = newtRadiobutton(2, 6, ctr[TR_PPP_DIALUP], startpppoetype, dhcptyperadio);
statictyperadio = newtRadiobutton(2, 4, _("Static"), startstatictype, NULL);
dhcptyperadio = newtRadiobutton(2, 5, _("DHCP"), startdhcptype, statictyperadio);
pppoetyperadio = newtRadiobutton(2, 6, _("PPP DIALUP (PPPoE, modem, ATM ...)"),
startpppoetype, dhcptyperadio);
newtFormAddComponents(networkform, statictyperadio, dhcptyperadio,
pppoetyperadio, NULL);
newtComponentAddCallback(statictyperadio, networkdialogcallbacktype, NULL);
newtComponentAddCallback(dhcptyperadio, networkdialogcallbacktype, NULL);
newtComponentAddCallback(pppoetyperadio, networkdialogcallbacktype, NULL);
dhcphostnamelabel = newtTextbox(2, 8, 18, 1, 0);
newtTextboxSetText(dhcphostnamelabel, ctr[TR_DHCP_HOSTNAME]);
newtTextboxSetText(dhcphostnamelabel, _("DHCP Hostname:"));
dhcpforcemtulabel = newtTextbox(2, 9, 18, 1, 0);
newtTextboxSetText(dhcpforcemtulabel, ctr[TR_DHCP_FORCE_MTU]);
newtTextboxSetText(dhcpforcemtulabel, _("Force DHCP MTU:"));
strcpy(temp, defaultdhcphostname);
findkey(kv, dhcphostnamefield, temp);
dhcphostnameentry = newtEntry(20, 8, temp, 20, &dhcphostnameresult, 0);
@@ -126,7 +131,7 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
}
/* Address */
addresslabel = newtTextbox(2, (typeflag ? 11 : 4) + 0, 18, 1, 0);
newtTextboxSetText(addresslabel, ctr[TR_IP_ADDRESS_PROMPT]);
newtTextboxSetText(addresslabel, _("IP address:"));
strcpy(temp, "");
findkey(kv, addressfield, temp);
addressentry = newtEntry(20, (typeflag ? 11 : 4) + 0, temp, 20, &addressresult, 0);
@@ -138,7 +143,7 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
/* Netmask */
netmasklabel = newtTextbox(2, (typeflag ? 11 : 4) + 1, 18, 1, 0);
newtTextboxSetText(netmasklabel, ctr[TR_NETMASK_PROMPT]);
newtTextboxSetText(netmasklabel, _("Network mask:"));
strcpy(temp, "255.255.255.0"); findkey(kv, netmaskfield, temp);
netmaskentry = newtEntry(20, (typeflag ? 11 : 4) + 1, temp, 20, &netmaskresult, 0);
newtEntrySetFilter(netmaskentry, ip_input_filter, NULL);
@@ -149,8 +154,8 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
newtFormAddComponent(networkform, netmaskentry);
/* Buttons. */
ok = newtButton(8, (typeflag ? 14 : 7), ctr[TR_OK]);
cancel = newtButton(26, (typeflag ? 14 : 7), ctr[TR_CANCEL]);
ok = newtButton(8, (typeflag ? 14 : 7), _("OK"));
cancel = newtButton(26, (typeflag ? 14 : 7), _("Cancel"));
newtFormAddComponents(networkform, ok, cancel, NULL);
@@ -165,7 +170,8 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
if (es.u.co == ok)
{
/* OK was pressed; verify the contents of each entry. */
strcpy(message, ctr[TR_INVALID_FIELDS]);
strcpy(message, _("The following fields are invalid:"));
strcat(message, "\n\n");
strcpy(type, "STATIC");
if (typeflag)
@@ -174,12 +180,14 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
{
if (inet_addr(addressresult) == INADDR_NONE)
{
strcat(message, ctr[TR_IP_ADDRESS_CR]);
strcat(message, _("IP address"));
strcat(message, "\n");
error = 1;
}
if (inet_addr(netmaskresult) == INADDR_NONE)
{
strcat(message, ctr[TR_NETWORK_MASK_CR]);
strcat(message, _("Network mask"));
strcat(message, "\n");
error = 1;
}
}
@@ -187,7 +195,8 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
{
if (!strlen(dhcphostnameresult))
{
strcat(message, ctr[TR_DHCP_HOSTNAME_CR]);
strcat(message, _("DHCP hostname"));
strcat(message, "\n");
error = 1;
}
}
@@ -365,7 +374,7 @@ int get_knic(int card) //returns "0" for zero cards or error and "1" card is fo
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -384,7 +393,7 @@ int get_knic(int card) //returns "0" for zero cards or error and "1" card is fo
strcpy(knics[ card ].driver, temp);
ret_value = 1;
} else {
strcpy(knics[ card ].description, ctr[TR_UNSET]);
strcpy(knics[ card ].description, _("Unset"));
ret_value = 0;
}
freekeyvalues(kv);
@@ -554,7 +563,7 @@ int write_configs_netudev(int card , int colour)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -657,16 +666,17 @@ int nicmenu(int colour)
pMenuInhalt[mcount] = NULL;
sprintf(message, ctr[TR_CHOOSE_NETCARD], ucolourcard[colour]);
sprintf(message, _("Please choose a networkcard for the following interface - %s."), ucolourcard[colour]);
rc=2;
while ( rc == 2 ) {
rc = newtWinMenu( ctr[TR_NETCARDMENU2], message, 50, 5, 5, 6, pMenuInhalt, &choise, ctr[TR_SELECT], ctr[TR_IDENTIFY], ctr[TR_CANCEL], NULL);
rc = newtWinMenu(_("Extended Network Menu"), message, 50, 5, 5, 6, pMenuInhalt, &choise,
_("Select"), _("Identify"), _("Cancel"), NULL);
if ( rc == 2 ) {
sprintf(temp, "/sbin/ip link set %s up", nics[found_NIC_as_Card[choise]].nic);
mysystem(temp);
sprintf(temp, "/usr/sbin/ethtool -p %s 10", nics[found_NIC_as_Card[choise]].nic);
if (runcommandwithstatus(temp,ctr[TR_IDENTIFY_SHOULD_BLINK]) != 0) {
errorbox(ctr[TR_IDENTIFY_NOT_SUPPORTED]);
if (runcommandwithstatus(temp, _("Device Identification"), _("The lights on the selected port should flash now for 10 seconds...")) != 0) {
errorbox(_("Identification is not supported by this interface."));
sprintf(temp, "/sbin/ip link set %s down", nics[found_NIC_as_Card[choise]].nic);
mysystem(temp);
}
@@ -678,7 +688,7 @@ int nicmenu(int colour)
return 0;
} else {
// We have to add here that you can manually add a device
errorbox( ctr[TR_ERROR_INTERFACES]);
errorbox(_("There are no unassigned interfaces on your system."));
return 1;
}
}
@@ -691,12 +701,12 @@ int clear_card_entry(int card)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
strcpy(knics[card].driver, "");
strcpy(knics[card].description, ctr[TR_UNSET]);
strcpy(knics[card].description, _("Unset"));
strcpy(knics[card].macaddr, "");
strcpy(knics[card].colour, "");
sprintf(temp, "%s_DRIVER", ucolourcard[card]);
@@ -719,8 +729,8 @@ int ask_clear_card_entry(int card)
char message[STRING_SIZE];
int rc;
sprintf(message, ctr[TR_REMOVE_CARD], ucolourcard[card]);
rc = newtWinChoice(ctr[TR_WARNING], ctr[TR_OK], ctr[TR_CANCEL], message);
sprintf(message, _("Do you really want to remove the assigned %s interface?"), ucolourcard[card]);
rc = newtWinChoice(_("Warning"), _("OK"), _("Cancel"), message);
if ( rc = 0 || rc == 1) {
clear_card_entry(card);
@@ -742,15 +752,14 @@ int manualdriver(char *driver, char *driveroptions)
strcpy(driver, "");
strcpy(driveroptions, "");
rc = newtWinEntries(ctr[TR_SELECT_NETWORK_DRIVER],
ctr[TR_MODULE_PARAMETERS], 50, 5, 5, 40, entries,
ctr[TR_OK], ctr[TR_CANCEL], NULL);
rc = newtWinEntries(_("Select network driver"), _("Set additional module parameters"),
50, 5, 5, 40, entries, _("OK"), _("Cancel"), NULL);
if (rc == 0 || rc == 1)
{
if (strlen(values[0]))
{
sprintf(commandstring, "/sbin/modprobe %s", values[0]);
if (runcommandwithstatus(commandstring, ctr[TR_LOADING_MODULE]) == 0)
if (runcommandwithstatus(commandstring, _("Loading module..."), _("Loading module...")) == 0)
{
if ((driverend = strchr(values[0], ' ')))
{
@@ -765,10 +774,10 @@ int manualdriver(char *driver, char *driveroptions)
}
}
else
errorbox(ctr[TR_UNABLE_TO_LOAD_DRIVER_MODULE]);
errorbox(_("Unable to load driver module."));
}
else
errorbox(ctr[TR_MODULE_NAME_CANNOT_BE_BLANK]);
errorbox(_("Module name cannot be blank."));
}
free(values[0]);

View File

@@ -7,7 +7,11 @@
* The big one: networking.
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
#define DNS1 0
@@ -18,8 +22,6 @@
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
#define HAS_GREEN 1
@@ -105,12 +107,12 @@ int handlenetworking(void)
if (netaddresschange)
{
runcommandwithstatus("/etc/rc.d/init.d/network stop",
ctr[TR_PUSHING_NETWORK_DOWN]);
_("Networking"), _("Stopping network..."));
rename_nics();
runcommandwithstatus("/etc/rc.d/init.d/network start",
ctr[TR_PULLING_NETWORK_UP]);
_("Networking"), _("Restarting network..."));
}
} else {
rename_nics();
@@ -129,7 +131,7 @@ int oktoleave(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -141,13 +143,13 @@ int oktoleave(void)
strcpy(temp, ""); findkey(kv, "GREEN_DEV", temp);
if (!(strlen(temp)))
{
errorbox(ctr[TR_NO_GREEN_INTERFACE]);
errorbox(_("No GREEN interface assigned."));
freekeyvalues(kv);
return 0;
}
if (!(interfacecheck(kv, "GREEN")))
{
errorbox(ctr[TR_MISSING_GREEN_IP]);
errorbox(_("Missing an IP address on GREEN."));
freekeyvalues(kv);
return 0;
}
@@ -158,7 +160,8 @@ int oktoleave(void)
strcpy(temp, ""); findkey(kv, "RED_DEV", temp);
if (!(strlen(temp)))
{
rc = newtWinChoice(ctr[TR_ERROR], ctr[TR_OK], ctr[TR_IGNORE], ctr[TR_NO_RED_INTERFACE]);
rc = newtWinChoice(_("Error"), _("OK"), _("Ignore"),
_("No RED interface assigned."));
if (rc == 0 || rc == 1)
{
freekeyvalues(kv);
@@ -167,7 +170,7 @@ int oktoleave(void)
}
if (!(interfacecheck(kv, "RED")))
{
errorbox(ctr[TR_MISSING_RED_IP]);
errorbox(_("Missing an IP address on RED."));
freekeyvalues(kv);
return 0;
}
@@ -177,13 +180,13 @@ int oktoleave(void)
strcpy(temp, ""); findkey(kv, "ORANGE_DEV", temp);
if (!(strlen(temp)))
{
errorbox(ctr[TR_NO_ORANGE_INTERFACE]);
errorbox(_("No ORANGE interface assigned."));
freekeyvalues(kv);
return 0;
}
if (!(interfacecheck(kv, "ORANGE")))
{
errorbox(ctr[TR_MISSING_ORANGE_IP]);
errorbox(_("Missing an IP address on ORANGE."));
freekeyvalues(kv);
return 0;
}
@@ -193,13 +196,13 @@ int oktoleave(void)
strcpy(temp, ""); findkey(kv, "BLUE_DEV", temp);
if (!(strlen(temp)))
{
errorbox(ctr[TR_NO_BLUE_INTERFACE]);
errorbox(_("No BLUE interface assigned."));
freekeyvalues(kv);
return 0;
}
if (!(interfacecheck(kv, "BLUE")))
{
errorbox(ctr[TR_MISSING_BLUE_IP]);
errorbox(_("Missing an IP address on BLUE."));
freekeyvalues(kv);
return 0;
}
@@ -211,14 +214,14 @@ int oktoleave(void)
strcpy(temp, ""); findkey(kv, "DNS1", temp);
if (!(strlen(temp)))
{
errorbox(ctr[TR_MISSING_DNS]);
errorbox(_("Misssing DNS."));
freekeyvalues(kv);
return 0;
}
strcpy(temp, ""); findkey(kv, "DEFAULT_GATEWAY", temp);
if (!(strlen(temp)))
{
errorbox(ctr[TR_MISSING_DEFAULT]);
errorbox(_("Missing Default Gateway."));
freekeyvalues(kv);
return 0;
}
@@ -230,10 +233,13 @@ int oktoleave(void)
/* Shows the main menu and a summary of the current settings. */
int firstmenu(void)
{
char *sections[] = { ctr[TR_NETWORK_CONFIGURATION_TYPE],
ctr[TR_DRIVERS_AND_CARD_ASSIGNMENTS],
ctr[TR_ADDRESS_SETTINGS],
ctr[TR_DNS_AND_GATEWAY_SETTINGS], NULL };
char *sections[] = {
_("Network configuration type"),
_("Drivers and card assignments"),
_("Address settings"),
_("DNS and Gateway settings"),
NULL
};
int rc;
static int choice = 0;
struct keyvalue *kv = initkeyvalues();
@@ -246,22 +252,22 @@ int firstmenu(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
if (netaddresschange)
strcpy(networkrestart, ctr[TR_RESTART_REQUIRED]);
strcpy(networkrestart, _("When configuration is complete, a network restart will be required."));
strcpy(temp, ""); findkey(kv, "CONFIG_TYPE", temp);
x = atol(temp);
x--;
if (x < 0 || x > 4) x = 0;
/* Format heading bit. */
snprintf(message, 1000, ctr[TR_CURRENT_CONFIG], configtypenames[x],
snprintf(message, 1000, _("Current config: %s%s"), configtypenames[x],
networkrestart);
rc = newtWinMenu(ctr[TR_NETWORK_CONFIGURATION_MENU], message, 50, 5, 5, 6,
sections, &choice, ctr[TR_OK], ctr[TR_DONE], NULL);
rc = newtWinMenu(_("Network configuration menu"), message, 50, 5, 5, 6,
sections, &choice, _("OK"), _("Done"), NULL);
if (rc == 0 || rc == 1)
result = choice + 1;
@@ -283,7 +289,7 @@ int configtypemenu(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -292,11 +298,15 @@ int configtypemenu(void)
findkey(kv, "CONFIG_TYPE", temp); choise = atol(temp);
choise--;
sprintf(message, ctr[TR_NETWORK_CONFIGURATION_TYPE_LONG], NAME);
rc = newtWinMenu(ctr[TR_NETWORK_CONFIGURATION_TYPE], message, 50, 5, 5,
6, configtypenames, &choise, ctr[TR_OK], ctr[TR_CANCEL], NULL);
sprintf(message, _("Select the network configuration for %s. "
"The following configuration types list those interfaces which have ethernet attached. "
"If you change this setting, a network restart will be required, and you will have to "
"reconfigure the network driver assignments."), NAME);
rc = newtWinMenu(_("Network configuration type"), message, 50, 5, 5,
6, configtypenames, &choise, _("OK"), _("Cancel"), NULL);
if ( configtypecards[choise] > found ) {
sprintf(message, ctr[TR_NOT_ENOUGH_INTERFACES] , configtypecards[choise], found);
sprintf(message, _("Not enough netcards for your choice.\n\nNeeded: %d - Available: %d\n"),
configtypecards[choise], found);
errorbox(message);
}
@@ -334,7 +344,7 @@ int drivermenu(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -347,42 +357,43 @@ int drivermenu(void)
writekeyvalues(kv, CONFIG_ROOT "/ethernet/settings");
}
strcpy(message, ctr[TR_CONFIGURE_NETWORK_DRIVERS]);
strcpy(message, _("Configure network drivers, and which interface each card is assigned to. "
"The current configuration is as follows:\n\n"));
kcount = 0;
neednics = 0;
if (HAS_GREEN) {
sprintf(temp, "GREEN: %s\n", knics[_GREEN_CARD_].description);
sprintf(temp, "%-6s: %s\n", "GREEN", knics[_GREEN_CARD_].description);
strcat(message, temp);
if (strlen(knics[_GREEN_CARD_].macaddr) ) {
sprintf(temp, "GREEN: (%s) %s green0\n", knics[_GREEN_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "GREEN", knics[_GREEN_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
}
if (HAS_RED) {
sprintf(temp, "RED: %s\n", knics[_RED_CARD_].description);
sprintf(temp, "%-6s: %s\n", "RED", knics[_RED_CARD_].description);
strcat(message, temp);
if (strlen(knics[_RED_CARD_].macaddr) ) {
sprintf(temp, "RED: (%s) %s red0\n", knics[_RED_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "RED", knics[_RED_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
}
if (HAS_ORANGE) {
sprintf(temp, "ORANGE: %s\n", knics[_ORANGE_CARD_].description);
sprintf(temp, "%-6s: %s\n", "ORANGE", knics[_ORANGE_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_ORANGE_CARD_].macaddr) ) {
sprintf(temp, "ORANGE: (%s) %s orange0\n", knics[_ORANGE_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "ORANGE", knics[_ORANGE_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
}
if (HAS_BLUE) {
sprintf(temp, "BLUE: %s\n", knics[_BLUE_CARD_].description);
sprintf(temp, "%-6s: %s\n", "BLUE", knics[_BLUE_CARD_].description);
strcat(message, temp);
if (strlen(knics[_BLUE_CARD_].macaddr)) {
sprintf(temp, "BLUE: (%s) %s blue0\n", knics[_BLUE_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "BLUE", knics[_BLUE_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
@@ -394,9 +405,10 @@ int drivermenu(void)
if (neednics = kcount)
{
strcat(message, ctr[TR_DO_YOU_WISH_TO_CHANGE_THESE_SETTINGS]);
rc = newtWinChoice(ctr[TR_DRIVERS_AND_CARD_ASSIGNMENTS], ctr[TR_OK],
ctr[TR_CANCEL], message);
strcat(message, "\n");
strcat(message, _("Do you wish to change these settings?"));
rc = newtWinChoice(_("Drivers and card assignments"), _("OK"),
_("Cancel"), message);
if (rc == 0 || rc == 1)
{
changedrivers();
@@ -428,12 +440,12 @@ int changedrivers(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
if (automode == 0)
runcommandwithstatus("/etc/rc.d/init.d/network stop red blue orange",
ctr[TR_PUSHING_NON_LOCAL_NETWORK_DOWN]);
_("Networking"), _("Restarting non-local network..."));
findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
if (configtype == 1)
@@ -450,16 +462,16 @@ int changedrivers(void)
do
{
count = 0;
strcpy(message, ctr[TR_INTERFACE_CHANGE]);
strcpy(message, _("Please choose the interface you wish to change.\n\n"));
if (green) {
strcpy(MenuInhalt[count], "GREEN");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_GREEN_CARD_] = count;
sprintf(temp, "GREEN: %s\n", knics[_GREEN_CARD_].description);
sprintf(temp, "%-6s: %s\n", "GREEN", knics[_GREEN_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_GREEN_CARD_].macaddr) ) {
sprintf(temp, "GREEN: (%s) %s green0\n", knics[_GREEN_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "GREEN", knics[_GREEN_CARD_].macaddr);
strcat(message, temp);
}
count++;
@@ -469,10 +481,10 @@ int changedrivers(void)
strcpy(MenuInhalt[count], "RED");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_RED_CARD_] = count;
sprintf(temp, "RED: %s\n", knics[_RED_CARD_].description);
sprintf(temp, "%-6s: %s\n", "RED", knics[_RED_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_RED_CARD_].macaddr) ) {
sprintf(temp, "RED: (%s) %s red0\n", knics[_RED_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "RED", knics[_RED_CARD_].macaddr);
strcat(message, temp);
}
count++;
@@ -482,10 +494,10 @@ int changedrivers(void)
strcpy(MenuInhalt[count], "ORANGE");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_ORANGE_CARD_] = count;
sprintf(temp, "ORANGE: %s\n", knics[_ORANGE_CARD_].description);
sprintf(temp, "%-6s: %s\n", "ORANGE", knics[_ORANGE_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_ORANGE_CARD_].macaddr) ) {
sprintf(temp, "ORANGE: (%s) %s orange0\n", knics[_ORANGE_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "ORANGE", knics[_ORANGE_CARD_].macaddr);
strcat(message, temp);
}
count++;
@@ -495,17 +507,18 @@ int changedrivers(void)
strcpy(MenuInhalt[count], "BLUE");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_BLUE_CARD_] = count;
sprintf(temp, "BLUE: %s\n", knics[_BLUE_CARD_].description);
sprintf(temp, "%-6s: %s\n", "BLUE", knics[_BLUE_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_BLUE_CARD_].macaddr) ) {
sprintf(temp, "BLUE: (%s) %s blue0\n", knics[_BLUE_CARD_].macaddr, ctr[TR_AS]);
sprintf(temp, "%-6s: (%s)\n", "BLUE", knics[_BLUE_CARD_].macaddr);
strcat(message, temp);
}
count++;
}
pMenuInhalt[count] = NULL;
rc = newtWinMenu( ctr[TR_NETCARD_COLOR], message, 70, 5, 5, 6, pMenuInhalt, &choise, ctr[TR_SELECT], ctr[TR_REMOVE], ctr[TR_DONE], NULL);
rc = newtWinMenu(_("Assigned Cards"), message, 70, 5, 5, 6, pMenuInhalt,
&choise, _("Select"), _("Remove"), _("Done"), NULL);
if ( rc == 0 || rc == 1) {
if ((green) && ( choise == NicEntry[0])) nicmenu(_GREEN_CARD_);
@@ -537,12 +550,15 @@ int greenaddressmenu(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
sprintf(message, ctr[TR_WARNING_LONG], NAME);
rc = newtWinChoice(ctr[TR_WARNING], ctr[TR_OK], ctr[TR_CANCEL], message);
sprintf(message, _("If you change this IP address, and you are logged in remotely, "
"your connection to the %s machine will be broken, and you will have to reconnect "
"on the new IP. This is a risky operation, and should only be attempted if you "
"have physical access to the machine, should something go wrong."), NAME);
rc = newtWinChoice(_("Warning"), _("OK"), _("Cancel"), message);
if (rc == 0 || rc == 1)
{
@@ -585,14 +601,14 @@ int addressesmenu(void)
{
freekeyvalues(kv);
freekeyvalues(mainkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
if (!(readkeyvalues(mainkv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(kv);
freekeyvalues(mainkv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -622,18 +638,20 @@ int addressesmenu(void)
done = 0;
while (!done)
{
rc = newtWinMenu(ctr[TR_ADDRESS_SETTINGS],
ctr[TR_SELECT_THE_INTERFACE_YOU_WISH_TO_RECONFIGURE], 50, 5,
5, 6, sections, &choice, ctr[TR_OK], ctr[TR_DONE], NULL);
rc = newtWinMenu(_("Address settings"),
_("Select the interface you wish to reconfigure."), 50, 5,
5, 6, sections, &choice, _("OK"), _("Done"), NULL);
if (rc == 0 || rc == 1)
{
if (strcmp(sections[choice], "GREEN") == 0)
{
findkey(kv, "GREEN_ADDRESS", oldgreenaddress);
sprintf(message, ctr[TR_WARNING_LONG], NAME);
rc = newtWinChoice(ctr[TR_WARNING], ctr[TR_OK], ctr[TR_CANCEL],
message);
sprintf(message, _("If you change this IP address, and you are logged in remotely, "
"your connection to the %s machine will be broken, and you will have to reconnect "
"on the new IP. This is a risky operation, and should only be attempted if you "
"have physical access to the machine, should something go wrong."), NAME);
rc = newtWinChoice(_("Warning"), _("OK"), _("Cancel"), message);
if (rc == 0 || rc == 1)
{
if (changeaddress(kv, "GREEN", 0, ""))
@@ -693,23 +711,23 @@ int dnsgatewaymenu(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
entries[DNS1].text = ctr[TR_PRIMARY_DNS];
entries[DNS1].text = _("Primary DNS:");
strcpy(temp, ""); findkey(kv, "DNS1", temp);
values[DNS1] = strdup(temp);
entries[DNS1].value = &values[DNS1];
entries[DNS1].flags = 0;
entries[DNS2].text = ctr[TR_SECONDARY_DNS];
entries[DNS2].text = _("Secondary DNS:");
strcpy(temp, ""); findkey(kv, "DNS2", temp);
values[DNS2] = strdup(temp);
entries[DNS2].value = &values[DNS2];
entries[DNS2].flags = 0;
entries[DEFAULT_GATEWAY].text = ctr[TR_DEFAULT_GATEWAY];
entries[DEFAULT_GATEWAY].text = _("Default gateway:");
strcpy(temp, ""); findkey(kv, "DEFAULT_GATEWAY", temp);
values[DEFAULT_GATEWAY] = strdup(temp);
entries[DEFAULT_GATEWAY].value = &values[DEFAULT_GATEWAY];
@@ -723,17 +741,20 @@ int dnsgatewaymenu(void)
{
error = 0;
rc = newtWinEntries(ctr[TR_DNS_AND_GATEWAY_SETTINGS],
ctr[TR_DNS_AND_GATEWAY_SETTINGS_LONG], 50, 5, 5, 18, entries,
ctr[TR_OK], ctr[TR_CANCEL], NULL);
rc = newtWinEntries(_("DNS and Gateway settings"),
_("Enter the DNS and gateway information. "
"These settings are used only with Static IP (and DHCP if DNS set) on the RED interface."),
50, 5, 5, 18, entries, _("OK"), _("Cancel"), NULL);
if (rc == 0 || rc == 1)
{
strcpy(message, ctr[TR_INVALID_FIELDS]);
strcpy(message, _("The following fields are invalid:"));
strcpy(message, "\n\n");
if (strlen(values[DNS1]))
{
if (inet_addr(values[DNS1]) == INADDR_NONE)
{
strcat(message, ctr[TR_PRIMARY_DNS_CR]);
strcat(message, _("Primary DNS"));
strcat(message, "\n");
error = 1;
}
}
@@ -741,7 +762,8 @@ int dnsgatewaymenu(void)
{
if (inet_addr(values[DNS2]) == INADDR_NONE)
{
strcat(message, ctr[TR_SECONDARY_DNS_CR]);
strcat(message, _("Secondary DNS"));
strcat(message, "\n");
error = 1;
}
}
@@ -749,13 +771,15 @@ int dnsgatewaymenu(void)
{
if (inet_addr(values[DEFAULT_GATEWAY]) == INADDR_NONE)
{
strcat(message, ctr[TR_DEFAULT_GATEWAY_CR]);
strcat(message, _("Default gateway"));
strcat(message, "\n");
error = 1;
}
}
if (!strlen(values[DNS1]) && strlen(values[DNS2]))
{
strcpy(message, ctr[TR_SECONDARY_WITHOUT_PRIMARY_DNS]);
strcpy(message, _("Secondary DNS specified without a Primary DNS"));
strcat(message, "\n");
error = 1;
}

View File

@@ -10,13 +10,15 @@
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
int getpassword(char *password, char *text);
@@ -28,14 +30,13 @@ int handlerootpassword(void)
char commandstring[STRING_SIZE];
/* Root password. */
if (getpassword(password, ctr[TR_ENTER_ROOT_PASSWORD]) == 2)
if (getpassword(password, _("Enter the 'root' user password. Login as this user for commandline access.")) == 2)
return 0;
snprintf(commandstring, STRING_SIZE,
"/bin/echo 'root:%s' | /usr/sbin/chpasswd", password);
if (runhiddencommandwithstatus(commandstring, ctr[TR_SETTING_ROOT_PASSWORD]))
{
errorbox(ctr[TR_PROBLEM_SETTING_ROOT_PASSWORD]);
if (runhiddencommandwithstatus(commandstring, _("Setting password"), _("Setting 'root' password...."))) {
errorbox(_("Problem setting 'root' password."));
return 0;
}
@@ -49,16 +50,16 @@ int handleadminpassword(void)
char message[1000];
/* web interface admin password. */
sprintf(message, ctr[TR_ENTER_ADMIN_PASSWORD], NAME, NAME);
sprintf(message, _("Enter %s 'admin' user password. "
"This is the user to use for logging into the %s web administration pages."), NAME, NAME);
if (getpassword(password, message) == 2)
return 0;
snprintf(commandstring, STRING_SIZE,
"/usr/sbin/htpasswd -c -m -b " CONFIG_ROOT "/auth/users admin '%s'", password);
sprintf(message, ctr[TR_SETTING_ADMIN_PASSWORD], NAME);
if (runhiddencommandwithstatus(commandstring, message))
{
sprintf(message, ctr[TR_PROBLEM_SETTING_ADMIN_PASSWORD], NAME);
sprintf(message, _("Setting %s 'admin' user password..."), NAME);
if (runhiddencommandwithstatus(commandstring, _("Setting password"), message)) {
sprintf(message, _("Problem setting %s 'admin' user password."), NAME);
errorbox(message);
return 0;
}
@@ -72,8 +73,8 @@ int getpassword(char *password, char *text)
char *values[] = { NULL, NULL, NULL }; /* pointers for the values. */
struct newtWinEntry entries[] =
{
{ ctr[TR_PASSWORD_PROMPT], &values[0], 2 },
{ ctr[TR_AGAIN_PROMPT], &values[1], 2 },
{ _("Password:"), &values[0], 2 },
{ _("Again:"), &values[1], 2 },
{ NULL, NULL, 0 }
};
char title[STRING_SIZE];
@@ -85,27 +86,27 @@ int getpassword(char *password, char *text)
done = 1;
sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
rc = newtWinEntries(title, text,
65, 5, 5, 50, entries, ctr[TR_OK], ctr[TR_CANCEL], NULL);
65, 5, 5, 50, entries, _("OK"), _("Cancel"), NULL);
if (rc != 2)
{
if (strlen(values[0]) == 0 || strlen(values[1]) == 0)
{
errorbox(ctr[TR_PASSWORD_CANNOT_BE_BLANK]);
errorbox(_("Password cannot be blank."));
done = 0;
strcpy(values[0], "");
strcpy(values[1], "");
}
else if (strcmp(values[0], values[1]) != 0)
{
errorbox(ctr[TR_PASSWORDS_DO_NOT_MATCH]);
errorbox(_("Passwords do not match."));
done = 0;
strcpy(values[0], "");
strcpy(values[1], "");
}
else if (strchr(values[0], ' '))
{
errorbox(ctr[TR_PASSWORD_CANNOT_CONTAIN_SPACES]);
errorbox(_("Password cannot contain spaces."));
done = 0;
strcpy(values[0], "");
strcpy(values[1], "");

1
src/setup/po/LINGUAS Normal file
View File

@@ -0,0 +1 @@
de

41
src/setup/po/Makevars Normal file
View File

@@ -0,0 +1,41 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = The IPFire Project (www.ipfire.org)
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =

11
src/setup/po/POTFILES.in Normal file
View File

@@ -0,0 +1,11 @@
dhcp.c
domainname.c
hostname.c
keymap.c
main.c
misc.c
netstuff.c
networking.c
passwords.c
setup.h
timezone.c

582
src/setup/po/de.po Normal file
View File

@@ -0,0 +1,582 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR The IPFire Project (www.ipfire.org)
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Michael Tremer <michael.tremer@ipfire.org>, 2014
msgid ""
msgstr ""
"Project-Id-Version: IPFire Project\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-08-12 10:05+0000\n"
"PO-Revision-Date: 2014-08-12 10:10+0000\n"
"Last-Translator: Michael Tremer <michael.tremer@ipfire.org>\n"
"Language-Team: German (http://www.transifex.com/projects/p/ipfire/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: dhcp.c:50
msgid "Start address:"
msgstr ""
#: dhcp.c:51
msgid "End address:"
msgstr ""
#: dhcp.c:52 networking.c:718
msgid "Primary DNS:"
msgstr "Primärer DNS:"
#: dhcp.c:53 networking.c:724
msgid "Secondary DNS:"
msgstr "Sekundärer DNS:"
#: dhcp.c:54
msgid "Default lease (mins):"
msgstr ""
#: dhcp.c:55
msgid "Max lease (mins):"
msgstr ""
#: dhcp.c:56
msgid "Domain name suffix:"
msgstr ""
#: dhcp.c:86 dhcp.c:93 dhcp.c:101 domainname.c:34 hostname.c:37 keymap.c:70
#: misc.c:40 misc.c:52 netstuff.c:377 netstuff.c:566 netstuff.c:704
#: networking.c:134 networking.c:255 networking.c:292 networking.c:347
#: networking.c:443 networking.c:553 networking.c:604 networking.c:611
#: networking.c:714 timezone.c:63
msgid "Unable to open settings file"
msgstr ""
#: dhcp.c:111
msgid "DHCP server configuration"
msgstr ""
#: dhcp.c:116
msgid "Configure the DHCP server by entering the settings information."
msgstr ""
#: dhcp.c:125
msgid "Enabled"
msgstr ""
#: dhcp.c:142 domainname.c:43 hostname.c:47 keymap.c:86 main.c:119 main.c:192
#: main.c:194 netstuff.c:157 netstuff.c:733 netstuff.c:756 networking.c:163
#: networking.c:270 networking.c:306 networking.c:410 networking.c:561
#: networking.c:643 networking.c:654 networking.c:747 passwords.c:89
#: timezone.c:78
msgid "OK"
msgstr "OK"
#: dhcp.c:143 domainname.c:43 hostname.c:47 keymap.c:86 netstuff.c:158
#: netstuff.c:673 netstuff.c:733 netstuff.c:756 networking.c:306
#: networking.c:411 networking.c:561 networking.c:654 networking.c:747
#: passwords.c:89 timezone.c:78
msgid "Cancel"
msgstr "Abbrechen"
#: dhcp.c:156
msgid ""
"The following fields are invalid:\n"
"\n"
msgstr ""
#: dhcp.c:159
msgid "Start address"
msgstr "Startadresse"
#: dhcp.c:165
msgid "End address"
msgstr "Endadresse"
#: dhcp.c:173 networking.c:756
msgid "Primary DNS"
msgstr "Primärer DNS"
#: dhcp.c:182 networking.c:765
msgid "Secondary DNS"
msgstr ""
#: dhcp.c:189
msgid "Default lease time"
msgstr ""
#: dhcp.c:195
msgid "Max. lease time"
msgstr ""
#: domainname.c:42 main.c:90
msgid "Domain name"
msgstr ""
#: domainname.c:42
msgid "Enter Domain name"
msgstr ""
#: domainname.c:48
msgid "Domain name cannot be empty."
msgstr ""
#: domainname.c:50
msgid "Domain name cannot contain spaces."
msgstr ""
#: domainname.c:53
msgid "Domain name may only contain letters, numbers, hyphens and periods."
msgstr ""
#: hostname.c:46 main.c:89
msgid "Hostname"
msgstr "Hostname"
#: hostname.c:46
msgid "Enter the machine's hostname."
msgstr ""
#: hostname.c:53
msgid "Hostname cannot be empty."
msgstr ""
#: hostname.c:55
msgid "Hostname cannot contain spaces."
msgstr ""
#: hostname.c:58
msgid "Hostname may only contain letters, numbers and hyphens."
msgstr ""
#: keymap.c:84 main.c:87
msgid "Keyboard mapping"
msgstr ""
#: keymap.c:85
msgid "Choose the type of keyboard you are using from the list below."
msgstr ""
#: main.c:88 timezone.c:77
msgid "Timezone"
msgstr "Zeitzone"
#: main.c:91 networking.c:110 networking.c:115 networking.c:448
msgid "Networking"
msgstr "Netzwerk"
#: main.c:92 misc.c:147
msgid "ISDN"
msgstr "ISDN"
#: main.c:93
msgid "'root' password"
msgstr ""
#: main.c:94
msgid "'admin' password"
msgstr ""
#: main.c:110
msgid " <Tab>/<Alt-Tab> between elements | <Space> selects"
msgstr ""
#: main.c:117
msgid "Section menu"
msgstr ""
#: main.c:118
msgid "Select the item you wish to configure."
msgstr ""
#: main.c:119
msgid "Quit"
msgstr "Beenden"
#: main.c:192
msgid "Setup is complete."
msgstr ""
#: main.c:194 netstuff.c:733 networking.c:561 networking.c:654
msgid "Warning"
msgstr "Warnung"
#: main.c:195
msgid ""
"Initial setup was not entirely complete. You must ensure that Setup is "
"properly finished by running setup again at the shell."
msgstr ""
#: misc.c:62
#, c-format
msgid "Unable to write %s/main/hostname.conf"
msgstr ""
#: misc.c:71
msgid "Unable to open main hosts file."
msgstr ""
#: misc.c:76
msgid "Unable to write /etc/hosts."
msgstr ""
#: misc.c:117
msgid "Unable to write /etc/hosts.deny."
msgstr ""
#: misc.c:125
msgid "Unable to write /etc/hosts.allow."
msgstr ""
#: misc.c:136
msgid "Unable to set hostname."
msgstr ""
#: misc.c:147
msgid "Scanning and configuring ISDN devices."
msgstr ""
#: misc.c:148
msgid "Unable to scan for ISDN devices."
msgstr ""
#: netstuff.c:86
#, c-format
msgid "Interface - %s"
msgstr ""
#: netstuff.c:91
#, c-format
msgid "Enter the IP address information for the %s interface."
msgstr ""
#: netstuff.c:103
msgid "Static"
msgstr ""
#: netstuff.c:104
msgid "DHCP"
msgstr ""
#: netstuff.c:105
msgid "PPP DIALUP (PPPoE, modem, ATM ...)"
msgstr ""
#: netstuff.c:113
msgid "DHCP Hostname:"
msgstr ""
#: netstuff.c:115
msgid "Force DHCP MTU:"
msgstr ""
#: netstuff.c:134
msgid "IP address:"
msgstr ""
#: netstuff.c:146
msgid "Network mask:"
msgstr ""
#: netstuff.c:173 networking.c:750
msgid "The following fields are invalid:"
msgstr ""
#: netstuff.c:183
msgid "IP address"
msgstr ""
#: netstuff.c:189
msgid "Network mask"
msgstr ""
#: netstuff.c:198
msgid "DHCP hostname"
msgstr ""
#: netstuff.c:396 netstuff.c:709
msgid "Unset"
msgstr ""
#: netstuff.c:669
#, c-format
msgid "Please choose a networkcard for the following interface - %s."
msgstr ""
#: netstuff.c:672
msgid "Extended Network Menu"
msgstr ""
#: netstuff.c:673 networking.c:521
msgid "Select"
msgstr ""
#: netstuff.c:673
msgid "Identify"
msgstr ""
#: netstuff.c:678
msgid "Device Identification"
msgstr ""
#: netstuff.c:678
msgid "The lights on the selected port should flash now for 10 seconds..."
msgstr ""
#: netstuff.c:679
msgid "Identification is not supported by this interface."
msgstr ""
#: netstuff.c:691
msgid "There are no unassigned interfaces on your system."
msgstr ""
#: netstuff.c:732
#, c-format
msgid "Do you really want to remove the assigned %s interface?"
msgstr ""
#: netstuff.c:755
msgid "Select network driver"
msgstr ""
#: netstuff.c:755
msgid "Set additional module parameters"
msgstr ""
#: netstuff.c:762
msgid "Loading module..."
msgstr ""
#: netstuff.c:777
msgid "Unable to load driver module."
msgstr ""
#: netstuff.c:780
msgid "Module name cannot be blank."
msgstr ""
#: networking.c:110
msgid "Stopping network..."
msgstr ""
#: networking.c:115
msgid "Restarting network..."
msgstr ""
#: networking.c:146
msgid "No GREEN interface assigned."
msgstr ""
#: networking.c:152
msgid "Missing an IP address on GREEN."
msgstr ""
#: networking.c:163
msgid "Error"
msgstr ""
#: networking.c:163
msgid "Ignore"
msgstr ""
#: networking.c:164
msgid "No RED interface assigned."
msgstr ""
#: networking.c:173
msgid "Missing an IP address on RED."
msgstr ""
#: networking.c:183
msgid "No ORANGE interface assigned."
msgstr ""
#: networking.c:189
msgid "Missing an IP address on ORANGE."
msgstr ""
#: networking.c:199
msgid "No BLUE interface assigned."
msgstr ""
#: networking.c:205
msgid "Missing an IP address on BLUE."
msgstr ""
#: networking.c:217
msgid "Misssing DNS."
msgstr ""
#: networking.c:224
msgid "Missing Default Gateway."
msgstr ""
#: networking.c:237 networking.c:305
msgid "Network configuration type"
msgstr ""
#: networking.c:238 networking.c:410
msgid "Drivers and card assignments"
msgstr ""
#: networking.c:239 networking.c:641
msgid "Address settings"
msgstr ""
#: networking.c:240 networking.c:744
msgid "DNS and Gateway settings"
msgstr ""
#: networking.c:260
msgid "When configuration is complete, a network restart will be required."
msgstr ""
#: networking.c:267
#, c-format
msgid "Current config: %s%s"
msgstr ""
#: networking.c:269
msgid "Network configuration menu"
msgstr ""
#: networking.c:270 networking.c:521 networking.c:643
msgid "Done"
msgstr ""
#: networking.c:301
#, c-format
msgid ""
"Select the network configuration for %s. The following configuration types "
"list those interfaces which have ethernet attached. If you change this "
"setting, a network restart will be required, and you will have to "
"reconfigure the network driver assignments."
msgstr ""
#: networking.c:308
#, c-format
msgid ""
"Not enough netcards for your choice.\n"
"\n"
"Needed: %d - Available: %d\n"
msgstr ""
#: networking.c:360
msgid ""
"Configure network drivers, and which interface each card is assigned to. The current configuration is as follows:\n"
"\n"
msgstr ""
#: networking.c:409
msgid "Do you wish to change these settings?"
msgstr ""
#: networking.c:448
msgid "Restarting non-local network..."
msgstr ""
#: networking.c:465
msgid ""
"Please choose the interface you wish to change.\n"
"\n"
msgstr ""
#: networking.c:520
msgid "Assigned Cards"
msgstr ""
#: networking.c:521
msgid "Remove"
msgstr ""
#: networking.c:557 networking.c:650
#, c-format
msgid ""
"If you change this IP address, and you are logged in remotely, your "
"connection to the %s machine will be broken, and you will have to reconnect "
"on the new IP. This is a risky operation, and should only be attempted if "
"you have physical access to the machine, should something go wrong."
msgstr ""
#: networking.c:642
msgid "Select the interface you wish to reconfigure."
msgstr ""
#: networking.c:730
msgid "Default gateway:"
msgstr ""
#: networking.c:745
msgid ""
"Enter the DNS and gateway information. These settings are used only with "
"Static IP (and DHCP if DNS set) on the RED interface."
msgstr ""
#: networking.c:774
msgid "Default gateway"
msgstr ""
#: networking.c:781
msgid "Secondary DNS specified without a Primary DNS"
msgstr ""
#: passwords.c:33
msgid ""
"Enter the 'root' user password. Login as this user for commandline access."
msgstr ""
#: passwords.c:38 passwords.c:61
msgid "Setting password"
msgstr ""
#: passwords.c:38
msgid "Setting 'root' password...."
msgstr ""
#: passwords.c:39
msgid "Problem setting 'root' password."
msgstr ""
#: passwords.c:53
#, c-format
msgid ""
"Enter %s 'admin' user password. This is the user to use for logging into the"
" %s web administration pages."
msgstr ""
#: passwords.c:60
#, c-format
msgid "Setting %s 'admin' user password..."
msgstr ""
#: passwords.c:62
#, c-format
msgid "Problem setting %s 'admin' user password."
msgstr ""
#: passwords.c:76
msgid "Password:"
msgstr ""
#: passwords.c:77
msgid "Again:"
msgstr ""
#: passwords.c:95
msgid "Password cannot be blank."
msgstr ""
#: passwords.c:102
msgid "Passwords do not match."
msgstr ""
#: passwords.c:109
msgid "Password cannot contain spaces."
msgstr ""
#: timezone.c:77
msgid "Choose the timezone you are in from the list below."
msgstr ""

90
src/setup/probenic.sh Normal file
View File

@@ -0,0 +1,90 @@
#!/bin/sh
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2011 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
if [ -e /var/ipfire/ethernet/scanned_nics ]; then
rm -f /var/ipfire/ethernet/scanned_nics
fi
touch /var/ipfire/ethernet/scanned_nics
for card in `ls /sys/class/net`; do
#Check if this is an Ethernet device (type=1)
if [ `cat /sys/class/net/$card/type` == "1" ]; then
hwaddr=`cat /sys/class/net/$card/address`
#Check that is no VLAN if
if [[ ! "$card" =~ "[.]" ]]; then
#check if this not a bridge
if [ ! -e /sys/class/net/$card/brforward ]; then
#Check if mac is valid (not 00:00... or FF:FF...)
if [ ! "$hwaddr" == "00:00:00:00:00:00" ];then
if [ ! "$hwaddr" == "ff:ff:ff:ff:ff:ff" ];then
driver=`grep DRIVER= /sys/class/net/$card/device/uevent | cut -d"=" -f2`
type=`grep MODALIAS= /sys/class/net/$card/device/uevent | cut -d"=" -f2 | cut -d":" -f1`
#Default if not available in /sys/class/net
if [ "a$type" == "a" ]; then
type="???"
fi
if [ "a$driver" == "a" ]; then
driver="Unknown Network Interface ($card)"
fi
description=`echo $type: $driver`
#Get more details for pci and usb devices
if [ "$type" == "pci" ]; then
slotname=`grep PCI_SLOT_NAME= /sys/class/net/$card/device/uevent | cut -d"=" -f2`
name=`lspci -s $slotname | cut -d':' -f3 | cut -c 2-`
description=`echo $type: $name`
fi
if [ "$type" == "usb" ]; then
bus=`grep DEVICE= /sys/class/net/$card/device/uevent | cut -d"/" -f5`
dev=`grep DEVICE= /sys/class/net/$card/device/uevent | cut -d"/" -f6`
#work around the base8 convert
let bus=`echo 1$bus`-1000
let dev=`echo 1$dev`-1000
name=`lsusb -s $bus:$dev | cut -d':' -f3 | cut -c 6-`
#kernel higher 3.2 changes
if [ "$name" == "" ]; then
vid=`grep PRODUCT= /sys/class/net/$card/device/uevent | cut -d"=" -f2 | cut -d"/" -f1`
pid=`grep PRODUCT= /sys/class/net/$card/device/uevent | cut -d"=" -f2 | cut -d"/" -f2`
name=`lsusb -d $vid:$pid | cut -d':' -f3 | cut -c 6-`
fi
description=`echo $type: $name`
fi
echo desc: \"$description\" >>/var/ipfire/ethernet/scanned_nics
echo driver: $driver >>/var/ipfire/ethernet/scanned_nics
echo network.hwaddr: $hwaddr >>/var/ipfire/ethernet/scanned_nics
fi
fi
fi
fi
fi
done
# Revert Accesspoint marking at mac address
sed -i 's|hwaddr: 06:|hwaddr: 00:|g' /var/ipfire/ethernet/scanned_nics
exit 0

View File

@@ -10,7 +10,8 @@
*
*/
#include "../libsmooth/libsmooth.h"
#include <newt.h>
#include <libsmooth.h>
/* hostname.c */
int handlehostname(void);

View File

@@ -10,13 +10,15 @@
*
*/
// Translation
#include <libintl.h>
#define _(x) dgettext("setup", x)
#include "setup.h"
extern FILE *flog;
extern char *mylog;
extern char **ctr;
extern int automode;
#define MAX_FILENAMES 5000
@@ -58,7 +60,7 @@ int handletimezone(void)
if (!(readkeyvalues(kv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(kv);
errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
errorbox(_("Unable to open settings file"));
return 0;
}
@@ -72,8 +74,8 @@ int handletimezone(void)
choice = c;
}
rc = newtWinMenu(ctr[TR_TIMEZONE], ctr[TR_TIMEZONE_LONG], 50, 5, 5, 6, displaynames, &choice,
ctr[TR_OK], ctr[TR_CANCEL], NULL);
rc = newtWinMenu(_("Timezone"), _("Choose the timezone you are in from the list below."),
50, 5, 5, 6, displaynames, &choice, _("OK"), _("Cancel"), NULL);
strcpy(timezone, filenames[choice]);