From e1b6276cafc720ffb567fa0dd3ebfcf3c3540b63 Mon Sep 17 00:00:00 2001 From: freesource Date: Sun, 14 Oct 2001 19:55:34 +0000 Subject: [PATCH] Added home_builder so that personal dirs are created in $tmp for each user and return value when rebuilddb or initdb present themselves. --- SWIM/Conf.pm | 28 +++++++++++++++++++++++++++- SWIM/DB_Init.pm | 8 ++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/SWIM/Conf.pm b/SWIM/Conf.pm index 971097d..505c038 100644 --- a/SWIM/Conf.pm +++ b/SWIM/Conf.pm @@ -238,7 +238,9 @@ $longswim = "$pre/lib/SWIM/longswim"; # explanation for making such a disk. There is also # /usr/src/kernel-source.version/Documentation. Whether this will speed # things up is a subject of experimentation. -$tmp = '/tmp'; +my $tmp_home = substr($main::home,1,); +$tmp = "/tmp/.gbootroot_$tmp_home"; +home_builder($tmp); ################## # MAIN CONFFILES # @@ -466,6 +468,30 @@ if (!-d $swim_conf) { please make the directories which are needed.\n"; } + +# Pulled this from *_pkg from the gbootroot project. +sub home_builder { + + my ($home_builder) = @_; + + if (!-d $home_builder) { + if (-e $home_builder) { + print "ERROR: A file exists where $home_builder should be.\n"; + } + else { + my @directory_parts = split(m,/,,$home_builder); + my $placement = "/"; + for (1 .. $#directory_parts) { + $_ == 1 ? ($placement = "/$directory_parts[$_]") + : ($placement = $placement . "/" . $directory_parts[$_]); + -d $placement or mkdir $placement; + } + } + } + +} # end home_builder + + 1; __END__ diff --git a/SWIM/DB_Init.pm b/SWIM/DB_Init.pm index 4c67607..bd26f52 100644 --- a/SWIM/DB_Init.pm +++ b/SWIM/DB_Init.pm @@ -109,7 +109,7 @@ sub database { if (-e "$main::home$parent$library/packages.deb" && -e "$main::home$parent$library/fileindex.deb") { print STDERR "swim: use --rebuilddb\n"; - exit; + return "rebuilddb"; } else { # if a database happens to be missing @@ -156,7 +156,7 @@ sub database { } else { print STDERR "swim: use --initdb to create databases\n"; - exit; + return "initdb"; } } } @@ -165,7 +165,7 @@ sub database { if (-e "$main::home$parent$base/packages.deb" && -e "$main::home$parent$base/fileindex.deb") { print STDERR "swim: use --rebuilddb\n"; - exit; + return "rebuilddb"; } else { # if a database happens to be missing @@ -212,7 +212,7 @@ sub database { } else { print STDERR "swim: use --initdb to create databases\n"; - exit; + return "initdb"; } } }