From efdd5965c477616be56b9f56a8613645ff2dac41 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 19 Apr 2004 15:02:11 +0000 Subject: when creating directories, keep rights & uid & gid (esp. for armagetron) --- move/collect-directories-to-create.pl | 12 +++++------- move/move.pm | 7 ++++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/move/collect-directories-to-create.pl b/move/collect-directories-to-create.pl index c6e208c57..7a5cfd283 100755 --- a/move/collect-directories-to-create.pl +++ b/move/collect-directories-to-create.pl @@ -7,11 +7,9 @@ use MDK::Common; #- in which they try to write doesn't exist. better collect them #- at build time so that drakx startup can create them. -my @list = map { if_(m|^\Q$ARGV[0]\E(.*)$|, $1) } `find $ARGV[0]/{etc,var} -type d`; -my @final; -foreach my $e (sort { length($b) <=> length($a) } @list) { - any { /^\Q$e\E/ } @final and next; - push @final, $e; +chdir $ARGV[0]; +foreach (`find etc var -type d`) { + chomp; + my @l = stat($_); + printf "%o %d %d %s\n", $l[2] & 07777, $l[4], $l[5], $_; } - -print "$_\n" foreach sort @final; diff --git a/move/move.pm b/move/move.pm index 56b495dcf..04105b6a0 100644 --- a/move/move.pm +++ b/move/move.pm @@ -140,7 +140,12 @@ sub init { #- create remaining /etc and /var subdirectories if not already copied or symlinked, #- because programs most often won't try to create the missing subdir before trying #- to write a file, leading to obscure unexpected failures - -d $_ or mkdir_p $_ foreach chomp_(cat_('/image/move/directories-to-create')); + foreach (cat_('/image/move/directories-to-create')) { + my ($mode, $uid, $gid, $name) = split; + next if -d $name; + mkdir($name, oct($mode)); + chown($uid, $gid, $name); + } chmod 01777, '/tmp', '/var/tmp'; #- /var/tmp -> badly needed for printing from OOo -- cgit v1.2.1