Talk:Setup-storage

From FAIWiki
Revision as of 17:45, 19 February 2008 by PaulLussier (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
and in /srv/fai/config/store/setup-storage you need to have line 77 as follows
  unshift @INC, "/var/lib/fai/config/store/lib";

Have you considered this instead?

use lib ""/var/lib/fai/config/store/lib";


Which will then allow you to have an entire FAI:: namespace down that path? Unless you wrap the 'unshift' into a BEGIN{} block, it happens at run-time (which is too late), not compile time like 'use lib'. BEGIN blocks are ugly and tough to debug, where as 'use lib' falls into the natural order/perly of doing things.

It might even be better to put the config-store libs in a central place that all of FAI can find them, possibly in /usr/lib/fai, which gets rolled into the NFSROOT. You can then do things like:

 use FindBin;
 use lib dirname(abs_path($FindBin::RealScript)) . "/../lib";
 use lib "$FindBin/../lib";
 use FAI::Config::Store;
 my $bin = $FindBin::Bin;

if you needed to. This allows for an FAI/ subdir some place relative where the script running lives, and provides a location for an entire FAI:: namespace.

Additionally, in setup-storage, there is the following:

 require "init.pm";
 require "volumes.pm";
 require "parser.pm";
 require "sizes.pm";
 require "commands.pm";
 require "fstab.pm";
 require "exec.pm";

Which seems to be an attempt to get around the fact that the 'unshift @INC' is a runtime operator. If the unshift were converted to a "use lib", all the requires could be converted to 'use' statements as well, and all this would happen at compile time where it's supposed to.

Just some thoughts.

-- PaulLussier