Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwlive.git;a=commitdiff;h=a6fd292851b2a1355d7f5df8e2b7ea585636b6d9
commit a6fd292851b2a1355d7f5df8e2b7ea585636b6d9 Author: James Buren <[email protected]> Date: Fri Mar 1 08:38:07 2013 -0600 comment out direct writing of locale.conf implement new version using localectl to write the file diff --git a/new/fwsetup/postconfig.c b/new/fwsetup/postconfig.c index c674864..42ada21 100644 --- a/new/fwsetup/postconfig.c +++ b/new/fwsetup/postconfig.c @@ -26,6 +26,7 @@ static size_t tz_size = 0; static size_t tz_count = 0; static char **tz_data = 0; +#if 0 static bool write_locale_conf(void) { const char *var = "LANG"; @@ -89,6 +90,54 @@ static bool write_locale_conf(void) return true; } +#endif + +static bool locale_action(void) +{ + const char *var = "LANG"; + const char *locale = 0; + char command[_POSIX_ARG_MAX] = {0}; + size_t i = 0; + static const char *vars[] = + { + "LC_CTYPE", + "LC_NUMERIC", + "LC_TIME", + "LC_COLLATE", + "LC_MONETARY", + "LC_MESSAGES", + "LC_PAPER", + "LC_NAME", + "LC_ADDRESS", + "LC_TELEPHONE", + "LC_MEASUREMENT", + "LC_IDENTIFICATION", + 0 + }; + + if((locale = getenv(var)) == 0 || strlen(locale) == 0) + { + eprintf("%s is not defined.\n",var); + return false; + } + + strfcpy(command,sizeof(command),"localectl set-locale '%s=%s'",var,locale); + + for( ; vars[i] != 0 ; ++i ) + { + var = vars[i]; + + if((locale = getenv(var)) == 0 || strlen(locale) == 0) + continue; + + strfcat(command,sizeof(command)," '%s=%s'",var,locale); + } + + if(!execute(command,INSTALL_ROOT,0)) + return false; + + return true; +} static bool is_root_setup(void) { @@ -320,7 +369,7 @@ static bool postconfig_run(void) return false; } - if(!write_locale_conf()) + if(!locale_action()) return false; if(!is_root_setup() && (!ui_window_root(&account) || !root_action(&account))) _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
