BackupPC-users

Re: [BackupPC-users] __TOPDIR__ and $Conf{TopDir}

2009-11-25 19:47:57
Subject: Re: [BackupPC-users] __TOPDIR__ and $Conf{TopDir}
From: Holger Parplies <wbppc AT parplies DOT de>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>, Steve <leperas AT gmail DOT com>, Pieter Wuille <sipa AT users.sourceforge DOT net>
Date: Thu, 26 Nov 2009 01:21:44 +0100
Hi,

Tino Schwarze wrote on 2009-11-24 23:40:13 +0100 [Re: [BackupPC-users] 
__TOPDIR__ and $Conf{TopDir}]:
> PS: Maybe there should be a prominent note just at the $Config{TopDir}
> setting in config.pl? And a like to the wiki article?

as far as that statement goes, you are correct. There should be, but there
isn't for older versions of BackupPC. Aside from that, pretty much all points
made in this thread are obsolete, as BackupPC 3.2.0beta0 fixes the issue.
Starting with this version, it should in fact be possible to change TopDir
just by setting $Conf{TopDir} (no, I haven't tried it out ...).

You need to be aware of the fact, though, that BackupPC can't magically locate
config.pl through a setting inside the file itself. Older versions of BackupPC
put config.pl in $TopDir/conf/, and newer versions of BackupPC are backwards
compatible to this state. If that is how your config.pl is located, you've got
a chicken-and-egg problem, but that doesn't mean 3.2.0beta0 won't let you
change your storage location just by setting $Conf{TopDir} (see below).
FHS-compatible BackupPC installations (probably including just about all
packaged versions) put config.pl somewhere under /etc, which is obviously not
related to $TopDir, so these cases should be safe.

Steve wrote on 2009-11-24 17:49:37 -0500 [Re: [BackupPC-users] __TOPDIR__ and 
$Conf{TopDir}]:
> I agree - almost every "newbie" that picks up BackupPC makes this
> mistake - the more experienced you are with old-school config files
> the MORE likely you are to assume changing this is all you need to do.
>  A note in the docs and/or a link to the "how to change your TOP DIR"
> page would fix a huge percentage of installation failures.

Yes, but this note would be put into versions of BackupPC > 3.2.0beta0, for
which it no longer applies. There's not much point in releasing updated older
versions just to include a comment in config.pl.

3.2.0beta0 config.pl even states:

# Instead of changing TopDir here it is recommended that you use
# a symbolic link to the new location, or mount the new BackupPC
# store at the existing $Conf{TopDir} setting.

Especially for packaged versions it makes sense to stick with what the package
(possibly modified code vs. the SF version) and your package manager expect.

> Or just fixing it so changing the config file IS all you have to do :)

That is definitely the better approach, and it has been taken.

Pieter Wuille wrote on 2009-11-25 00:05:00 +0100 [Re: [BackupPC-users] 
__TOPDIR__ and $Conf{TopDir}]:
> If they need to be the same, why do we need the configuration option in the
> first place?

That is also mentioned in 3.2.0beta0 config.pl:

# Note: it is STRONGLY recommended that you don't change the
# values here.  These are set at installation time and are here
# for reference and are used during upgrades.

In more detail: if you install and upgrade with the SF tarball, your upgrades
use these settings so you don't have to enter corresponding (correct) values
for each upgrade. This is probably also subject to the necessity of the
installation/upgrade script finding config.pl, but I believe there's an option
to specify its location.

Tino Schwarze wrote on 2009-11-25 18:07:35 +0100 [Re: [BackupPC-users] 
__TOPDIR__ and $Conf{TopDir}]:
> I'm not talking about installation time.

Well, you should be *thinking* about installation time (or rather: upgrade
time) ;-).

> I figure it works like this:
> - someone calls BackupPC::new()
> - it takes it's patched-in $TopDir to locate config.pl

Not for newer versions where it's $ConfDir (for which the restriction still
applies, that you can't change it via $Conf{ConfDir} in config.pl).

> - it reads config.pl
> - so what's $Config{TopDir} good for except for confusing users?

Well, it already was partly used for access to $TopDir *after* reading the
configuration file(s) (you remember the backup data, right? ;-). It now should
be used *completely*, i.e. for all access to $TopDir, except perhaps for
configuration file location. That means that *even if* your config.pl is
located as $TopDir/conf/config.pl, you would, for BackupPC versions >=
3.2.0beta0, be able to move your $TopDir *except for the config files* by
setting $Conf{TopDir}. This might be a bit confusing, because you would have

        $OldTopDir/conf/config.pl
        $NewTopDir/everything_else

(not sure where the pc config files would be found - probably under
$NewTopDir), but the main point usually seems to be moving the pool system to
a different storage location, and that should work in any case (again: for >=
3.2.0beta0).

Note that even if your main config file is $TopDir/conf/config.pl it *might*
be found as $ConfDir/config.pl (with a value $ConfDir = "$TopDir/conf"). That
depends on your version of BackupPC and the setting of useFHS (patched into
BackupPC::Lib).

> I'd suggest just removing the setting from config.pl - the code calling
> it should already know the correct setting - it's been patched in, isn't
> it? Having it in config.pl will only confuse users since they expect it
> is easy to change - so let's config.pl reflect what's really going on:
> You cannot change it just here.

See above. The settings are needed, and apart from ConfDir they should now be
changeable here. Probably even ConfDir is changeable here, except that it
can't affect locating the main configuration file (just the pc config files,
if you were wondering what the point would be).

Regards,
Holger

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/