Hello community,
here is the log from the commit of package yast2-users
checked in at Mon Sep 18 18:23:23 CEST 2006.
--------
--- yast2-users/yast2-users.changes 2006-09-14 00:49:59.000000000 +0200
+++ yast2-users/yast2-users.changes 2006-09-18 17:56:53.000000000 +0200
@@ -1,0 +2,6 @@
+Mon Sep 18 17:46:52 CEST 2006 - jsuchome@suse.cz
+
+- installation: import users from existing partition (F120103)
+- 2.13.26
+
+-------------------------------------------------------------------
@@ -4 +10 @@
-- added yast2-core-devel to BuildRequires
+- added yast2-core-devel to BuildRequires
Old:
----
yast2-users-2.13.25.tar.bz2
New:
----
yast2-users-2.13.26.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-users.spec ++++++
--- /var/tmp/diff_new_pack.IdA1bq/_old 2006-09-18 18:22:41.000000000 +0200
+++ /var/tmp/diff_new_pack.IdA1bq/_new 2006-09-18 18:22:41.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-users (Version 2.13.25)
+# spec file for package yast2-users (Version 2.13.26)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild
Name: yast2-users
-Version: 2.13.25
-Release: 3
+Version: 2.13.26
+Release: 1
License: GPL
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-users-2.13.25.tar.bz2
+Source0: yast2-users-2.13.26.tar.bz2
prefix: /usr
BuildRequires: cracklib-devel doxygen gcc-c++ perl-Digest-SHA1 perl-XML-Writer update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-ldap-client yast2-mail-aliases yast2-perl-bindings yast2-security yast2-testsuite
Requires: yast2 yast2-perl-bindings yast2-country yast2-pam yast2-security yast2-mail-aliases cracklib perl-Digest-SHA1 perl-gettext yast2-ldap-client
@@ -42,7 +42,7 @@
Jiri Suchomel
%prep
-%setup -n yast2-users-2.13.25
+%setup -n yast2-users-2.13.26
%build
%{prefix}/bin/y2tool y2autoconf
@@ -85,6 +85,9 @@
%doc %{prefix}/share/doc/packages/yast2-users
%changelog -n yast2-users
+* Mon Sep 18 2006 - jsuchome@suse.cz
+- installation: import users from existing partition (F120103)
+- 2.13.26
* Thu Sep 14 2006 - ro@suse.de
- added yast2-core-devel to BuildRequires
* Thu Sep 07 2006 - jsuchome@suse.cz
++++++ yast2-users-2.13.25.tar.bz2 -> yast2-users-2.13.26.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.13.25/VERSION new/yast2-users-2.13.26/VERSION
--- old/yast2-users-2.13.25/VERSION 2006-09-07 15:50:00.000000000 +0200
+++ new/yast2-users-2.13.26/VERSION 2006-09-18 17:47:27.000000000 +0200
@@ -1 +1 @@
-2.13.25
+2.13.26
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.13.25/src/Users.pm new/yast2-users-2.13.26/src/Users.pm
--- old/yast2-users-2.13.25/src/Users.pm 2006-09-11 11:20:05.000000000 +0200
+++ new/yast2-users-2.13.26/src/Users.pm 2006-09-18 17:45:39.000000000 +0200
@@ -4,7 +4,7 @@
# Package: Configuration of users and groups
# Summary: I/O routines + main data structures
#
-# $Id: Users.pm 32758 2006-09-07 11:37:57Z jsuchome $
+# $Id: Users.pm 32823 2006-09-12 13:37:16Z jsuchome $
#
package Users;
@@ -32,6 +32,12 @@
# could be "users","nis" or "ldap", for more see inst_auth.ycp
my $after_auth = "users";
+# what should be imported during installation (F120103)
+my %installation_import = (
+ "users" => (),
+ "groups" => (),
+);
+
# Write only, keep progress turned off
my $write_only = 0;
@@ -46,8 +52,6 @@
my %default_groupname = ();
-my @user_sources = ();
-
my %users = (
"system" => {},
"local" => {},
@@ -337,6 +341,20 @@
$root_mail = $_[0];
}
+# return the value of base directory
+BEGIN { $TYPEINFO{GetBaseDirectory} = ["function", "string"]; }
+sub GetBaseDirectory {
+ return $base_directory;
+}
+
+# set the new the value of base directory
+BEGIN { $TYPEINFO{SetBaseDirectory} = ["function", "void", "string"]; }
+sub SetBaseDirectory {
+ my $self = shift;
+ my $dir = shift;
+ $base_directory = $dir if (defined $dir);
+}
+
BEGIN { $TYPEINFO{GetStartDialog} = ["function", "string"]; }
sub GetStartDialog {
@@ -551,6 +569,31 @@
$after_auth = $_[0];
}
+# set the list of users to be imported during installation
+BEGIN { $TYPEINFO{SetUsersForImport} = ["function", "void", ["list","any"]];}
+sub SetUsersForImport {
+ my $self = shift;
+ my $to_import = shift;
+ return if (! defined ($to_import) || ref ($to_import) ne "ARRAY");
+ my @u = @$to_import;
+ $installation_import{"users"} = \@u;
+}
+
+# return the data of users to be imported during installation
+BEGIN { $TYPEINFO{GetUsersForImport} = ["function", ["list","any"]];}
+sub GetUsersForImport {
+ my $self = shift;
+ my @u = @{$installation_import{"users"}};
+ return \@u;
+}
+
+# return the data of users and groups to be imported during installation
+BEGIN { $TYPEINFO{GetDataForImport} = ["function", ["map", "string", "any"]];}
+sub GetDataForImport {
+ my $self = shift;
+ return \%installation_import;
+}
+
BEGIN { $TYPEINFO{NotAskUppercase} = ["function", "boolean"];}
sub NotAskUppercase {
return $not_ask_uppercase;
@@ -1385,7 +1428,6 @@
$groups{$type} = UsersPasswd->GetGroups ($type);
$groups_by_gidnumber{$type}= UsersPasswd->GetGroupsByGIDNumber ($type);
}
-
my $pluses = UsersPasswd->GetPluslines ("passwd");
if (ref ($pluses) eq "ARRAY") {
@pluses_passwd = @{$pluses};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.13.25/src/dialogs.ycp new/yast2-users-2.13.26/src/dialogs.ycp
--- old/yast2-users-2.13.25/src/dialogs.ycp 2006-09-12 13:24:16.000000000 +0200
+++ new/yast2-users-2.13.26/src/dialogs.ycp 2006-09-12 15:35:40.000000000 +0200
@@ -5,7 +5,7 @@
* Authors: Johannes Buchhold ,
* Jiri Suchomel
*
- * $Id: dialogs.ycp 31992 2006-07-26 07:43:01Z jsuchome $
+ * $Id: dialogs.ycp 32823 2006-09-12 13:37:16Z jsuchome $
*/
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.13.25/src/helps.ycp new/yast2-users-2.13.26/src/helps.ycp
--- old/yast2-users-2.13.25/src/helps.ycp 2006-09-07 14:35:03.000000000 +0200
+++ new/yast2-users-2.13.26/src/helps.ycp 2006-09-12 15:35:40.000000000 +0200
@@ -6,7 +6,7 @@
* Authors: Johannes Buchhold ,
* Jiri Suchomel
*
- * $Id: helps.ycp 31699 2006-06-29 09:28:00Z jsuchome $
+ * $Id: helps.ycp 32823 2006-09-12 13:37:16Z jsuchome $
*
*/
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.13.25/src/inst_auth.ycp new/yast2-users-2.13.26/src/inst_auth.ycp
--- old/yast2-users-2.13.25/src/inst_auth.ycp 2006-09-12 13:18:21.000000000 +0200
+++ new/yast2-users-2.13.26/src/inst_auth.ycp 2006-09-18 17:44:56.000000000 +0200
@@ -12,16 +12,76 @@
textdomain "users";
+import "Directory";
import "DSL";
+import "FileUtils";
+import "Label";
import "Ldap";
import "NetworkDevices";
import "NetworkService";
import "Package";
import "Popup";
import "Users";
+import "UsersCache";
import "Wizard";
import "GetInstArgs";
+
+
+/**
+ * Helper function
+ * Ask user which users to import
+ */
+define list<string> choose_to_import (list<string> all, list<string> selected) {
+
+ list items = maplist (string u, all, ``(
+ `item (`id (u), u, contains (selected, u))
+ ));
+ boolean all_checked = size (all) == size (selected);
+ integer vsize = size (all) + 3;
+ if (vsize > 15) vsize = 15;
+
+ UI::OpenDialog (`opt(`decorated), `HBox(`VSpacing (vsize), `VBox (
+ `HSpacing(50),
+ // selection box label
+ `MultiSelectionBox (`id(`userlist), _("&Select Users to Read"), items),
+ // check box label
+ `Left (`CheckBox (
+ `id(`all),`opt(`notify),_("Select or Deselect &All"), all_checked
+ )),
+ `HBox (
+ `PushButton (`id(`ok), `opt(`default, `key_F10), Label::OKButton()),
+ `PushButton (`id(`cancel), `opt(`key_F9), Label::CancelButton())
+ )
+ )));
+
+ any ret = nil;
+ while (true)
+ {
+ ret = UI::UserInput ();
+ if (ret == `all)
+ {
+ boolean ch = (boolean)UI::QueryWidget (`id(`all),`Value);
+ if (ch != all_checked)
+ {
+ UI::ChangeWidget (`id(`userlist), `Items,
+ maplist (string u, all, ``(`item (`id (u), u, ch)))
+ );
+ all_checked = ch;
+ }
+ }
+ if (ret == `ok || ret == `cancel)
+ break;
+ }
+ if (ret == `ok)
+ {
+ selected = (list<string>)UI::QueryWidget(`id(`userlist),`SelectedItems);
+ }
+ UI::CloseDialog ();
+ return ret == `ok ? selected : nil;
+}
+
+
// Check if lan is configured
list<string> net_devices = NetworkDevices::List("");
y2debug("net_devices: %1", net_devices);
@@ -46,6 +106,22 @@
return `auto;
}
+boolean import_available = false;
+boolean imported = false;
+string import_dir = Directory::vardir + "/imported/userdata";
+string base_dir = Users::GetBaseDirectory ();
+list<string> user_names = [];
+list<string> to_import = [];
+
+if (FileUtils::Exists (import_dir))
+{
+ if (FileUtils::Exists (import_dir + "/passwd") &&
+ FileUtils::Exists (import_dir + "/shadow"))
+ {
+ import_available = true;
+ }
+}
+
// caption for dialog "User Authentication Method"
string caption = _("User Authentication Method");
@@ -123,9 +199,26 @@
term buttons = `VBox (`VSpacing(0.5));
-foreach (string client, available_clients, ``{
- buttons = add (buttons,
- `Left(`RadioButton(`id(client), button_labels[client]:"")));
+foreach (string client, available_clients, {
+ if (client == "users" && import_available)
+ buttons = add (buttons, `VBox (
+ `Left (`RadioButton (
+ `id(client), `opt (`notify), button_labels[client]:""
+ )),
+ `HBox (
+ `HSpacing (3),
+ `Left (`CheckBox (`id (`import_ch),
+ // check box label
+ _("Read user data from previous installation")
+ )),
+ // button label
+ `PushButton (`id(`import), _("&Choose"))
+ )
+ ));
+ else
+ buttons = add (buttons, `Left(
+ `RadioButton(`id(client), `opt (`notify), button_labels[client]:"")
+ ));
});
buttons = add (buttons, `VSpacing(0.5));
@@ -140,7 +233,7 @@
`HStretch(),
// frame title for authentication methods
`Frame (_("Authentication Method"),
- `RadioButtonGroup( buttons )
+ `RadioButtonGroup (`id (`method), buttons)
),
`HStretch()
),
@@ -171,27 +264,54 @@
{
Wizard::ShowHelp (help);
}
-
+ if (ret == `next && to_import == [] &&
+ UI::QueryWidget (`id(`import_ch), `Value) == true)
+ {
+ // force selecting when only checkbox is checked
+ ret = `import;
+ }
+ if (ret == `import)
+ {
+ if (!imported)
+ {
+ Users::SetBaseDirectory (import_dir);
+ string err = Users::ReadLocal ();
+ UsersCache::Read ();
+ user_names = UsersCache::GetUsernames ("local");
+ imported = true;
+ Users::SetBaseDirectory (base_dir);
+ }
+ list<string> selected = choose_to_import (user_names, to_import);
+ if (selected != nil)
+ to_import = selected;
+ UI::ChangeWidget (`id (`import_ch), `Value, size (to_import) > 0);
+ }
+ if (is (ret, string) && import_available)
+ {
+ UI::ChangeWidget (`id (`import_ch), `Enabled, ret == "users");
+ UI::ChangeWidget (`id (`import), `Enabled, ret == "users");
+ }
} until ( ret == `next || ret == `back );
-if ( (boolean) UI::QueryWidget( `id("ldap"), `Value ) )
- Users::SetAfterAuth ("ldap");
-if ( (boolean) UI::QueryWidget( `id("users"), `Value ) )
- Users::SetAfterAuth ("users");
-if (contains (available_clients, "nis") &&
- (boolean) UI::QueryWidget( `id("nis"), `Value ) )
-{
- Users::SetAfterAuth ("nis");
-}
-if (contains (available_clients, "samba") &&
- (boolean) UI::QueryWidget( `id("samba"), `Value ) )
+string method = (string)UI::QueryWidget (`id(`method), `Value);
+Users::SetAfterAuth (method);
+
+if (ret == `next && method == "users" && to_import != [])
{
- Users::SetAfterAuth ("samba");
+ UsersCache::SetUserType ("local");
+ list users_to_import = maplist (string name, to_import, {
+ Users::SelectUserByName (name);
+ map u = Users::GetCurrentUser ();
+ return u;
+ });
+ Users::SetUsersForImport (users_to_import);
}
-if (contains (available_clients, "edir_ldap") &&
- (boolean) UI::QueryWidget( `id("edir_ldap"), `Value ) )
+
+if (import_available)
{
- Users::SetAfterAuth ("edir_ldap");
+ foreach (string file, [ "/passwd", "/shadow", "/group" ], {
+ SCR::Execute (.target.remove, import_dir + file);
+ });
}
return (symbol) ret;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-users-2.13.25/src/inst_user.ycp new/yast2-users-2.13.26/src/inst_user.ycp
--- old/yast2-users-2.13.25/src/inst_user.ycp 2006-07-26 09:39:10.000000000 +0200
+++ new/yast2-users-2.13.26/src/inst_user.ycp 2006-09-18 17:41:31.000000000 +0200
@@ -60,16 +60,45 @@
return (symbol) ret;
}
}
+ list import_u = Users::GetUsersForImport ();
+ if (size (import_u) > 0)
+ {
+ if (GetInstArgs::going_back())
+ {
+ Users::SetUsersForImport ([]);
+ return `back;
+ }
+ ReadDialog (false); // clear the cache from imported data
+ y2milestone ("There are some users to import");
+ foreach (map user, (list