[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/misc Install.pm,1.10,1.11
From: |
Ambrose Li |
Subject: |
[Koha-cvs] CVS: koha/misc Install.pm,1.10,1.11 |
Date: |
Fri, 24 Jan 2003 22:38:10 -0800 |
Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv19349/misc
Modified Files:
Install.pm
Log Message:
Factored all the "mkdir -p"-like code in getinstalldirectories into a
function (actually a dirname-like function and a "mkdir -p"-like function).
Note: This introduces a POSIX.pm dependence.
Index: Install.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/Install.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** Install.pm 22 Jan 2003 13:43:06 -0000 1.10
--- Install.pm 25 Jan 2003 06:38:08 -0000 1.11
***************
*** 20,23 ****
--- 20,24 ----
use strict;
+ use POSIX;
require Exporter;
***************
*** 220,233 ****
! #
! # Assuming that Koha will be installed on a modern Unix with symlinks,
! # it is possible to code the installer so that aborted installs can be
! # detected. In case of such an event we can do our best to "roll back"
! # the aborted install.
! #
! # FIXME: The "roll back" is not complete!
! #
! sub checkabortedinstall {
if (-l("$::etcdir/koha.conf")
&& readlink("$::etcdir/koha.conf") =~ /\.tmp$/
--- 221,289 ----
! =item dirname
!
! dirname $path;
!
! Does the equivalent of dirname(1). Given a path $path, return the
! parent directory of $path (best guess), except when $path seems to
! be the same as /, in which case $path itself is returned unchanged.
!
! =cut
!
! sub dirname ($;$) {
! my($path) = @_;
! if ($path =~ /[^\/]/s) {
! if ($path =~ /\//) {
! $path =~ s/\/+[^\/]+\/*$//s;
! } else {
! $path = '.';
! }
! }
! return $path;
! }
!
! =item mkdir_parents
!
! mkdir_parents $path;
! mkdir_parents $path, $mode;
!
! Does the equivalent of mkdir -p. Given a path $path, create the path
! $path, recursively creating any intermediate directories. If $mode
! is given, the directory will be created with mode $mode.
!
! WARNING: If $path already exists, mkdir_parents will just return
! successfully (just like mkdir -p), whether the mode of $path conforms
! to $mode or not.
! =cut
!
! sub mkdir_parents ($;$) {
! my($path, $mode) = @_;
! my $ok = -d($path)? 1: defined $mode? mkdir($path, $mode): mkdir($path);
!
! if (!$ok && $! == ENOENT) {
! my $parent = dirname($path);
! $ok = mkdir_parents($parent, $mode);
!
! # retry and at the same time make sure that $! is set correctly
! $ok = defined $mode? mkdir($path, $mode): mkdir($path);
! }
! return $ok;
! }
!
! =item checkabortedinstall
!
! checkabortedinstall;
!
! Assuming that Koha will be installed on a modern Unix with symlinks,
! it is possible to code the installer so that aborted installs can be
! detected. In case of such an event we can do our best to "roll back"
! the aborted install.
!
! FIXME: The "roll back" is not complete!
!
! =cut
!
! sub checkabortedinstall () {
if (-l("$::etcdir/koha.conf")
&& readlink("$::etcdir/koha.conf") =~ /\.tmp$/
***************
*** 440,506 ****
unless ( -d $::intranetdir ) {
! my $result=mkdir ($::intranetdir, oct(770));
! if ($result==0) {
! my @dirs = split(m#/#, $::intranetdir);
! my $checkdir='';
! foreach (@dirs) {
! $checkdir.="$_/";
! unless (-e "$checkdir") {
! mkdir($checkdir, 0775);
! }
! }
! }
chown (oct(0), (getgrnam($::httpduser))[2], "$::intranetdir");
chmod (oct(770), "$::intranetdir");
}
! unless ( -d "$::intranetdir/htdocs" ) {
! mkdir ("$::intranetdir/htdocs", oct(750));
! }
! unless ( -d "$::intranetdir/cgi-bin" ) {
! mkdir ("$::intranetdir/cgi-bin", oct(750));
! }
! unless ( -d "$::intranetdir/modules" ) {
! mkdir ("$::intranetdir/modules", oct(750));
! }
! unless ( -d "$::intranetdir/scripts" ) {
! mkdir ("$::intranetdir/scripts", oct(750));
! }
unless ( -d $::opacdir ) {
! my $result=mkdir ($::opacdir, oct(770));
! if ($result==0) {
! my @dirs = split(m#/#, $::opacdir);
! my $checkdir='';
! foreach (@dirs) {
! $checkdir.="$_/";
! unless (-e "$checkdir") {
! mkdir($checkdir, 0775);
! }
! }
! }
chown (oct(0), (getgrnam($::httpduser))[2], "$::opacdir");
chmod (oct(770), "$::opacdir");
}
! unless ( -d "$::opacdir/htdocs" ) {
! mkdir ("$::opacdir/htdocs", oct(750));
! }
! unless ( -d "$::opacdir/cgi-bin" ) {
! mkdir ("$::opacdir/cgi-bin", oct(750));
! }
unless ( -d $::kohalogdir ) {
! my $result=mkdir ($::kohalogdir, oct(770));
! if ($result==0) {
! my @dirs = split(m#/#, $::kohalogdir);
! my $checkdir='';
! foreach (@dirs) {
! $checkdir.="$_/";
! unless (-e "$checkdir") {
! mkdir($checkdir, 0775);
! }
! }
! }
!
chown (oct(0), (getgrnam($::httpduser))[2,3], "$::kohalogdir");
chmod (oct(770), "$::kohalogdir");
--- 496,523 ----
+ # FIXME: Missing error handling for all mkdir calls here
unless ( -d $::intranetdir ) {
! mkdir_parents (dirname($::intranetdir), 0775);
! mkdir ($::intranetdir, 0770);
chown (oct(0), (getgrnam($::httpduser))[2], "$::intranetdir");
chmod (oct(770), "$::intranetdir");
}
! mkdir_parents ("$::intranetdir/htdocs", 0750);
! mkdir_parents ("$::intranetdir/cgi-bin", 0750);
! mkdir_parents ("$::intranetdir/modules", 0750);
! mkdir_parents ("$::intranetdir/scripts", 0750);
unless ( -d $::opacdir ) {
! mkdir_parents (dirname($::opacdir), 0775);
! mkdir ($::opacdir, 0770);
chown (oct(0), (getgrnam($::httpduser))[2], "$::opacdir");
chmod (oct(770), "$::opacdir");
}
! mkdir_parents ("$::opacdir/htdocs", 0750);
! mkdir_parents ("$::opacdir/cgi-bin", 0750);
unless ( -d $::kohalogdir ) {
! mkdir_parents (dirname($::kohalogdir), 0775);
! mkdir ($::kohalogdir, 0770);
chown (oct(0), (getgrnam($::httpduser))[2,3], "$::kohalogdir");
chmod (oct(770), "$::kohalogdir");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/misc Install.pm,1.10,1.11,
Ambrose Li <=