--- nfo/perl/scripts/umltools/uml_setup.pl 2002/10/22 02:25:56 1.1 +++ nfo/perl/scripts/umltools/uml_setup.pl 2002/11/03 01:20:19 1.2 @@ -75,7 +75,11 @@ usage(); } -if ($glbl_ask) { our $DEBUG_STEP; $DEBUG_STEP = 1; } +if ($glbl_ask) { + our $DEBUG_STEP; + $DEBUG_STEP = 1; + $UML::Config::DEBUG_STEP = 1; +} my $vhost = get_host_cfg($vhost_name); my %vhost = %{$vhost}; @@ -171,17 +175,24 @@ my $initscript_path = "/etc/init.d/$daemon"; my $runlevel_base = "/etc/init.d/rc$runlevel.d"; + my $owner = $vhost->{main}{owner}; + + # TODO: handle if above determined parameters are not set + # try not to write out invalid shell scripts! + # main init script $content = "#!/usr/bin/perl + use strict; use warnings; my \$action = shift; if (!\$action) { - print \"no action!\", \"\\n\"; + print \"\$0 called without action argument!\", \"\\n\"; exit; } if (\$action eq \"start\") { - system(\"$uml_boot --start --vhost=$vhost_name\"); + system(\"$uml_boot --prepare --vhost=$vhost_name\"); + system(\"$sudo -u $owner $uml_boot --start --vhost=$vhost_name\"); } if (\$action eq \"stop\") { system(\"$uml_boot --stop --vhost=$vhost_name\"); @@ -195,12 +206,12 @@ # runlevel init scripts $filename = "$runlevel_base/S30$daemon"; $cmd = "rm $filename; ln $initscript_path -s $filename"; - askCmd("do it?", $cmd, "unmounting datafs"); + askCmd("do it?", $cmd, "create $filename"); chmod S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, $filename; $filename = "$runlevel_base/K01$daemon"; $cmd = "rm $filename; ln $initscript_path -s $filename"; - askCmd("do it?", $cmd, "unmounting datafs"); + askCmd("do it?", $cmd, "create $filename"); chmod S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, $filename; }