#!/usr/bin/perl

# Installing Choice 3.3
# By Sean Clarke
# To install type ./install in the directory choice + install are in

if ($< ne "0")  {
print "You must be superuser to run install!\n";
exit 0;
}
else 
{
print "Must be executed as root, choice will be placed in /bin/choice and under 
/etc/shells.\n\n";
print "About choice...\n";
print "Choice is a menu system for new users to unix/linux.  It is full in
color and bug free, and user friendly.  If you would like information
about a newer version that you may not have please contact,
root\@smoke.minot.com and I will get you the newest version I have made so
far.  Choice will work on every type of linux or unix machine.  Please
enjoy choice and if you like this or find a problem that you would like me
to fix, please send mail to root\@smoke.minot.com and I will get right on
it. Thanx for getting choice.\n\n";

print "Do you wish to continue? (y/n) "; 
$wish = <STDIN>;
$choicehost = '/etc/.choicehost'; 
chop $wish; 
if (($wish eq 'n')||($wish eq 'N')||($wish eq 'no'))  {
exit 0;
}
else
{
print "Enter the name of this system : ";
$system = <STDIN>;
chop $system;
system "rm -f /etc/.choicehost";
if ($system eq '')  {
print "Since you did not enter anything your system will be know as localhost";
system "touch /etc/.choicehost";
open (FILE, ">>" . $choicehost) || die "You are not superuser";
print FILE "localhost";
close (FILE);
}
else
{
system "touch /etc/.choicehost";
open (FILE, ">>" . $choicehost) || die "You are not superuser";
print FILE "$system";
close (FILE);
}
system "cp choice /bin/choice";
$shell = '/etc/shells';
open (FILE, ">>" . $shell);
print FILE "/bin/choice\n";
close (FILE);
}
system "clear";
print "Choice is now installed succesfully...Enjoy!\n\n\n\n\n\n";
exit 0;
# End of setup.
}
