[LON-CAPA-cvs] cvs: loncom /build make_domain_coordinator.pl
raeburn
raeburn@source.lon-capa.org
Fri, 17 Jul 2009 01:11:11 -0000
raeburn Fri Jul 17 01:11:11 2009 EDT
Modified files:
/loncom/build make_domain_coordinator.pl
Log:
--stdin option not available with system passwd command in debian/ubuntu
- use system call to usermod instead.
Index: loncom/build/make_domain_coordinator.pl
diff -u loncom/build/make_domain_coordinator.pl:1.15 loncom/build/make_domain_coordinator.pl:1.16
--- loncom/build/make_domain_coordinator.pl:1.15 Mon Mar 3 15:25:02 2008
+++ loncom/build/make_domain_coordinator.pl Fri Jul 17 01:11:11 2009
@@ -11,7 +11,7 @@
# The LearningOnline Network
# make_domain_coordinator.pl - Make a domain coordinator on a system
#
-# $Id: make_domain_coordinator.pl,v 1.15 2008/03/03 15:25:02 www Exp $
+# $Id: make_domain_coordinator.pl,v 1.16 2009/07/17 01:11:11 raeburn Exp $
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
@@ -304,9 +304,20 @@
if ($pbad) {
die('Password must consist of standard ASCII characters'."\n");
}
-open(OUT,"|passwd --stdin $username");
-print(OUT $passwd."\n");
-close(OUT);
+
+my $distro;
+if (open(PIPE,"perl distprobe|")) {
+ $distro = <PIPE>;
+ close(PIPE);
+}
+if ($distro =~ /^ubuntu|debian/) {
+ open(OUT,"|usermod -p `mkpasswd $passwd` $username");
+ close(OUT);
+} else {
+ open(OUT,"|passwd --stdin $username");
+ print(OUT $passwd."\n");
+ close(OUT);
+}
=pod