#!/usr/local/bin/perl
# edit_hostconfig.cgi
#
# Edit the settings in the hostconfig file, or the
# StartupItems script or plist associated with the
# action described in the hostconfig file.
#
# Also create a new startup action with associated script and plist
# and manually modify hostconfig file.
require './init-lib.pl';
require './hostconfig-lib.pl';
use File::Basename;
$access{'bootup'} == 1 || &error($text{'edit_ecannot'});
$ty = $ARGV[0];
if ($ty == 0) {
# Editing an existing action in /etc/hostconfig
$action_to_edit = $ARGV[1];
&ui_print_header(undef, $text{'edit_title'}, "");
%startuphash = &hostconfig_gather(startscript);
$startscript = $startuphash{"$action_to_edit"};
if ( $startscript ne "") {
$startupdir = dirname("$startscript");
$plistedit = "$startupdir/$config{'plist'}";
}
else {
$plistedit = "";
}
#create the action edit table
$actionedit = &hostconfig_editaction("$action_to_edit", "$startscript");
print "
\n";
#create the edit file forms
if ($startscript ne "") {
print &ui_hr();
print &text('edit_hostconfig_startup',
"$startscript")," \n";
# }
print "\n";
}
if ($plistedit ne "") {
print &ui_hr();
print &text('edit_hostconfig_plist',
"$plistedit")," \n";
# }
print "\n";
}
}
if ($ty == 1) {
&ui_print_header(undef, $text{'edit_hostconfig_new'}, "");
print "\n";
print "