Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure.pl: Introduce --config-only option (#15) #62

Merged
merged 1 commit into from Mar 15, 2017

Conversation

moisseev
Copy link
Member

This adds ability to skip installation phase and intended for using mostly
by packagers. It is assumed that the OS distribution package should install
configure.pl somewhere and provide a wrapper script for users like:

#!/bin/sh

PERL5LIB=/usr/local/lib

perl %%PREFIX%%/libexec/backuppc/configure.pl \
    --config-only
    --bin-path perl=%%PREFIX%%/bin/perl \
    --config-dir %%ETCDIR%% \
    --cgi-dir %%CGIDIR%% \
    --data-dir /var/db/BackupPC \
    --fhs \
    --html-dir %%WWWDIR%% \
    --html-dir-url /backuppc \
    --install-dir %%PREFIX%% \
    --log-dir /var/log/BackupPC

This adds ability to skip installation phase and intended for using mostly
by packagers. It is assumed that the OS distribution package should install
configure.pl somewhere and provide a wrapper script for users like:

```sh

PERL5LIB=/usr/local/lib

perl %%PREFIX%%/libexec/backuppc/configure.pl \
    --config-only
    --bin-path perl=%%PREFIX%%/bin/perl \
    --config-dir %%ETCDIR%% \
    --cgi-dir %%CGIDIR%% \
    --data-dir /var/db/BackupPC \
    --fhs \
    --html-dir %%WWWDIR%% \
    --html-dir-url /backuppc \
    --install-dir %%PREFIX%% \
    --log-dir /var/log/BackupPC
```

printf("Installing config.pl and hosts in $DestDir$Conf{ConfDir}\n");
InstallFile("conf/hosts", "$DestDir$Conf{ConfDir}/hosts", 0644)
InstallFile("conf/hosts", "$DestDir$Conf{ConfDir}/hosts.sample", 0644)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the creation of hosts.sample, which happens when !$opts{"config-only"}. Why?

Similarly for config.pl.sample. If !$opts{"config-only"}, it seems they get created, but not used. If $opts{"config-only"}, they don't get created, but they do get used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all about making configure.pl more package friendly.

  1. In general the configure.pl script is executed at package creation time and installs the program into a staging directory.

  2. The preinstalled program files distributed as a package. A package installation is a basically copying that files into proper places on the hosts file sysytem.

  3. After the package is installed user needs to run configure.pl again to upgrade config.pl from previous version (and maybe to configure new installation).
    This time we should use --config-only option to skip installation phase.

Since configure.pl uses conf/config.pl and BackupPC source code or distribution is not available, we should add conf/config.pl to the package and install it somewhere.

It is a common good practice to provide sample configuration files that could be used by user as a reference or to fall back to default configuration.
Basically they are copies of configuration files installed by a package.

My idea is we can have config.pl.sample for both [3] and as a sample. That is why it gets created if !$opts{"config-only"} and used if !$opts{"config-only"}.

hosts.sample doesn't needed for configure.pl, it is just a sample file. So, it should be created only once at installation time.

I know it is not an elegant solution, but it doesn't involves major rewriting of the configure.pl and will substantially simplify creation of BackupPC packages. That is very complicated for now since configure.pl makes modifications at once in program and configuration files.

@craigbarratt craigbarratt merged commit eed043c into backuppc:master Mar 15, 2017
@craigbarratt
Copy link
Contributor

Ok thanks for the explanation. I merged this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants