Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=17bba6ab75770f1ffafb6b90117eef76a94edb0d

commit 17bba6ab75770f1ffafb6b90117eef76a94edb0d
Author: James Buren <[email protected]>
Date:   Fri Sep 7 04:09:56 2012 -0500

setup user dialog

diff --git a/src/postconfig.c b/src/postconfig.c
index 01c772d..a8f4fcc 100644
--- a/src/postconfig.c
+++ b/src/postconfig.c
@@ -95,6 +95,23 @@ static bool root_action(struct account *account)
return execute(command,INSTALL_ROOT,0);
}

+static bool user_action(struct account *account)
+{
+  char command[_POSIX_ARG_MAX] = {0};
+
+  snprintf(command,_POSIX_ARG_MAX,"useradd -D -m -c '%s' -g '%s' -G '%s' -d 
'%s' -s '%s' '%s'",(account->name != 0) ? account->name : 
"",account->group,account->groups,account->home,account->shell,account->user);
+
+  if(!execute(command,INSTALL_ROOT,0))
+    return false;
+
+  snprintf(command,_POSIX_ARG_MAX,"echo '%s:%s' | 
chpasswd",account->user,account->password);
+
+  if(!execute(command,INSTALL_ROOT,0))
+    return false;
+
+  return true;
+}
+
static void account_free(struct account *account)
{
if(account == 0)
@@ -127,10 +144,15 @@ static bool postconfig_run(void)
return false;
}

-  if(!is_root_setup() && !ui_window_root(&account))
+  if(!is_root_setup() && !ui_window_root(&account) && !root_action(&account))
+  {
+    account_free(&account);
return false;
+  }
+
+  account_free(&account);

-  if(!root_action(&account))
+  if(!is_user_setup() && !ui_window_user(&account) && !user_action(&account))
{
account_free(&account);
return false;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to