add condition to create default user account once

This commit is contained in:
Julio Montes
2016-04-15 11:31:29 -05:00
parent 49e1556b81
commit c9748e3350
+15 -12
View File
@@ -45,6 +45,7 @@
#include <getopt.h>
#include <sys/sysinfo.h>
#include <fcntl.h>
#include <pwd.h>
#include <glib.h>
@@ -305,18 +306,20 @@ int main(int argc, char *argv[]) {
}
if (first_boot_setup && first_boot) {
/* default user will be used by ccmodules and datasources */
g_snprintf(command, LINE_MAX, USERADD_PATH
" -U -d '%s' -G '%s' -f '%s' -e '%s' -s '%s' -c '%s' -p '%s' '%s'"
, DEFAULT_USER_HOME_DIR
, DEFAULT_USER_GROUPS
, DEFAULT_USER_INACTIVE
, DEFAULT_USER_EXPIREDATE
, DEFAULT_USER_SHELL
, DEFAULT_USER_GECOS
, DEFAULT_USER_PASSWORD
, DEFAULT_USER_USERNAME);
exec_task(command);
if (!getpwnam(DEFAULT_USER_USERNAME)) {
/* default user will be used by ccmodules and datasources */
g_snprintf(command, LINE_MAX, USERADD_PATH
" -U -d '%s' -G '%s' -f '%s' -e '%s' -s '%s' -c '%s' -p '%s' '%s'"
, DEFAULT_USER_HOME_DIR
, DEFAULT_USER_GROUPS
, DEFAULT_USER_INACTIVE
, DEFAULT_USER_EXPIREDATE
, DEFAULT_USER_SHELL
, DEFAULT_USER_GECOS
, DEFAULT_USER_PASSWORD
, DEFAULT_USER_USERNAME);
exec_task(command);
}
}
/* process metadata from metadata service */