Browse Source

Added home_builder so that personal dirs are created in $tmp for each user and

return value when rebuilddb or initdb present themselves.
master
freesource 23 years ago
parent
commit
e1b6276caf
  1. 28
      SWIM/Conf.pm
  2. 8
      SWIM/DB_Init.pm

28
SWIM/Conf.pm

@ -238,7 +238,9 @@ $longswim = "$pre/lib/SWIM/longswim";
# explanation for making such a disk. There is also # explanation for making such a disk. There is also
# /usr/src/kernel-source.version/Documentation. Whether this will speed # /usr/src/kernel-source.version/Documentation. Whether this will speed
# things up is a subject of experimentation. # 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 # # MAIN CONFFILES #
@ -466,6 +468,30 @@ if (!-d $swim_conf) {
please make the directories which are needed.\n"; 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; 1;
__END__ __END__

8
SWIM/DB_Init.pm

@ -109,7 +109,7 @@ sub database {
if (-e "$main::home$parent$library/packages.deb" && if (-e "$main::home$parent$library/packages.deb" &&
-e "$main::home$parent$library/fileindex.deb") { -e "$main::home$parent$library/fileindex.deb") {
print STDERR "swim: use --rebuilddb\n"; print STDERR "swim: use --rebuilddb\n";
exit; return "rebuilddb";
} }
else { else {
# if a database happens to be missing # if a database happens to be missing
@ -156,7 +156,7 @@ sub database {
} }
else { else {
print STDERR "swim: use --initdb to create databases\n"; 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" && if (-e "$main::home$parent$base/packages.deb" &&
-e "$main::home$parent$base/fileindex.deb") { -e "$main::home$parent$base/fileindex.deb") {
print STDERR "swim: use --rebuilddb\n"; print STDERR "swim: use --rebuilddb\n";
exit; return "rebuilddb";
} }
else { else {
# if a database happens to be missing # if a database happens to be missing
@ -212,7 +212,7 @@ sub database {
} }
else { else {
print STDERR "swim: use --initdb to create databases\n"; print STDERR "swim: use --initdb to create databases\n";
exit; return "initdb";
} }
} }
} }

Loading…
Cancel
Save