NAME
    FML::Install - utility functions used in installation.

SYNOPSIS
        # use FML::Install;
        my $installer = new FML::Install;
        my $config    = $installer->load_install_cf( $cf );

        printf $format, "version", $installer->get_version() if $debug;

        my $list = $config->get_as_array_ref('mandatory_dirs');
        for my $dir (@$list) {
            my $path = $installer->path($dir);
            printf $format, $dir, $path if $debug;
            unless (-d $path) {
                $installer->mkdir($path);
            }
            else {
                print STDERR "ok $path\n" if $debug;
            }
        }

        $installer->install_main_cf();
        $installer->install_sample_cf_files();
        $installer->install_default_config_files();
        $installer->install_mtree_dir();
        $installer->install_compat_dir();
        $installer->install_lib_dir();
        $installer->install_libexec_dir();
        $installer->install_data_dir();

        # install programs hereafter.
        $installer->install_bin_programs();

        # update loader.
        if ( $installer->need_resymlink_loader() ) {
            $installer->install_loader();
            $installer->resymlink_loader();
        }

        # set up ml_spool_dir such as /var/spool/ml if needed.
        $installer->setup_ml_spool_dir();

DESCRIPTION
    Our installer "install.pl" at the fml8 source top directory uses this
    module.

METHODS
  new()
    constructor.

CONFIG
  load_install_cf( $cf )
    read the specified config file, initialize and return config object.

INSTALL METHODS
  convert($src, $dst, [$mode])
    create $dst with variable substitutions. In addition, chmod() if $mode
    specified.

  install_main_cf()
    install main.cf e.g. /etc/fml/main.cf.

  install_sample_cf_files()
    install sample .cf files:

        site_default_config.cf
        mime_component_filter

  install_default_config_files()
    install default templates at /etc/fml/defautls/$version/.

  install_mtree_dir()
    install mtree info at /etc/fml/defautls/$version/mtree/.

  install_compat_dir()
    install compat info at /etc/fml/defautls/$version/compat/.

  install_lib_dir()
    install library (perl modules).

  install_libexec_dir()
    install libexec executables.

  install_data_dir()
    install files under fml/share/.

  install_bin_programs()
    install utitily programs typically located at /usr/local/bin.

LOADER
  need_resymlink_loader()
    check if we need to update loader symlink?

  install_loader()
    install loader.

  resymlink_loader()
    re-symlink loader.

SET UP ML SPOOL
  setup_ml_spool_dir()
    set up $ml_spool_dir e.g. /var/spool/ml.

UTILITY FUNCTIONS
  get_version()
    return fml version. return current-YYYYMMDD if ".version" file is not
    found.

  is_run_as_root()
    check if the current process runs as root.

  is_valid_owner( $owner )
    check if $owner is a valid user ?

  is_valid_group( $group )
    check if $group is a valid group ?

  path( $dir )
    return the absolute directory path for the specified type $dir.

UTILITY FUNCTIONS FOR FILE HANDLING
  mkdir( $dir, [$mode] )
    mkdir $dir with the mode $mode if $mode specified. Whereas, mkdir $dir
    with the mode 0755 if $mode unspecified.

  copy_dir( $src_dir, $dst_dir )
    copy files recursively.

  chown( $owner, $group, $dir )
    chown $owner:$group $dir.

  md5( $file )
    return MD5 checksum for the file.

MESSAGE MANIPULATION
  message_nl($clss, $default_msg)
    return message by natural language.

  enable_message()
    enable verbose message output.

  disable_message()
    disable verbose message output.

CODING STYLE
    See "http://www.fml.org/software/FNF/" on fml coding style guide.

AUTHOR
    Ken'ichi Fukamachi

COPYRIGHT
    Copyright (C) 2003,2004,2005,2007,2008,2010,2011 Ken'ichi Fukamachi

    All rights reserved. This program is free software; you can redistribute
    it and/or modify it under the same terms as Perl itself.

HISTORY
    FML::Install appeared in fml8 mailing list driver package. See
    "http://www.fml.org/" for more details.

