From 83a495a48d67eb561d86b52fec830c2a4d7d65cf Mon Sep 17 00:00:00 2001 From: fukachan Date: Wed, 29 Jan 2003 14:22:53 +0000 Subject: check if we runs as root. --- install.pl.in | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/install.pl.in b/install.pl.in index a217bfc3..eb30fc57 100755 --- a/install.pl.in +++ b/install.pl.in @@ -5,7 +5,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: install.pl.in,v 1.1 2003/01/28 04:16:16 fukachan Exp $ +# $FML: install.pl.in,v 1.2 2003/01/29 13:58:10 fukachan Exp $ # use strict; @@ -64,23 +64,28 @@ sub _install $installer->is_valid_owner( $config->{ owner } ); $installer->is_valid_group( $config->{ group } ); - $installer->install_main_cf(); - $installer->install_sample_cf_files(); - $installer->install_default_config_files(); - $installer->install_mtree_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(); - } + if ($installer->is_run_as_root()) { + $installer->install_main_cf(); + $installer->install_sample_cf_files(); + $installer->install_default_config_files(); + $installer->install_mtree_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(); + # set up ml_spool_dir such as /var/spool/ml if needed. + $installer->setup_ml_spool_dir(); + } + else { + croak("Error: run $0 as root.\n"); + } } -- cgit v1.2.1