[asl-commit] ActiveSambaLdap (trunk) r109:
null at cozmixng.org
null at cozmixng.org
Sat Sep 8 07:50:42 EDT 2007
retro 2007-09-08 20:50:40 +0900 (Sat, 08 Sep 2007)
New Revision: 109
Modified files:
trunk/Rakefile
trunk/bin/asl-groupadd
trunk/bin/asl-groupdel
trunk/bin/asl-groupmod
trunk/bin/asl-groupshow
trunk/bin/asl-passwd
trunk/bin/asl-populate
trunk/bin/asl-purge
trunk/bin/asl-samba-computeradd
trunk/bin/asl-samba-groupadd
trunk/bin/asl-samba-groupdel
trunk/bin/asl-samba-groupmod
trunk/bin/asl-samba-useradd
trunk/bin/asl-samba-userdel
trunk/bin/asl-samba-usermod
trunk/bin/asl-useradd
trunk/bin/asl-userdel
trunk/bin/asl-usermod
trunk/bin/asl-usershow
Log:
Modified: trunk/bin/asl-samba-usermod (+15 -8)
===================================================================
--- trunk/bin/asl-samba-usermod 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-samba-usermod 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.computer_account = false
options.gid = nil
@@ -10,11 +12,11 @@
opts.banner += " USER_NAME"
opts.on("-c", "--[no-]computer-account",
- "is a Windows Workstation",
- "(otherwise, Windows user)",
+ _("is a Windows Workstation"),
+ _("(otherwise, Windows user)"),
"(#{options.computer_account})") {|options.computer_account|}
- opts.on("-g", "--gid=GID", "gid") {|options.gid|}
+ opts.on("-g", "--gid=GID", _("gid")) {|options.gid|}
end
name = nil
@@ -41,21 +43,26 @@
options.computer_account = true if /\$$/ =~ name
-member_class = options.computer_account ? Computer : User
-member_type = member_class.name.downcase
+if options.computer_account
+ member_class = Computer
+ member_type = _("computer")
+else
+ member_class = User
+ member_type = _("user")
+end
if options.computer_account
name = name.chomp("$") + "$"
end
unless member_class.exists?(name)
- $stderr.puts "#{member_type} '#{name}' doesn't exist."
+ $stderr.puts(_("%s '%s' doesn't exist.") % [member_type, name])
exit 1
end
member = member_class.find(name)
unless Process.uid.zero?
- password = ActiveSambaLdap::Command.read_password("Enter your password: ")
+ password = ActiveSambaLdap::Command.read_password(_("Enter your password: "))
auth_class = Class.new(ActiveSambaLdap::Base)
config = ActiveSambaLdap::Base.configurations["reference"]
@@ -64,7 +71,7 @@
:password => password,
:allow_anonymous => false))
rescue ActiveLdap::AuthenticationError
- $stderr.puts "password isn't match"
+ $stderr.puts(_("password isn't match."))
exit 1
ensure
auth_class.remove_connection
Modified: trunk/bin/asl-populate (+19 -14)
===================================================================
--- trunk/bin/asl-populate 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-populate 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -7,6 +7,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
default = ActiveSambaLdap::Configuration::ClassMethods::Private.new({})
options.start_uid = Integer(default.start_uid)
@@ -25,34 +27,37 @@
options.import_ldif = nil
opts.on("-u", "--start-uid=UID", Integer,
- "first uid number to allocate",
+ _("first uid number to allocate"),
"(#{options.start_uid})") {|options.start_uid|}
opts.on("-g", "--start-gid=GID", Integer,
- "first gid number to allocate",
+ _("first gid number to allocate"),
"(#{options.start_gid})") {|options.start_gid|}
opts.on("-a", "--administrator=NAME",
- "administrator login name",
+ _("administrator login name"),
"(#{options.administrator})") {|options.administrator|}
opts.on("--administrator-uid=UID", Integer,
- "administrator's uid number",
+ _("administrator's uid number"),
"(#{options.administrator_uid})") {|options.administrator_uid|}
opts.on("--administrator-gid=GID", Integer,
- "administrator's gid number",
+ _("administrator's gid number"),
"(#{options.administrator_gid})") {|options.administrator_gid|}
opts.on("-g", "--guest=NAME",
- "guest login name (#{options.guest})") {|options.guest|}
+ _("guest login name"),
+ "(#{options.guest})") {|options.guest|}
opts.on("--guest-uid=UID", Integer,
- "guest's uid number (#{options.guest_uid})") {|options.guest_uid|}
+ _("guest's uid number"),
+ "(#{options.guest_uid})") {|options.guest_uid|}
opts.on("--guest-gid=GID", Integer,
- "guest's gid number (#{options.guest_gid})") {|options.guest_gid|}
+ _("guest's gid number"),
+ "(#{options.guest_gid})") {|options.guest_gid|}
opts.on("-e", "--export-ldif=LDIF",
- "export LDIF file") {|options.export_ldif|}
+ _("export LDIF file")) {|options.export_ldif|}
# opts.on("-i", "--import-ldif=LDIF",
-# "import LDIF file") {|options.import_ldif|}
+# _("import LDIF file")) {|options.import_ldif|}
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -68,12 +73,12 @@
end
return if admin.new_entry?
- prompt = "Password for #{admin_name}: "
+ prompt = _("Password for %s: ") % admin_name
password = ActiveSambaLdap::Command.read_password(prompt)
- prompt2 = "Retype password for #{admin_name}: "
+ prompt2 = _("Retype password for %s: ") % admin_name
password2 = ActiveSambaLdap::Command.read_password(prompt2)
unless password == password2
- $stderr.puts "Passwords don't match."
+ $stderr.puts(_("Passwords don't match."))
exit 1
end
Modified: trunk/Rakefile (+10 -0)
===================================================================
--- trunk/Rakefile 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/Rakefile 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -153,7 +153,17 @@
namespace :po do
desc "Update po/pot files (GetText)"
task :update => "gettext:environment" do
+ module GetText::RGetText
+ class << self
+ alias_method :generate_pot_original, :generate_pot
+ def generate_pot(ary)
+ ary = ary.collect {|key, *other| [key.gsub(/\\/, "\\\\\\"), *other]}
+ generate_pot_original(ary)
+ end
+ end
+ end
files = Dir.glob("{lib,rails}/**/*.rb")
+ files += Dir.glob("bin/asl*")
GetText.update_pofiles("active-samba-ldap",
files,
"Ruby/ActiveSambaLdap #{ActiveSambaLdap::VERSION}")
Modified: trunk/bin/asl-groupdel (+6 -3)
===================================================================
--- trunk/bin/asl-groupdel 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-groupdel 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,13 +3,16 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.force = false
opts.banner += " GROUP_NAME"
opts.on("-f", "--[no-]force",
- "force delete group (#{options.force})") {|options.force|}
+ _("force delete group"),
+ "(#{options.force})") {|options.force|}
end
name = nil
@@ -21,7 +24,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -40,7 +43,7 @@
end
unless Group.exists?(name)
- $stderr.puts "group '#{name}' doesn't exist."
+ $stderr.puts(_("group '%s' doesn't exist.") % name)
exit 1
end
group = Group.find(name)
Modified: trunk/bin/asl-groupadd (+7 -4)
===================================================================
--- trunk/bin/asl-groupadd 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-groupadd 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.gid = nil
options.group_type = "domain"
@@ -12,9 +14,10 @@
opts.on("-g", "--gid=GID", Integer, "GID number") {|options.gid|}
opts.on("-t", "--type=TYPE",
- "group type (#{options.group_type})") {|options.group_type|}
+ _("group type"),
+ "(#{options.group_type})") {|options.group_type|}
opts.on("-p", "--[no-]print-gid-number",
- "print the gid number to stdout",
+ _("print the gid number to stdout"),
"(#{options.print_gid_number})") {|options.print_gid_number|}
end
@@ -27,7 +30,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -42,7 +45,7 @@
end
if Group.exists?(name)
- $stderr.puts "group '#{name}' already exists."
+ $stderr.puts(_("group '%s' already exists.") % name)
exit 1
end
Modified: trunk/bin/asl-userdel (+17 -8)
===================================================================
--- trunk/bin/asl-userdel 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-userdel 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.remove_home_directory = false
options.interactive = false
@@ -11,17 +13,19 @@
opts.banner += " USER_NAME"
opts.on("-c", "--[no-]computer-account",
- "is a Windows Workstation",
- "(otherwise, Windows user)",
+ _("is a Windows Workstation"),
+ _("(otherwise, Windows user)"),
"(#{options.computer_account})") {|options.computer_account|}
opts.on("-r", "--[no-]remove-home-directory",
- "remove home directory (#{options.remove_home_directory})") do |bool|
+ _("remove home directory"),
+ "(#{options.remove_home_directory})") do |bool|
options.remove_home_directory = bool
end
opts.on("-i", "--[no-]interactive",
- "do interactively (#{options.interactive})") do |bool|
+ _("do interactively"),
+ "(#{options.interactive})") do |bool|
options.interactive = bool
end
end
@@ -35,7 +39,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -53,15 +57,20 @@
ldap_mapping
end
-member_class = options.computer_account ? Computer : User
-member_type = member_class.name.downcase
+if options.computer_account
+ member_class = Computer
+ member_type = _("computer")
+else
+ member_class = User
+ member_type = _("user")
+end
if options.computer_account
name = name.chomp("$") + "$"
end
unless member_class.exists?(name)
- $stderr.puts "#{member_type} '#{name}' doesn't exist."
+ $stderr.puts(_("%s '%s' doesn't exist.") % [member_type, name])
exit 1
end
member = member_class.find(name)
Modified: trunk/bin/asl-purge (+3 -1)
===================================================================
--- trunk/bin/asl-purge 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-purge 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -7,11 +7,13 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
Modified: trunk/bin/asl-groupmod (+14 -10)
===================================================================
--- trunk/bin/asl-groupmod 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-groupmod 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.gid = nil
options.allow_non_unique_gid_number = false
@@ -14,16 +16,16 @@
opts.on("-g", "--gid=GID", "gid") {|options.gid|}
opts.on("--[no-]allow-non-unique-gid",
- "gid can be non unique " +
+ _("gid can be non unique"),
"(#{options.allow_non_unique_gid_number})") do |bool|
options.allow_non_unique_gid_number = bool
end
opts.on("-r", "--rename=NEW_NAME",
- "new group name") {|options.new_group_name|}
+ _("new group name")) {|options.new_group_name|}
opts.on("-a", "--add-members=MEMBER1,MEMBER2,MEBMER3", Array,
- "add members (comma delimited)") {|options.members_to_add|}
+ _("add members (comma delimited)")) {|options.members_to_add|}
opts.on("-d", "--delete-members=MEMBER1,MEMBER2,MEBMER3", Array,
- "delete members (comma delimited)") {|options.members_to_delete|}
+ _("delete members (comma delimited)")) {|options.members_to_delete|}
end
name = nil
@@ -35,7 +37,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -54,7 +56,7 @@
end
unless Group.exists?(name)
- $stderr.puts "group '#{name}' doesn't exist."
+ $stderr.puts(_("group '%s' doesn't exist.") % name)
exit 1
end
group = Group.find(name)
@@ -71,9 +73,11 @@
if options.members_to_add and options.members_to_delete
duplicated_members = options.members_to_add & options.members_to_delete
unless duplicated_members.empty?
- message = "there are duplicated members in adding and deleting members: "
- message << duplicated_members.join(", ")
- $stderr.puts message
+ format =
+ n_("there is duplicated member in adding and deleting members: %s",
+ "there are duplicated members in adding and deleting members: %s",
+ duplicated_members.size)
+ $stderr.puts(format % duplicated_members.join(", "))
exit 1
end
end
@@ -110,7 +114,7 @@
if options.new_group_name
if Group.exists?(options.new_group_name)
- $stderr.puts "group '#{options.new_group_name}' always exists."
+ $stderr.puts(_("group '%s' always exists.") % options.new_group_name)
exit 1
end
Modified: trunk/bin/asl-useradd (+50 -49)
===================================================================
--- trunk/bin/asl-useradd 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-useradd 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -5,6 +5,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.ou = nil
options.computer_account = false
@@ -28,7 +30,7 @@
options.samba_logon_script = nil
options.samba_profile_path = nil
options.samba_account_flags = nil
- options.canonical_name = nil
+ options.common_name = nil
options.given_name = nil
options.surname = nil
options.mail_addresses = nil
@@ -37,8 +39,8 @@
opts.banner += " USER_NAME"
opts.on("-o", "--ou=OU",
- "add the user in the organizational unit OU",
- "(relative to the user suffix)") do |ou|
+ _("add the user in the organizational unit OU"),
+ _("(relative to the user suffix)")) do |ou|
if /^ou=/ =~ ou
options.ou = ou
else
@@ -46,88 +48,86 @@
end
end
opts.on("-c", "--[no-]computer-account",
- "is a Windows Workstation",
- "(otherwise, Windows user)",
+ _("is a Windows Workstation"),
+ _("(otherwise, Windows user)"),
"(#{options.computer_account})") {|options.computer_account|}
- opts.on("-u", "--uid=UID", Integer, "uid") {|options.uid|}
- opts.on("-g", "--gid=GID", "gid") {|options.gid|}
+ opts.on("-u", "--uid=UID", Integer, _("uid")) {|options.uid|}
+ opts.on("-g", "--gid=GID", _("gid")) {|options.gid|}
opts.on("-G", "--groups=GID1,GID2,GID3", Array,
- "supplementary groups (comma separated)") do |groups|
+ _("supplementary groups (comma separated)")) do |groups|
options.supplementary_groups = groups
end
opts.on("--[no-]create-group",
- "create a group for the user",
+ _("create a group for the user"),
"(#{options.create_group})") {|options.create_group|}
opts.on("-c", "--comment=COMMENT",
- "set the GECOS field for the new user account") {|options.comment|}
- opts.on("-s", "--shell=SHELL", "shell") {|options.shell|}
- opts.on("-G", "--given-name=NAME", "given name") {|options.given_name|}
- opts.on("-N", "--canonical-name=NAME",
- "canonical name") {|options.canonical_name|}
- opts.on("-S", "--surname=NAME", "surname") {|options.surname|}
+ _("set the GECOS field for the new user account")) {|options.comment|}
+ opts.on("-s", "--shell=SHELL", _("shell")) {|options.shell|}
+ opts.on("-G", "--given-name=NAME", _("given name")) {|options.given_name|}
+ opts.on("-N", "--common-name=NAME",
+ _("common name")) {|options.common_name|}
+ opts.on("-S", "--surname=NAME", _("surname")) {|options.surname|}
opts.on("-d", "--home-directory=HOME_DIR",
- "home directory") {|options.home_directory|}
+ _("home directory")) {|options.home_directory|}
opts.on("--home-directory-mode=MODE",
- "permission of home directory") {|options.home_directory_mode|}
+ _("permission of home directory")) {|options.home_directory_mode|}
opts.on("--[no-]setup-home-directory",
- "setup home directory",
+ _("setup home directory"),
"(#{options.setup_home_directory})") {|options.setup_home_directory|}
opts.on("-k", "--skel=DIR", "--skeleton-directory=DIR",
- "skeleton directory") {|options.skeleton_directory|}
+ _("skeleton directory")) {|options.skeleton_directory|}
opts.on("--time=TIME", Integer,
- "wait TIME seconds before exiting",
+ _("wait TIME seconds before exiting"),
"(#{options.time})") {|options.time|}
opts.separator("")
- opts.separator("For samba accounts:")
+ opts.separator(_("For samba accounts:"))
- opts.on("-e", "--expire-date=DATE", "expire date") do |date|
+ opts.on("-e", "--expire-date=DATE", _("expire date")) do |date|
options.expire_date = Time.parse(date)
end
opts.on("-C", "--[no-]can-change-password",
- "can change password") do |bool|
+ _("can change password")) do |bool|
options.can_change_password = bool
end
opts.on("-M", "--[no-]must-change-password",
- "must change password") do |bool|
+ _("must change password")) do |bool|
options.must_change_password = bool
end
opts.on("--samba-home-path=UNC",
- "sambaHomePath",
- "(SMB home share, like '\\\\PDC\\user'") do |unc|
+ _("sambaHomePath"),
+ _("(SMB home share, like '\\\\PDC\\user'")) do |unc|
options.samba_home_unc = unc
end
opts.on("--samba-home-drive=DRIVE",
- "sambaHomeDrive",
- "(letter associated with home share,",
- " like 'H:')") do |drive|
+ _("sambaHomeDrive"),
+ _("(letter associated with home share, like 'H:')")) do |drive|
options.samba_home_drive = drive
end
opts.on("--samba-logon-script=SCRIPT",
- "sambaLogonScript",
- "(DOS script to execute on login)") do |script|
+ _("sambaLogonScript"),
+ _("(DOS script to execute on login)")) do |script|
options.samba_logon_script = script
end
opts.on("--samba-profile-path=PATH",
- "sambaProfilePath",
- "(profile directory,",
- " like '\\\\PDC\\profiles\\user')") do |path|
+ _("sambaProfilePath"),
+ _("(profile directory, like '\\\\PDC\\profiles\\user')")) do |path|
options.samba_profile_path = path
end
opts.on("--samba-account-flags=FLAGS",
- "sambaAcctFlags",
- "(samba account control bits,",
- " like '[NDHTUMWSLXI]')") {|options.samba_account_flags|}
+ _("sambaAcctFlags"),
+ _("(samba account control bits, " \
+ "like '[NDHTUMWSLXI]')")) {|options.samba_account_flags|}
# opts.on("--mail-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
# Array,
-# "mailAddresses (comma separated)") {|options.mail_addresses|}
+# _("mailAddresses (comma separated)")) {|options.mail_addresses|}
# opts.on("--mail-to-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
# Array,
-# "mailToAddresses (forward address)",
-# "(comma separated)") do |addresses|
+# _("mailToAddresses (forward address)"),
+# _("(comma separated)")) do |addresses|
# options.mail_to_addresses = addresses
# end
end
@@ -141,7 +141,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -164,21 +164,22 @@
ldap_mapping
end
-member_class = options.computer_account ? Computer : User
-
-member_type = member_class.name.downcase
-
if options.computer_account
+ member_class = Computer
+ member_type = _("computer")
name = name.chomp("$") + "$"
+else
+ member_class = User
+ member_type = _("user")
end
unless member_class.valid_name?(name)
- $stderr.puts "'#{name}' is illegal #{member_type} name"
+ $stderr.puts(_("'%s' is illegal %s name.") % [name, member_type])
exit 1
end
if member_class.exists?(name)
- $stderr.puts "#{member_type} '#{name}' already exists."
+ $stderr.puts(_("%s '%s' already exists.") % [member_type, name])
exit 1
end
@@ -191,7 +192,7 @@
:home_directory => options.home_directory,
:login_shell => options.shell,
:given_name => options.given_name,
- :cn => options.canonical_name,
+ :cn => options.common_name,
:sn => options.surname,
:gecos => options.comment,
:samba_acct_flags => options.samba_account_flags,
@@ -220,7 +221,7 @@
begin
member = member_class.create(create_options)
rescue ActiveSambaLdap::UidNumberAlreadyExists
- $stderr.puts "UID '#{uid_number}' already exists"
+ $stderr.puts(_("UID '%s' already exists.") % uid_number)
exit 1
rescue ActiveSambaLdap::GidNumberDoesNotExist,
ActiveSambaLdap::GroupDoesNotExist,
Modified: trunk/bin/asl-usermod (+54 -49)
===================================================================
--- trunk/bin/asl-usermod 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-usermod 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -6,6 +6,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.computer_account = false
options.gecos = nil
@@ -20,7 +22,7 @@
options.supplementary_groups = nil
options.shell = nil
options.given_name = nil
- options.canonical_name = nil
+ options.common_name = nil
options.surname = nil
options.expire_date = nil
@@ -39,94 +41,94 @@
opts.banner += " USER_NAME"
opts.on("-c", "--[no-]computer-account",
- "is a Windows Workstation",
- "(otherwise, Windows user)",
+ _("is a Windows Workstation"),
+ _("(otherwise, Windows user)"),
"(#{options.computer_account})") {|options.computer_account|}
- opts.on("--gecos=GECOS", "gecos") {|options.gecos|}
+ opts.on("--gecos=GECOS", _("gecos")) {|options.gecos|}
opts.on("-d", "--home-directory=HOME_DIR",
- "home directory") {|options.home_directory|}
+ _("home directory")) {|options.home_directory|}
opts.on("-m", "--[no-]move-home-directory",
- "move home directory (#{options.move_home_directory})") do |bool|
+ _("move home directory"),
+ "(#{options.move_home_directory})") do |bool|
options.move_home_directory = bool
end
opts.on("-r", "--rename=NEW_NAME",
- "new user name (cn and dn are updated)") do |name|
+ _("new user name (cn and dn are updated)")) do |name|
options.new_user_name = name
end
- opts.on("-u", "--uid=UID", Integer, "uid") {|options.uid|}
+ opts.on("-u", "--uid=UID", Integer, _("uid")) {|options.uid|}
opts.on("--[no-]allow-non-unique-uid",
- "uid can be non unique " +
+ _("uid can be non unique "),
"(#{options.allow_non_unique_uid_number})") do |bool|
options.allow_non_unique_uid_number = bool
end
opts.on("-g", "--gid=GID", "gid") {|options.gid|}
opts.on("-G", "--groups=GID1,GID2,GID3", Array,
- "supplementary groups (comma separated)") do |groups|
+ _("supplementary groups (comma separated)")) do |groups|
options.supplementary_groups = groups
end
opts.on("--[no-]merge-groups",
- "replace supplementary groups " +
+ _("replace supplementary groups "),
"(#{!options.merge_groups})") {|options.merge_groups|}
- opts.on("-s", "--shell=SHELL", "shell") {|options.shell|}
- opts.on("--given-name=NAME", "given name") {|options.given_name|}
- opts.on("-N", "--canonical-name=NAME",
- "canonical name") {|options.canonical_name|}
- opts.on("-S", "--surname=NAME", "surname") {|options.surname|}
+ opts.on("-s", "--shell=SHELL", _("shell")) {|options.shell|}
+ opts.on("--given-name=NAME", _("given name")) {|options.given_name|}
+ opts.on("-N", "--common-name=NAME",
+ _("common name")) {|options.common_name|}
+ opts.on("-S", "--surname=NAME", _("surname")) {|options.surname|}
opts.separator("")
- opts.separator("For samba users:")
+ opts.separator(_("For samba accounts:"))
- opts.on("-e", "--expire-date=DATE", "expire date") do |date|
+ opts.on("-e", "--expire-date=DATE", _("expire date")) do |date|
options.expire_date = Time.parse(date)
end
opts.on("-C", "--[no-]can-change-password",
- "can change password") do |bool|
+ _("can change password")) do |bool|
options.can_change_password = bool
end
opts.on("-M", "--[no-]must-change-password",
- "must change password") do |bool|
+ _("must change password")) do |bool|
options.must_change_password = bool
end
opts.on("--samba-home-path=PATH",
- "sambaHomePath",
- "(SMB home share, like '\\\\PDC\\user'") do |path|
+ _("sambaHomePath"),
+ _("(SMB home share, like '\\\\PDC\\user'")) do |path|
options.samba_home_path = path
end
opts.on("--samba-home-drive=DRIVE",
- "sambaHomeDrive",
- "(letter associated with home share,",
- " like 'H:')") do |drive|
+ _("sambaHomeDrive"),
+ _("(letter associated with home share, like 'H:')")) do |drive|
options.samba_home_drive = drive
end
opts.on("--samba-logon-script=SCRIPT",
- "sambaLogonScript",
- "(DOS script to execute on login)") do |script|
+ _("sambaLogonScript"),
+ _("(DOS script to execute on login)")) do |script|
options.samba_logon_script = script
end
opts.on("--samba-profile-path=PATH",
- "sambaProfilePath",
- "(profile directory,",
- " like '\\\\PDC\\profiles\\user')") do |path|
+ _("sambaProfilePath"),
+ _("(profile directory, " \
+ "like '\\\\PDC\\profiles\\user')")) do |path|
options.samba_profile_path = path
end
opts.on("--samba-account-flags=FLAGS",
- "sambaAcctFlags",
- "(samba account control bits,",
- " like '[NDHTUMWSLXI]')") {|options.samba_account_flags|}
- opts.on("-D", "--[no-]disable-user", "disable an user") do |bool|
+ _("sambaAcctFlags"),
+ _("(samba account control bits, " \
+ "like '[NDHTUMWSLXI]')")) {|options.samba_account_flags|}
+ opts.on("-D", "--[no-]disable-user", _("disable this user")) do |bool|
options.enable = !bool
end
- opts.on("-E", "--[no-]enable-user", "enable an user") do |bool|
+ opts.on("-E", "--[no-]enable-user", _("enable this user")) do |bool|
options.enable = bool
end
# opts.on("--mail-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
# Array,
-# "mailAddresses (comma separated)") {|options.mail_addresses|}
+# _("mailAddresses (comma separated)")) {|options.mail_addresses|}
# opts.on("--mail-to-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
# Array,
-# "mailToAddresses (forward address)",
-# "(comma separated)") do |addresses|
+# _("mailToAddresses (forward address)"),
+# _("(comma separated)")) do |addresses|
# options.mail_to_addresses = addresses
# end
end
@@ -155,21 +157,23 @@
options.computer_account = true if /\$$/ =~ name
-member_class = options.computer_account ? Computer : User
-member_type = member_class.name.downcase
-
if options.computer_account
+ member_class = Computer
+ member_type = _("computer")
name = name.chomp("$") + "$"
+else
+ member_class = User
+ member_type = _("user")
end
unless member_class.exists?(name)
- $stderr.puts "#{member_type} '#{name}' doesn't exist."
+ $stderr.puts(_("%s '%s' doesn't exist.") % [member_type, name])
exit 1
end
member = member_class.find(name)
unless Process.uid.zero?
- password = ActiveSambaLdap::Command.read_password("Enter your password: ")
+ password = ActiveSambaLdap::Command.read_password(_("Enter your password: "))
auth_class = Class.new(ActiveSambaLdap::Base)
config = ActiveSambaLdap::Base.configurations["reference"]
@@ -178,7 +182,7 @@
:password => password,
:allow_anonymous => false))
rescue ActiveLdap::AuthenticationError
- $stderr.puts "password isn't match"
+ $stderr.puts(_("password isn't match."))
exit 1
ensure
auth_class.remove_connection
@@ -220,8 +224,8 @@
member.home_directory = options.home_directory
end
-if options.canonical_name
- member.cn = options.canonical_name
+if options.common_name
+ member.cn = options.common_name
end
if options.surname
@@ -233,11 +237,11 @@
end
if options.mail_addresses
- raise "not implemented"
+ raise _("not implemented")
end
if options.mail_to_addresses
- raise "not implemented"
+ raise _("not implemented")
end
if options.supplementary_groups
@@ -307,7 +311,8 @@
options.new_user_name = options.new_user_name.chomp("$") + "$"
end
if member_class.exists?(options.new_user_name)
- $stderr.puts "#{member_type} '#{options.new_user_name}' always exists."
+ format = _("%s '%s' always exists.")
+ $stderr.puts(format % [member_type, options.new_user_name])
exit 1
end
new_member = member_class.new(options.new_user_name)
Modified: trunk/bin/asl-samba-computeradd (+8 -6)
===================================================================
--- trunk/bin/asl-samba-computeradd 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-samba-computeradd 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,14 +3,16 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.ou = nil
opts.banner += " COMPUTER_NAME"
opts.on("-o", "--ou=OU",
- "add the user in the organizational unit OU",
- "(relative to the user suffix)") do |ou|
+ _("add the user in the organizational unit OU"),
+ _("(relative to the user suffix)")) do |ou|
if /^ou=/ =~ ou
options.ou = ou
else
@@ -28,7 +30,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -52,12 +54,12 @@
end
unless Computer.valid_name?(name)
- $stderr.puts "'#{name}' is illegal computer name"
+ $stderr.puts(_("'%s' is illegal computer name.") % name)
exit 1
end
if Computer.exists?(name)
- $stderr.puts "computer '#{name}' already exists."
+ $stderr.puts(_("computer '%s' already exists.") % name)
exit 1
end
@@ -73,7 +75,7 @@
begin
computer = Computer.create(:uid => name, :group_class => Group)
rescue ActiveSambaLdap::UidNumberAlreadyExists
- $stderr.puts "UID '#{uid_number}' already exists"
+ $stderr.puts(_("UID '%s' already exists.") % uid_number)
exit 1
rescue ActiveSambaLdap::GidNumberDoesNotExist,
ActiveSambaLdap::GroupDoesNotExist,
Modified: trunk/bin/asl-samba-groupdel (+4 -2)
===================================================================
--- trunk/bin/asl-samba-groupdel 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-samba-groupdel 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
opts.banner += " GROUP_NAME"
end
@@ -16,7 +18,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -35,7 +37,7 @@
end
unless Group.exists?(name)
- $stderr.puts "group '#{name}' doesn't exist."
+ $stderr.puts(_("group '%s' doesn't exist.") % name)
exit 1
end
group = Group.find(name)
Modified: trunk/bin/asl-groupshow (+3 -1)
===================================================================
--- trunk/bin/asl-groupshow 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-groupshow 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
opts.banner += " GROUP_NAME"
end
@@ -22,7 +24,7 @@
end
unless Group.exists?(name)
- $stderr.puts "group '#{name}' doesn't exist."
+ $stderr.puts(_("group '%s' doesn't exist.") % name)
exit 1
end
group = Group.find(name)
Modified: trunk/bin/asl-samba-groupadd (+4 -2)
===================================================================
--- trunk/bin/asl-samba-groupadd 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-samba-groupadd 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
opts.banner += " GROUP_NAME"
end
@@ -16,7 +18,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -31,7 +33,7 @@
end
if Group.exists?(name)
- $stderr.puts "group '#{name}' already exists."
+ $stderr.puts(_("group '%s' already exists.") % name)
exit 1
end
Modified: trunk/bin/asl-usershow (+3 -1)
===================================================================
--- trunk/bin/asl-usershow 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-usershow 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
opts.banner += " USER_NAME"
end
@@ -22,7 +24,7 @@
end
unless User.exists?(name)
- $stderr.puts "user '#{name}' doesn't exist."
+ $stderr.puts(_("user '%s' doesn't exist.") % name)
exit 1
end
user = User.find(name)
Modified: trunk/bin/asl-samba-groupmod (+8 -7)
===================================================================
--- trunk/bin/asl-samba-groupmod 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-samba-groupmod 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.members_to_add = nil
options.members_to_delete = nil
@@ -10,9 +12,9 @@
opts.banner += " GROUP_NAME"
opts.on("-a", "--add-members=MEMBER1,MEMBER2,MEBMER3", Array,
- "add members (comma delimited)") {|options.members_to_add|}
+ _("add members (comma delimited)")) {|options.members_to_add|}
opts.on("-d", "--delete-members=MEMBER1,MEMBER2,MEBMER3", Array,
- "delete members (comma delimited)") {|options.members_to_delete|}
+ _("delete members (comma delimited)")) {|options.members_to_delete|}
end
name = nil
@@ -24,7 +26,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -43,7 +45,7 @@
end
unless Group.exists?(name)
- $stderr.puts "group '#{name}' doesn't exist."
+ $stderr.puts(_("group '%s' doesn't exist.") % name)
exit 1
end
group = Group.find(name)
@@ -51,9 +53,8 @@
if options.members_to_add and options.members_to_delete
duplicated_members = options.members_to_add & options.members_to_delete
unless duplicated_members.empty?
- message = "there are duplicated members in adding and deleting members: "
- message << duplicated_members.join(", ")
- $stderr.puts message
+ format = _("there are duplicated members in adding and deleting members: %s")
+ $stderr.puts(format % duplicated_members.join(", "))
exit 1
end
end
Modified: trunk/bin/asl-samba-userdel (+4 -2)
===================================================================
--- trunk/bin/asl-samba-userdel 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-samba-userdel 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,6 +3,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
opts.banner += " USER_NAME"
end
@@ -16,7 +18,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -35,7 +37,7 @@
end
unless User.exists?(name)
- $stderr.puts "user '#{name}' doesn't exist."
+ $stderr.puts(_("user '%s' doesn't exist.") % name)
exit 1
end
Modified: trunk/bin/asl-passwd (+13 -9)
===================================================================
--- trunk/bin/asl-passwd 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-passwd 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -5,6 +5,8 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.update_samba_password = true
options.update_unix_password = true
@@ -12,12 +14,14 @@
opts.banner += " [USER_NAME]"
opts.on("-s", "--[no-]samba-password",
- "update samba password (#{options.update_samba_password})") do |bool|
+ _("update samba password"),
+ "(#{options.update_samba_password})") do |bool|
options.update_samba_password = bool
end
opts.on("-u", "--[no-]unix-password",
- "update UNIX password (#{options.update_unix_password})") do |bool|
+ _("update UNIX password"),
+ "(#{options.update_unix_password})") do |bool|
options.update_unix_password = bool
end
end
@@ -34,7 +38,7 @@
end
if !options.update_samba_password and !options.update_unix_password
- $stderr.puts "do nothing"
+ $stderr.puts(_("do nothing."))
exit
end
@@ -45,13 +49,13 @@
end
unless User.exists?(name)
- $stderr.puts "user '#{name}' doesn't exist."
+ $stderr.puts(_("user '%s' doesn't exist.") % name)
exit 1
end
user = User.find(name)
unless Process.uid.zero?
- prompt = "Enter your current password: "
+ prompt = _("Enter your current password: ")
old_password = ActiveSambaLdap::Command.read_password(prompt)
auth_class = Class.new(ActiveSambaLdap::Base)
@@ -61,18 +65,18 @@
:password => old_password,
:allow_anonymous => false))
rescue ActiveLdap::AuthenticationError
- $stderr.puts "password isn't match"
+ $stderr.puts(_("password isn't match."))
exit 1
ensure
auth_class.remove_connection
end
end
-password = ActiveSambaLdap::Command.read_password("New password: ")
-password2 = ActiveSambaLdap::Command.read_password("Retype new password: ")
+password = ActiveSambaLdap::Command.read_password(_("New password: "))
+password2 = ActiveSambaLdap::Command.read_password(_("Retype new password: "))
unless password == password2
- $stderr.puts "New passwords don't match."
+ $stderr.puts(_("New passwords don't match."))
exit 1
end
Modified: trunk/bin/asl-samba-useradd (+8 -6)
===================================================================
--- trunk/bin/asl-samba-useradd 2007-09-08 19:48:19 +09:00 (rev 108)
+++ trunk/bin/asl-samba-useradd 2007-09-08 20:50:40 +09:00 (rev 109)
@@ -3,14 +3,16 @@
require 'active_samba_ldap'
require 'active_samba_ldap/command'
+include ActiveSambaLdap::GetTextSupport
+
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
options.ou = nil
opts.banner += " USER_NAME"
opts.on("-o", "--ou=OU",
- "add the user in the organizational unit OU",
- "(relative to the user suffix)") do |ou|
+ _("add the user in the organizational unit OU"),
+ _("(relative to the user suffix)")) do |ou|
if /^ou=/ =~ ou
options.ou = ou
else
@@ -28,7 +30,7 @@
end
unless Process.uid.zero?
- $stderr.puts "need root authority."
+ $stderr.puts(_("need root authority."))
exit 1
end
@@ -52,12 +54,12 @@
end
unless User.valid_name?(name)
- $stderr.puts "'#{name}' is illegal user name"
+ $stderr.puts(_("'%s' is illegal user name.") % name)
exit 1
end
if User.exists?(name)
- $stderr.puts "user '#{name}' already exists."
+ $stderr.puts(_("user '%s' already exists.") % name)
exit 1
end
@@ -70,7 +72,7 @@
begin
user = User.create(:uid => name, :group_class => Group)
rescue ActiveSambaLdap::UidNumberAlreadyExists
- $stderr.puts "UID '#{uid_number}' already exists"
+ $stderr.puts(_("UID '%s' already exists") % uid_number)
exit 1
rescue ActiveSambaLdap::GidNumberDoesNotExist,
ActiveSambaLdap::GroupDoesNotExist,
More information about the asl-commit
mailing list