#!/bin/sh
# setup
# This script should be run after the FileManager archive is unpacked, in order
# to set up the various program, config, and html files

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

# Find distribution directory
cd `dirname $0`
dist_dir=`pwd`;
ver=`cat $dist_dir/version.txt`
autoos=2

echo ""
echo ""
echo "***********************************************************************"
echo "       Welcome to the FileManager setup script, version $ver    "
echo "***********************************************************************"
echo "FileManager is a web-based file, directory, and remote command manager "
echo "for Unix-like operating systems."
echo "***********************************************************************"
echo ""

# Let's figure out the copy command for directories.
# First try 'cp -rd'
rm -fr $dist_dir/testdir1
cprd="cp -rd"
eval "$cprd $dist_dir/testdir $dist_dir/testdir1" >/dev/null 2>&1
if [ $? != 0 ]; then
        cprd="cp -R"
        eval "$cprd $dist_dir/testdir $dist_dir/testdir1" >/dev/null 2>&1
        if [ $? != 0 ]; then
                echo "Setup cannot determine how to copy entire directories."
                echo "Please enter the command to copy directories while"
                echo "preserving links."
                echo ""
                printf "Directory Copy command: "
                read cprd
                if [ "$cprd" != "" ]; then
                        eval "$cprd $dist_dir/testdir $dist_dir/testdir1" >/dev/null 2>&1
                        if [ $? != 0 ]; then
                                echo "Command failed. Directory copying will be disabled."
                                cprd=""
                        fi
                fi
                echo ""
        fi
fi

if [ "$cprd" != "" ]; then
        temp=`ls -l $dist_dir/testdir1/linktest | grep "^l"`
        if [ "$temp" = "" ]; then
                echo ""
                echo "ERROR: Directory Copy command ($cprd) did not work properly."
                echo "Directory copying will be disabled."
                echo ""
                cprd=""
        fi
fi

rm -fr $dist_dir/testdir1


# Ask if a Server should be installed
echo "FileManager contains a mini-Web Server if you do not already have"
echo "a Web Server installed. This mini-server enables password protection"
echo "features and can be run as any user (typically root)."
echo ""
printf "Do you want to install the mini-Web Server (y/n) [n]? "
read use_serv
if [ "$use_serv" = "" ]; then
        use_serv="n"
fi
use_serv=`echo $use_serv | grep "^[yY]"`

if [ "$use_serv" != "" ]; then
        use_serv=1
        echo "*** MiniServer will be installed ***"
        echo ""
        echo "***********************************************************************"
        echo "FileManager should be installed in a directory owned by this process."
        echo "It is recommended that a new directory be used."
        echo ""
        if [ "$defhtmldir" = "" ]; then
          if [ -d "/usr/local" ]; then
            defhtmldir=/usr/local/fm
          else
            defhtmldir=$dist_dir/fm
          fi
        fi
        printf "Installation directory [$defhtmldir]: "
        read html_dir
        if [ "$html_dir" = "" ]; then
                html_dir=$defhtmldir
        fi
        abspath=`echo $html_dir | grep "^/"`
        if [ "$abspath" = "" ]; then
                echo "Installation directory must be an absolute path"
                echo ""
                exit
        fi
        if [ ! -d $html_dir ]; then
                mkdir $html_dir;
                chmod 750 $html_dir
                if [ $? != 0 ]; then
                        echo "ERROR: Failed to create directory $html_dir"
                        echo ""
                        exit
                fi
        fi
        cgi_dir=$html_dir
else
        use_serv=0
        echo "*** MiniServer will NOT be installed ***"
        echo ""
        echo "***********************************************************************"
        echo "FileManager will place the HTML and Image files into a subdirectory"
        echo "named 'fm' in your web server document root directory. If 'fm' already"
        echo "exists, then you will be prompted to supply a different name."
        echo "Please enter the full path of your web server document root directory."
        echo ""
        printf "Document root (HTML) directory: "
        read doc_root
        if [ "$doc_root" = "" ]; then
                echo "ERROR: You must specify your document root."
                echo ""
                exit
        fi
        doc_root=`echo $doc_root | sed 's?.//*$??'`
        abspath=`echo $doc_root | grep "^/"`
        if [ "$abspath" = "" ]; then
                echo "Document root directory must be an absolute path"
                echo ""
                exit
        fi
        if [ ! -d "$doc_root" ]; then
                echo "ERROR: Unable to find directory: $doc_root"
                echo ""
                exit
        fi
        sub_dir=fm
        html_dir=$doc_root/$sub_dir
        if [ -d "$html_dir" ]; then
                sub_dir=fm$ver
                printf "Subdirectory name [$sub_dir]: "
                read sub_dir
                sub_dir=`echo $sub_dir | sed 's?.//*$??'`
                if [ "$sub_dir" = "" ]; then
                        sub_dir=fm$ver
                fi
                html_dir=$doc_root/$sub_dir
                if [ -d "$html_dir" ]; then
                        echo "ERROR: Directory already exists."
                        echo ""
                        exit
                fi
        fi
        if [ ! -d $html_dir ]; then
                mkdir $html_dir;
                chmod 750 $html_dir
                if [ $? != 0 ]; then
                        echo "ERROR: Failed to create directory $html_dir"
                        echo ""
                        exit
                fi
        fi
        html_prefix=`echo $html_dir | sed "s?^$doc_root??"`
        echo ""
	cgi_def=`echo $doc_root | sed 's?/html$?/cgi-bin?'`
        echo "***********************************************************************"
        echo "FileManager will place the CGI and Perl files into your web server"
        echo "cgi-bin (CGI) directory. You can also choose an alternate directory."
        echo ""
        printf "CGI directory [$cgi_def]: "
        read cgi_dir
        cgi_dir=`echo $cgi_dir | sed 's?.//*$??'`
        if [ "$cgi_dir" = "" ]; then
                cgi_dir=$cgi_def
        fi
        abspath=`echo $cgi_dir | grep "^/"`
        if [ "$abspath" = "" ]; then
                echo "CGI directory must be an absolute path"
                echo ""
                exit
        fi
        if [ ! -d "$cgi_dir" ]; then
                echo "ERROR: Unable to find directory: $cgi_dir"
                echo ""
                exit
        fi
        printf "URL prefix for cgi-bin directory [/cgi-bin]: "
        read cgi_prefix
        cgi_prefix=`echo $cgi_prefix | sed 's?//*$??'`
        if [ "$cgi_prefix" = "" ]; then
                cgi_prefix=/cgi-bin
        fi
        config_dir=$html_dir
        log_dir=$html_dir
fi
echo ""

if [ "$use_serv" = "1" ]; then
        # Ask for FileManager MiniServer config directory
        echo "***********************************************************************"
        echo "FileManager MiniServer uses separate directories for config and log files."
        echo "Typically you can just accept the defaults."
        echo ""
        def_config=$html_dir/etc
        printf "Config file directory [$def_config]: "
        read config_dir
        config_dir=`echo $config_dir | sed 's?.//*$??'`
        if [ "$config_dir" = "" ]; then
                config_dir=$def_config
        fi
        abspath=`echo $config_dir | grep "^/"`
        if [ "$abspath" = "" ]; then
                echo "Config directory must be an absolute path"
                echo ""
                exit
        fi
        if [ ! -d $config_dir ]; then
                mkdir $config_dir;
                if [ $? != 0 ]; then
                        echo "ERROR: Failed to create directory $config_dir"
                        echo ""
                        exit
                fi
        fi

        # Ask for log directory
        def_log=$html_dir/log
        printf "Log file directory    [$def_log]: "
        read log_dir
        log_dir=`echo $log_dir | sed 's?.//*$??'`
        if [ "$log_dir" = "" ]; then
                log_dir=$def_log
        fi
        abspath=`echo $log_dir | grep "^/"`
        if [ "$abspath" = "" ]; then
                echo "Log file directory must be an absolute path"
                echo ""
                exit
        fi
        if [ ! -d $log_dir ]; then
                mkdir $log_dir
                if [ $? != 0 ]; then
                        echo "ERROR: Failed to create directory $log_dir"
                        echo ""
                        exit
                fi
        fi

        echo ""
fi

# Ask if the command line should be disabled
echo "***********************************************************************"
echo "FileManager can disable the command line function which will minimize"
echo "security breaches and will also reduce the usefulness of the program."
echo "It's best to DISABLE this feature unless you are the only person that"
echo "will be using FileManager."
echo ""
printf "Disable command line (y/n) [y]? "
read allow_cmd
if [ "$allow_cmd" = "" ]; then
  allow_cmd="y"
fi
allow_cmd=`echo $allow_cmd | grep "^[yY]"`
if [ "$allow_cmd" != "" ]; then
  allow_cmd=0
else
  allow_cmd=1
fi
echo ""

# Ask for base directory
echo "***********************************************************************"
echo "FileManager can limit access by specifying a 'base' directory. Users"
echo "will not be able to access any directories above the 'base' directory."
echo "If you do not want to limit access, leave blank."
if [ "$allow_cmd" != "0" ]; then
        echo ""
        echo "WARNING: Since you have enabled the command line, access to other"
        echo "directories is possible via the command line."
fi
echo ""
printf "Base directory []: "
read base_dir
base_dir=`echo $base_dir | sed 's?.//*$??'`
if [ "$base_dir" = "" ]; then
        base_dir=/
fi
abspath=`echo $base_dir | grep "^/"`
if [ "$abspath" = "" ]; then
        echo "Base directory must be an absolute path"
        echo ""
        exit
fi
if [ ! -d $base_dir ]; then
        echo "ERROR: Base directory $base_dir not found"
        echo ""
        exit
fi

echo ""

# Ask for a link to basedir in the HTML area
echo "***********************************************************************"
echo "FileManager can provide a symbolic link to your base directory which"
echo "will allow viewing of images, text, and graphics files. While this"
echo "feature is very useful, it could potentially be a security risk."
echo "If this feature is disabled, only text files can be viewed."
echo ""
printf "Enable 'base' directory link (y/n) [y]? "
read nolink
if [ "$nolink" = "" ]; then
  nolink=y
fi
nolink=`echo $nolink | grep "^[yY]"`
if [ "$nolink" = "" ]; then
  nolink=n
else
  nolink=y
fi
echo ""

# Ask if the upload feature should be disabled
echo "***********************************************************************"
echo "FileManager can disable the file upload function which will minimize"
echo "disk allocation problems but will reduce the usefulness of the program."
echo ""
printf "Disable file upload (y/n) [n]? "
read allow_upl
if [ "$allow_upl" = "" ]; then
  allow_upl="n"
fi
allow_upl=`echo $allow_upl | grep "^[yY]"`
if [ "$allow_upl" != "" ]; then
  allow_upl=0
else
  allow_upl=1
fi
echo ""

# Ask for normal fontsize
echo "***********************************************************************"
echo "HTML font size renderings vary greatly from system to system. If your"
echo "users primarily use IE on Windows OS's try 10 as your default"
echo "font size. If you have mostly Macintosh users, try 14 as your default"
echo "size. If you have a mixture try 12. Users can change this parameter"
echo "parameter at run-time."
echo ""
font_size=10
printf "Default font size (8-18) [10]? "
read font_size
if [ "$font_size" = "" ]; then
  font_size=10
fi
if [ $font_size -lt 8 ]; then
  font_size=8
fi
if [ $font_size -gt 18 ]; then
  font_size=18
fi
echo ""

# Ask for Cookie Support
echo "***********************************************************************"
echo "FileManager includes support for Cookies which allows personalization"
echo "of most of the FileManager options. If you disable the cookie support"
echo "FileManager will still operate, but personal settings will not be saved"
echo "from session to session. Use of cookies requires the CGI::Cookie and"
echo "CGI.pm modules."
echo ""
printf "Disable cookie support (y/n) [n]? "
read no_cookie
if [ "$no_cookie" = "" ]; then
  no_cookie=n
fi
no_cookie=`echo $no_cookie | grep "^[yY]"`
if [ "$no_cookie" = "" ]; then
  no_cookie=""
else
  no_cookie=y
fi
echo ""

printf "Checking directories and required files .. "
# Ask for tmp directory
tmp_dir=/tmp
if [ ! -d $tmp_dir ]; then
        echo ""
        echo "***********************************************************************"
        echo "Setup cannot find your system /tmp directory. It is needed for"
        echo "temporary file storage."
        echo ""
        printf "Tmp file directory: "
        read tmp_dir
        tmp_dir=`echo $tmp_dir | sed 's?.//*$??'`
        abspath=`echo $tmp_dir | grep "^/"`
        if [ "$abspath" = "" ]; then
                echo "Tmp directory must be an absolute path"
                echo ""
                exit
        fi
        if [ ! -d $tmp_dir ]; then
                mkdir $tmp_dir
                if [ $? != 0 ]; then
                        echo "ERROR: Failed to create directory $tmp_dir"
                        echo ""
                        exit
                fi
        fi
fi
echo "Done"
echo ""

# Ask where Perl is installed
echo "***********************************************************************"
echo "FileManager is written entirely in Perl. Please enter the full path to"
echo "the Perl 5 interpreter on your system."
echo ""
if [ -x /usr/local/bin/perl ]; then
        perldef=/usr/local/bin/perl
elif [ -x /usr/bin/perl ]; then
        perldef=/usr/bin/perl
else
        perldef=""
fi
if [ "$perldef" = "" ]; then
        printf "Full path to Perl: "
        read perl
        if [ "$perl" = "" ]; then
                echo "ERROR: No path entered!"
                echo ""
                exit
        fi
else
        printf "Full path to Perl [$perldef]: "
        read perl
        if [ "$perl" = "" ]; then
                perl=$perldef
        fi
fi
echo ""

# Test Perl 
printf "Testing Perl .... "
if [ ! -x $perl ]; then
        echo "ERROR: Failed to find Perl at $perl"
        echo ""
        exit
fi
echo "ok"
printf "Test script ..... "
$perl -e 'print "foobar\n"' 2>/dev/null | grep foobar >/dev/null
if [ $? != "0" ]; then
        echo "ERROR: Failed to run test Perl script. Maybe $perl is"
        echo "not the Perl interpreter, or is not installed properly"
        echo ""
        exit
fi
echo "ok"
printf "Version check ... "
$perl -e 'exit ($] < 5.002 ? 1 : 0)'
if [ $? = "1" ]; then
        echo "ERROR: Detected old Perl version. FileManager requires"
        echo "Perl 5.002 or greater to run."
        echo ""
        exit
fi
echo "ok"
if [ "$use_serv" != "" ]; then
        printf "Socket check .... "
        $perl -e 'use Socket; print "foobar\n"' 2>/dev/null | grep foobar >/dev/null
        if [ $? != "0" ]; then
                echo "ERROR: Perl Socket module not installed. Maybe Perl has"
                echo "not been properly installed on your system"
                echo ""
                exit
        fi
        echo "ok"
        printf "crypt check ..... "
        $perl -e '$c = crypt("xx", "yy"); exit($c ? 0 : 1)'
        if [ $? != "0" ]; then
                echo "ERROR: Perl crypt function does not work. Maybe Perl has"
                echo "not been properly installed on your system"
                echo ""
                exit
        fi
        echo "ok"
fi

if [ "$no_cookie" = "" ]; then
        printf "Cookie check .... "
        $perl -e 'use CGI qw/:standard/; use CGI::Cookie; print "foobar\n"' 2>/dev/null | grep foobar >/dev/null
        if [ $? != "0" ]; then
                echo "failed"
                echo ""
                echo "WARNING: Perl CGI/Cookie modules not installed. Cookies will not be used."
                echo "Ask your system administrator to install cookie support;"
                echo "or if you are the sysadmin, as root issue the following command:"
                echo "    $perl -MCPAN -e 'install CGI::Cookie'"
                echo ""
                no_cookie=y
        else
                echo "ok"
        fi
fi

echo "Perl seems to be installed ok"
echo ""

# Ask for operating system type
echo "***********************************************************************"
if [ "$os_type" = "" ]; then
        $perl $dist_dir/oschooser.pl $dist_dir/os_list.txt $tmp_dir/$$.os $autoos
        if [ $? != 0 ]; then
                exit $?
        fi
        . $tmp_dir/$$.os
        rm -f $tmp_dir/$$.os
fi
echo "Operating system name:    $real_os_type"
echo "Operating system version: $real_os_version"
echo ""

if [ "$use_serv" = "1" ]; then

        # Ask for web server port, name and password
        echo "***********************************************************************"
        echo "FileManager will use its own password-protected web server to provide"
        echo "access to the cgi programs. The setup script needs to know:"
        echo " - What port to run the web server on. There must not be another"
        echo "   web server already using this port."
        echo " - The login name required to access the web server."
        echo " - The password required to access the web server."
        echo " - The hostname of this system that the web server should use."
        echo ""
        printf "Web server port [19002]: "
        if [ "$port" = "" ]; then
                read port
                if [ "$port" = "" ]; then
                        port=19002
                fi
        fi
        if [ $port -lt 1 ]; then
                echo "ERROR: $port is not a valid port number"
                echo ""
                exit
        fi
        if [ $port -gt 65535 ]; then
                echo "ERROR: $port is not a valid port number. Port numbers cannot be"
                echo "       greater than 65535"
                echo ""
                exit
        fi
        $perl -e 'use Socket; socket(FOO, PF_INET, SOCK_STREAM, getprotobyname("tcp")); setsockopt(FOO, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)); bind(FOO, sockaddr_in($ARGV[0], INADDR_ANY)) || exit(1); exit(0);' $port
        if [ $? != "0" ]; then
                echo "ERROR: TCP port $port is already in use by another program"
                echo ""
                exit
        fi
        if [ "$login" = "" ]; then
                printf "Login name [fmuser]: "
                read login
                if [ "$login" = "" ]; then
                        login="fmuser"
                fi
        fi
        if [ "$password" = "" -a "$crypt" = "" ]; then
                while [ "$password" = "" ]; do
                        printf "Login password: "
                        stty -echo
                        read password
                        stty echo
                        printf "\n"
                        if [ "$password" = "" ]; then
                                echo "You must enter a password."
                        fi
                done
                printf "Password again: "
                stty -echo
                read password2
                stty echo
                printf "\n"
                if [ "$password" != "$password2" ]; then
                        echo "ERROR: Passwords don't match"
                        echo ""
                        exit
                fi
        fi
        if [ "$defhost" = "" ]; then
          defhost=`hostname | sed 's/ //g'`
        fi
        printf "Web server hostname or ip address [$defhost]: "
        if [ "$host" = "" ]; then
                read host
                if [ "$host" = "" ]; then
                        host=$defhost
                fi
        fi


        # Create webserver config file
        echo "***********************************************************************"
        printf "Creating web server config files .... "
        cfile=$config_dir/fm_miniserv.conf
        echo "port=$port" >> $cfile
        echo "root=$cgi_dir" >> $cfile
        echo "host=$host" >> $cfile
        echo "mimetypes=$config_dir/fm_mime.types" >> $cfile
        echo "addtype_cgi=internal/cgi" >> $cfile
        echo "realm=FileManager Server" >> $cfile
        echo "logfile=$log_dir/fm_miniserv.log" >> $cfile
        echo "pidfile=$log_dir/fm_miniserv.pid" >> $cfile
        echo "logtime=168" >> $cfile
        echo "ppath=$ppath" >> $cfile
        echo "logout=$config_dir/fm_logout-flag" >> $cfile
        echo "listen=$port" >> $cfile
        echo "denyfile=\\.pl\$" >> $cfile
        if [ "$allow" != "" ]; then
                echo "allow=$allow" >> $cfile
        fi

        ufile=$config_dir/fm_miniserv.users
        if [ "$crypt" != "" ]; then
                echo "$login:$crypt:0" > $ufile
        else
                $perl -e 'print "$ARGV[0]:",crypt($ARGV[1], "XX"),":0\n"' "$login" "$password" > $ufile
        fi
        echo "userfile=$ufile" >> $cfile
        echo "done"
fi

# Copy files
printf "Copying files  ...................... "
if [ ! -d $html_dir/fm_images ]; then
  mkdir $html_dir/fm_images
fi
cp $dist_dir/images/* $html_dir/fm_images
cp $dist_dir/menus.js $html_dir/fm_menus.js

sed 's#require ".\/preferences.pl";#require "'$cgi_dir'/fm_preferences.pl";#' $dist_dir/main.pl > $cgi_dir/fm.cgi
sed 's#require ".\/preferences.pl";#require "'$cgi_dir'/fm_preferences.pl";#' $dist_dir/editor.pl > $cgi_dir/fm_editor.cgi
cp $dist_dir/cgi-lib.pl $cgi_dir/fm_cgi.pl
if [ "$use_serv" = "1" ]; then
        cp $dist_dir/miniserv.pl $cgi_dir/fm_miniserv.pl
fi

echo $ver > $config_dir/fm_version.txt
cp $dist_dir/mime.types $config_dir/fm_mime.types

echo "done"

# Update Perl path
printf "Inserting Perl path into scripts .... "
$perl $dist_dir/perlpath.pl $perl $cgi_dir/fm.cgi $cgi_dir/fm_editor.cgi $cgi_dir/fm_miniserv.pl
echo "done"

# Add symbolic link
if [ "$nolink" = "y" ]; then
  printf "Linking base directory .............. "
  base_link=fm_baselink
  ln -s $base_dir $html_dir/$base_link
  if [ $? != 0 ]; then
    printf "failed - Continuing ... "
    base_link=""
  else
    if [ "$sub_dir" != "" ]; then
      base_link=$sub_dir/$base_link
    fi
  fi
  echo "done"
fi

# Update preference file
printf "Updating preference file ............ "
$perl $dist_dir/updpref.pl "$dist_dir" "$base_dir" "$tmp_dir" "$html_prefix" "$cgi_dir" "$cgi_prefix" "$real_os_type" "$real_os_version" "$allow_cmd" "$font_size" "$base_link" "$config_dir/fm_mime.types" "$no_cookie" "$allow_upl" "$cprd"
if [ $? != "0" ]; then
        echo "ERROR: Preference file update error."
        echo ""
        exit
fi
echo "done"

if [ "$use_serv" = "1" ]; then
        printf "Creating server start/stop scripts .. "
        start_file=$config_dir/fm_start
        stop_file=$config_dir/fm_stop
        rm -f $stop_file $start_file

        echo "#!/bin/sh" >$start_file
        echo "echo Starting FileManager server in $cgi_dir" >>$start_file
        echo "$cgi_dir/fm_miniserv.pl $config_dir/fm_miniserv.conf" >>$start_file

        echo "#!/bin/sh" >$stop_file
        echo "echo Stopping FileManager server in $cgi_dir" >>$stop_file
        echo "kill \`cat $log_dir/fm_miniserv.pid\`" >>$stop_file
        echo "done"
fi

printf "Changing permissions ................ "
chmod 775 $html_dir
chmod 755 $cgi_dir/fm.cgi $cgi_dir/fm_editor.cgi
chmod 664 $cgi_dir/fm_preferences.pl $cgi_dir/fm_cgi.pl
chmod 755 $html_dir/fm_images
if [ "$use_serv" = "1" ]; then
        chmod 755 $cgi_dir/fm_miniserv.pl $start_file $stop_file
        chmod 664 $cfile $ufile $config_dir/fm_version.txt $config_dir/fm_mime.types
fi

echo "done"
echo ""

echo "***********************************************************************"
if [ "$use_serv" = "1" ]; then
	echo "Attempting to start FileManager MiniServer .. "
        cd $config_dir
	$start_file
	if [ $? != "0" ]; then
		echo "ERROR: Failed to start FileManager MiniServer"
		echo ""
		exit
	fi
	echo "FileManager has been installed and started successfully."
        echo ""
        echo "To customize the FileManager (recommended), edit the file"
        echo "  $cgi_dir/fm_preferences.pl"
        echo ""
        echo "To stop the FileManager MiniServer enter the command"
        echo "  $stop_file"
        echo ""
        echo "To restart the FileManager MiniServer enter the command"
        echo "  $start_file"
        echo ""
        echo "To access the FileManager, use your web browser to go to"
	echo ""
	echo "  http://$host:$port/fm.cgi"
	echo ""
	echo "and log in with the name and password you entered previously."
else
        echo "FileManager has been installed successfully."
        echo ""
        echo "To customize the FileManager (recommended), edit the file"
        echo "  $cgi_dir/fm_preferences.pl"
        echo ""
        echo "Use your web browser to access FileManager using"
        echo "  $cgi_prefix/fm.cgi"
fi
echo "***********************************************************************"
echo ""
