summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakTermServ
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2005-03-18 17:13:39 +0000
committerStew Benedict <stewb@mandriva.org>2005-03-18 17:13:39 +0000
commita2bc00afd9fb3c84efbc5c7d9a286cb47ba57828 (patch)
tree4390b99791b83fda96f5d62e12d6326798ec9455 /perl-install/standalone/drakTermServ
parent720130c8ada5754e7aa8ba539301d5842d63815f (diff)
downloaddrakx-backup-do-not-use-a2bc00afd9fb3c84efbc5c7d9a286cb47ba57828.tar
drakx-backup-do-not-use-a2bc00afd9fb3c84efbc5c7d9a286cb47ba57828.tar.gz
drakx-backup-do-not-use-a2bc00afd9fb3c84efbc5c7d9a286cb47ba57828.tar.bz2
drakx-backup-do-not-use-a2bc00afd9fb3c84efbc5c7d9a286cb47ba57828.tar.xz
drakx-backup-do-not-use-a2bc00afd9fb3c84efbc5c7d9a286cb47ba57828.zip
Lose the "system" calls. Use pxe.include now. Clean up some redundant code.
Diffstat (limited to 'perl-install/standalone/drakTermServ')
-rwxr-xr-xperl-install/standalone/drakTermServ52
1 files changed, 24 insertions, 28 deletions
diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ
index 9ca39ef0d..9518336b4 100755
--- a/perl-install/standalone/drakTermServ
+++ b/perl-install/standalone/drakTermServ
@@ -66,11 +66,11 @@ my @kernels = bootloader::installed_vmlinuz();
my $cmd_line = 1;
#- make sure terminal server and friends are installed
-my $ts = system("rpm -q terminal-server > /dev/null");
-if ($ts == 256) {
- system("urpmi --auto terminal-server >/dev/null 2>/dev/null") unless $::testing;
- $ts = system("rpm -q terminal-server > /dev/null");
- if ($ts == 256 && !$::testing) {
+my $ts = run_program::run("rpm -q terminal-server > /dev/null");
+if ($ts != 1) {
+ run_program::run("urpmi --auto terminal-server >/dev/null 2>/dev/null") unless $::testing;
+ $ts = run_program::run("rpm -q terminal-server > /dev/null");
+ if ($ts != 1 && !$::testing) {
warn(N("Useless without Terminal Server"));
exit(1);
}
@@ -444,7 +444,7 @@ sub make_nbis() {
my $buff = N("Creating net boot images for all kernels");
$in->ask_warn(N("Information"), N("This will take a few minutes."));
gtkset_mousecursor_wait();
- system("/usr/bin/mknbi-set -k /boot/$_") foreach @kernels;
+ run_program::run("/usr/bin/mknbi-set -k /boot/$_") foreach @kernels;
gtkset_mousecursor_normal();
$buff .= "\n\n\t" . N("Done!");
text_view($buff, "wizard");
@@ -472,7 +472,7 @@ sub sync_users() {
sub restart_dm() {
if ($clients_set) {
my $result = $in->ask_okcancel('', N("In order to enable changes made for thin clients, the display manager must be restarted. Restart now?"));
- system('nohup /sbin/service dm restart') if $result;
+ run_program::run('nohup /sbin/service dm restart') if $result;
}
}
@@ -663,7 +663,7 @@ sub make_nbi() {
#- method in mknbi-net is much better
my @nics = ("3c509", "3c59x", "3c90x", "8139cp", "8139too", "acenic", "airo",
"aironet4500_card", "bcm5700", "dgrs", "dl2k", "dmfe", "e100",
- "e1000", "eepro100", "epic100", "fealnx", "hamachi", "hp100",
+ "e1000", "eepro100", "epic100", "fealnx", "forcedeth", "hamachi", "hp100",
"hysdn", "natsemi", "natsemi_old", "ne", "ne2k-pci", "ns83820",
"pcnet32", "pegasus", "prism2_pci", "prism2_plx", "rcpci", "sis900",
"starfire", "sundance", "sungem", "sunhme", "tlan", "tulip-old",
@@ -822,7 +822,7 @@ sub build_n_update {
my ($list_model, $kernel, $nic) = @_;
my $command = "-k /boot/$kernel";
$command .= " -r $nic" if $nic;
- system("/usr/bin/mknbi-set -v $command");
+ run_program::run("/usr/bin/mknbi-set -v $command");
if ($conf{CREATE_PXE}) {
my $pxedir = get_platform_pxe();
cp_af("/boot/$kernel", $pxedir) if !-f "$pxedir/$kernel";
@@ -1418,16 +1418,16 @@ sub get_ip_from_sys() {
sub write_dhcpd_config {
my ($mode, $subnet, $netmask, $routers, $subnet_mask, $broadcast, $domain, $ns1, $ns2, $ns3, $pool_start, $pool_end) = @_;
my @dhcpd_config;
+ my @includes;
+ push @includes, qq(# Include PXE definitions and defaults\ninclude "/etc/dhcpd.conf.pxe.include";\n) if $conf{CREATE_PXE};
+ push @includes, qq(# Include Etherboot definitions and defaults\ninclude "/etc/dhcpd.conf.etherboot.include";\n);
+ push @includes, qq(# Include Etherboot default kernel version\ninclude "/etc/dhcpd.conf.etherboot.kernel";\n);
if ($mode eq "append") {
append_to_file("/etc/dhcpd.conf", qq(include "/etc/dhcpd.conf.terminal-server";\n));
-#- disable for the moment until we finish PXE setup
-# push @dhcpd_config, qq(# Include PXE definitions and defaults\ninclude "/etc/dhcpd.conf.pxe.include";\n) if $conf{CREATE_PXE};
- push @dhcpd_config, qq(# Include Etherboot definitions and defaults\ninclude "/etc/dhcpd.conf.etherboot.include";\n);
- push @dhcpd_config, qq(# Include Etherboot default kernel version\ninclude "/etc/dhcpd.conf.etherboot.kernel";\n);
+ push @dhcpd_config, @includes;
push @dhcpd_config, qq(# Include client machine configurations\ninclude "$client_cfg";\n);
- output_p("/etc/dhcpd.conf.terminal-server", @dhcpd_config);
- $config_written = 1;
+ $config_written = output_p("/etc/dhcpd.conf.terminal-server", @dhcpd_config);
return;
}
@@ -1437,10 +1437,7 @@ sub write_dhcpd_config {
push @dhcpd_config, "#dhcpd.conf - generated by drakTermServ\n\n";
push @dhcpd_config, "ddns-update-style none;\n\n";
push @dhcpd_config, "# Long leases (48 hours)\ndefault-lease-time 172800;\nmax-lease-time 172800;\n\n";
- push @dhcpd_config, qq(# Include Etherboot definitions and defaults\ninclude "/etc/dhcpd.conf.etherboot.include";\n);
-#- disable for the moment until we finish PXE setup
-# push @dhcpd_config, qq(# Include PXE definitions and defaults\ninclude "/etc/dhcpd.conf.pxe.include";\n) if $conf{CREATE_PXE};
- push @dhcpd_config, qq(# Include Etherboot default kernel version\ninclude "/etc/dhcpd.conf.etherboot.kernel";\n\n);
+ push @dhcpd_config, @includes;
push @dhcpd_config, "# Network-specific section\n\n";
push @dhcpd_config, "subnet $subnet netmask $netmask {\n";
@@ -1461,8 +1458,7 @@ sub write_dhcpd_config {
push @dhcpd_config, "}\n\n";
push @dhcpd_config, qq(# Include client machine configurations\ninclude "$client_cfg";\n);
- output_p("/etc/dhcpd.conf", @dhcpd_config);
- $config_written = 1;
+ $config_written = output_p("/etc/dhcpd.conf", @dhcpd_config);
}
sub write_eb_image {
@@ -1473,7 +1469,7 @@ sub write_eb_image {
if (-e "/dev/fd0") {
my $result = $in->ask_okcancel('', N("Please insert floppy disk:"));
return if !($result);
- $result = system("cat $rom_path/floppyload.bin $rom_path/start16.bin $rom_path/zimg/$nic > /dev/fd0") if $result;
+ $result = run_program::run("cat $rom_path/floppyload.bin $rom_path/start16.bin $rom_path/zimg/$nic > /dev/fd0") if $result;
if ($result) {
$in->ask_warn(N("Error"), N("Could not access the floppy!"));
} else {
@@ -1483,7 +1479,7 @@ sub write_eb_image {
$in->ask_warn(N("Error"), N("No floppy drive available!"));
}
} elsif ($type eq 'pxe') {
- system("cat $rom_path/pxeprefix.bin $rom_path/start16.bin $rom_path/zimg/$nic > $tftpboot/$nic.pxe");
+ run_program::run("cat $rom_path/pxeprefix.bin $rom_path/start16.bin $rom_path/zimg/$nic > $tftpboot/$nic.pxe");
if (-e "$tftpboot/$nic.pxe") {
$in->ask_warn(N("Information"), N("PXE image is %s/%s", $tftpboot, $nic));
} else {
@@ -1492,9 +1488,9 @@ sub write_eb_image {
} else {
my $tmp = "/root/tmp";
mkdir_p("$tmp/eb");
- system("cat $rom_path/floppyload.bin $rom_path/start16.bin $rom_path/zimg/$nic > $tmp/eb/eb.img");
- system("dd if=/dev/zero of=$tmp/eb/eb.img bs=512 seek=72 count=2808");
- system("mkisofs -b eb.img -o $tmp/$nic.iso $tmp/eb");
+ run_program::run("cat $rom_path/floppyload.bin $rom_path/start16.bin $rom_path/zimg/$nic > $tmp/eb/eb.img");
+ run_program::run("dd if=/dev/zero of=$tmp/eb/eb.img bs=512 seek=72 count=2808");
+ run_program::run("mkisofs -b eb.img -o $tmp/$nic.iso $tmp/eb");
rm_rf("$tmp/eb");
if (-e "$tmp/$nic.iso") {
$in->ask_warn(N("Information"), N("Etherboot ISO image is %s", "$tmp/$nic.iso"));
@@ -1588,7 +1584,7 @@ sub disable_ts() {
sub toggle_chkconfig {
#- change service config
my ($state, $service, $buff_index) = @_;
- system("/sbin/chkconfig $service $state");
+ run_program::run("/sbin/chkconfig $service $state");
$buff[$buff_index] = "\tTurning $service $state...\n";
$buff_index++;
$buff_index;
@@ -1596,7 +1592,7 @@ sub toggle_chkconfig {
sub service_change {
my ($service, $command, $buff_index) = @_;
- system("BOOTUP=serial /sbin/service $service $command > /tmp/drakTSservice.status 2>&1");
+ run_program::run("BOOTUP=serial /sbin/service $service $command > /tmp/drakTSservice.status 2>&1");
my @result = cat_("/tmp/drakTSservice.status");
foreach (@result) {
$buff[$buff_index] = "\t$_";