#!/usr/bin/perl $config_file = "/etc/gdm/custom.conf"; $bkup_file = $config_file . ".ltsp.orig"; $tmp_file = $config_file . ".ltsp.tmp"; # don't bother to continue unless the target file exists $exists = stat ($config_file); if (! $exists) { print "\n". $config_file ." not found\n\n"; exit; } # open target file open (IN, "< $config_file"); open (OUT, "> $tmp_file"); $xdmcp_section = 0; while () { if ($_ =~ /^\[xdmcp\]/i) { $xdmcp_section = 1; print OUT $_; print OUT "MaxSessions=250\n"; $_ = "Enable=true\n"; # } elsif ($_ =~ /^\[daemon\]/i) { # $daemon_section = 1; # print OUT $_; # print OUT "HaltCommand=\n"; # $_ = "RebootCommand=\n"; } elsif ($_ =~ /^\[/) { $xdmcp_section = 0; $greeter_section = 0; # $daemon_section = 0; } if ($xdmcp_section) { if ($_ =~ "Enable=false") { $_ = "Enable=true\n"; } if ($_ =~ /MaxSessions=16/) { $_ = "MaxSessions=250\n"; } } # if ($daemon_section) { # if ($_ =~ /^HaltCommand=[A-Za-z0-9 ].*/i) { # $_ = "#" . $_ ; # } # if ($_ =~ /^RebootCommand=[A-Za-z0-9 ].*/i) { # $_ = "#" . $_ ; # } # } print OUT $_; } # close up the files close (IN); close (OUT); # out with the old, in with the new `mv $config_file $bkup_file`; `mv $tmp_file $config_file`; exit;