FreeBSD Bugzilla – Attachment 146290 Details for
Bug 192403
sysutils/backuppc overwrites config files upon upgrade
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch: add update script, change port options
51f229aa1c42c00512698c5bbf18fe85a65004a3...master.diff (text/plain), 15.89 KB, created by
Alexander Moisseev
on 2014-08-26 06:38:31 UTC
(
hide
)
Description:
patch: add update script, change port options
Filename:
MIME Type:
Creator:
Alexander Moisseev
Created:
2014-08-26 06:38:31 UTC
Size:
15.89 KB
patch
obsolete
>diff --git a/sysutils/backuppc/Makefile b/sysutils/backuppc/Makefile >index 5edf9a7..5565be1 100644 >--- a/sysutils/backuppc/Makefile >+++ b/sysutils/backuppc/Makefile >@@ -3,7 +3,7 @@ > > PORTNAME= backuppc > PORTVERSION= 3.3.0 >-PORTREVISION= 4 >+PORTREVISION= 5 > CATEGORIES= sysutils > MASTER_SITES= SF > MASTER_SITE_SUBDIR= ${PORTNAME}/${PORTNAME}/${PORTVERSION} >@@ -23,15 +23,14 @@ USE_RC_SUBR= backuppc > > USES= perl5 > NO_BUILD= yes >-NO_PACKAGE= Overwrites configuration files; set FORCE_PACKAGE if you want\ >- to build this package > > USERS= backuppc > GROUPS= backuppc > > CGIDIR?= ${PREFIX}/www/cgi-bin > >-SUB_FILES= pkg-deinstall pkg-message >+SUB_FILES= pkg-deinstall pkg-message update.sh >+SUB_LIST= CGIDIR=${CGIDIR} > > PLIST_SUB+= CGIDIR=${CGIDIR:S,^${PREFIX}/,,} \ > DISTVERSION=${DISTVERSION} >@@ -39,13 +38,18 @@ PLIST_SUB+= CGIDIR=${CGIDIR:S,^${PREFIX}/,,} \ > PORTDOCS= ChangeLog LICENSE README > > OPTIONS_DEFINE= ARCHIVE_ZIP COMPRESS_ZLIB DOCS FILE_RSYNCP NMBLOOKUP \ >- RRDTOOL SMBCLIENT XML_RSS >-OPTIONS_DEFAULT= ARCHIVE_ZIP COMPRESS_ZLIB >+ SMBCLIENT XML_RSS >+ >+OPTIONS_RADIO= GRAPHS >+OPTIONS_RADIO_GRAPHS= RRD_GRAPHS RRDTOOL >+ >+OPTIONS_DEFAULT= ARCHIVE_ZIP COMPRESS_ZLIB RRD_GRAPHS > > ARCHIVE_ZIP_DESC= Perl module for Zip archive files > COMPRESS_ZLIB_DESC= Perl5 interface to zlib compression library > FILE_RSYNCP_DESC= Perl Rsync client > NMBLOOKUP_DESC= NetBIOS Name lookup tool >+RRD_GRAPHS_DESC= Apply graphs patch (but not install RRDTool) > RRDTOOL_DESC= Use RRDTool to generate pool statistic graphs > SMBCLIENT_DESC= Samba client > XML_RSS_DESC= Perl extension to manage RSS files >@@ -66,6 +70,8 @@ RUN_DEPENDS+= nmblookup:${PORTSDIR}/net/samba-nmblookup > .endif > .if ${PORT_OPTIONS:MRRDTOOL} > RUN_DEPENDS+= rrdtool:${PORTSDIR}/databases/rrdtool >+.endif >+.if ${PORT_OPTIONS:MRRD_GRAPHS} || ${PORT_OPTIONS:MRRDTOOL} > EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bin-BackupPC \ > ${FILESDIR}/extra-patch-lib-BackupPC-CGI-GeneralInfo.pm > .endif >@@ -76,12 +82,18 @@ RUN_DEPENDS+= smbclient:${PORTSDIR}/net/samba-smbclient > RUN_DEPENDS+= p5-XML-RSS>=0:${PORTSDIR}/textproc/p5-XML-RSS > .endif > >+pre-patch: >+ @${CP} ${WRKSRC}/configure.pl ${WRKSRC}/update.pl >+ > post-patch: > @${REINPLACE_CMD} \ > -e 's|/etc/BackupPC\(/config.pl\)|${ETCDIR}\1|' \ > -e 's|^\(foreach my $$dir ( qw(bin \)doc$$|\1${DOCSDIR_REL}|' \ > -e 's|\($$DestDir$$Conf{InstallDir}/\)doc|\1${DOCSDIR_REL}|' \ >- ${WRKSRC}/configure.pl >+ ${WRKSRC}/configure.pl ${WRKSRC}/update.pl >+ @${REINPLACE_CMD} -E \ >+ -e 's|^(use lib ")\.(/lib";)$$|\1${PREFIX}\2|' \ >+ ${WRKSRC}/update.pl > @${REINPLACE_CMD} \ > -e 's,"/doc/BackupPC.html","/${DOCSDIR_REL}/BackupPC.html",' \ > ${WRKSRC}/lib/BackupPC/CGI/View.pm >@@ -95,15 +107,6 @@ post-patch: > ${WRKSRC}/doc/BackupPC.html ${WRKSRC}/doc/BackupPC.pod > > do-install: >- if [ -f ${ETCDIR}/config.pl ]; then \ >- ${MKDIR} ${STAGEDIR}${ETCDIR}; \ >- ${CP} -p ${ETCDIR}/config.pl ${STAGEDIR}${ETCDIR}/config.pl; \ >- fi >- if [ -f ${ETCDIR}/hosts ]; then \ >- ${MKDIR} ${STAGEDIR}${ETCDIR}; \ >- ${CP} -p ${ETCDIR}/hosts ${STAGEDIR}${ETCDIR}/hosts; \ >- fi >- > cd ${WRKSRC} && ${PERL} configure.pl \ > --batch \ > --backuppc-user ${USERS} \ >@@ -125,13 +128,10 @@ do-install: > ${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.1 ${STAGEDIR}${MANPREFIX}/man/man1 > cd ${WRKSRC} && ${INSTALL_MAN} ${PORTDOCS} ${STAGEDIR}${DOCSDIR} > >- if [ ! -f ${STAGEDIR}${ETCDIR}/config.pl.pre-${DISTVERSION} ]; then \ >- > ${STAGEDIR}${ETCDIR}/config.pl.pre-${DISTVERSION}; \ >- fi >- ${INSTALL} -d ${STAGEDIR}${PREFIX}/libexec/${PORTNAME} >- cd ${STAGEDIR}${ETCDIR} && \ >- ${CHGRP} wheel config.pl config.pl.pre-${DISTVERSION} && \ >- ${MV} config.pl hosts config.pl.pre-${DISTVERSION} \ >- ${STAGEDIR}${PREFIX}/libexec/${PORTNAME}/ >+ ${CP} ${WRKSRC}/conf/config.pl ${STAGEDIR}${ETCDIR}/config.pl.sample >+ ${CP} ${WRKSRC}/conf/hosts ${STAGEDIR}${ETCDIR}/hosts.sample >+ ${CP} ${WRKDIR}/update.sh ${STAGEDIR}${ETCDIR}/update.sh >+ ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/backuppc >+ ${CP} ${WRKSRC}/update.pl ${STAGEDIR}${PREFIX}/libexec/backuppc/update.pl > > .include <bsd.port.mk> >diff --git a/sysutils/backuppc/files/patch-configure.pl b/sysutils/backuppc/files/patch-configure.pl >deleted file mode 100644 >index 1c9ce18..0000000 >--- a/sysutils/backuppc/files/patch-configure.pl >+++ /dev/null >@@ -1,10 +0,0 @@ >---- configure.pl.orig 2010-07-31 21:52:58.000000000 +0400 >-+++ configure.pl 2010-08-16 15:34:17.000000000 +0400 >-@@ -241,6 +241,7 @@ >- $Conf{InstallDir} ||= $opts{"install-dir"} || "/usr/local/BackupPC"; >- $Conf{LogDir} ||= $opts{"log-dir"} || "$Conf{TopDir}/log"; >- } >-+ $Conf{LogDir} = $opts{"log-dir"}; >- >- # >- # These are the programs whose paths we need to find >diff --git a/sysutils/backuppc/files/patch-update.pl b/sysutils/backuppc/files/patch-update.pl >new file mode 100644 >index 0000000..8e5d890 >--- /dev/null >+++ b/sysutils/backuppc/files/patch-update.pl >@@ -0,0 +1,235 @@ >+--- ./update.pl.orig 2014-08-19 15:02:15.000000000 +0400 >++++ ./update.pl 2014-08-19 15:03:11.000000000 +0400 >+@@ -204,7 +204,7 @@ >+ if ( $ConfigPath ne "" && -r $ConfigPath ) { >+ (my $confDir = $ConfigPath) =~ s{/[^/]+$}{}; >+ die("BackupPC::Lib->new failed\n") >+- if ( !($bpc = BackupPC::Lib->new(".", ".", $confDir, 1)) ); >++ if ( !($bpc = BackupPC::Lib->new(".", $opts{"install-dir"}, $confDir, 1)) ); >+ %Conf = $bpc->Conf(); >+ %OrigConf = %Conf; >+ if ( !$opts{fhs} ) { >+@@ -507,198 +507,14 @@ >+ >+ print <<EOF; >+ >+-Ok, we're about to: >+- >+- - install the binaries, lib and docs in $Conf{InstallDir}, >+- - create the data directory $Conf{TopDir}, >+- - create/update the config.pl file $Conf{ConfDir}/config.pl, >+- - optionally install the cgi-bin interface. >++Ok, we're about to create/update the config.pl file $Conf{ConfDir}/config.pl. >+ >+ EOF >+ >+ exit unless prompt("--> Do you want to continue?", "y") =~ /y/i; >+ >+-# >+-# Create install directories >+-# >+-foreach my $dir ( qw(bin doc >+- lib/BackupPC/CGI >+- lib/BackupPC/Config >+- lib/BackupPC/Lang >+- lib/BackupPC/Storage >+- lib/BackupPC/Xfer >+- lib/BackupPC/Zip >+- lib/Net/FTP >+- ) ) { >+- next if ( -d "$DestDir$Conf{InstallDir}/$dir" ); >+- mkpath("$DestDir$Conf{InstallDir}/$dir", 0, 0755); >+- if ( !-d "$DestDir$Conf{InstallDir}/$dir" >+- || !my_chown($Uid, $Gid, "$DestDir$Conf{InstallDir}/$dir") ) { >+- die("Failed to create or chown $DestDir$Conf{InstallDir}/$dir\n"); >+- } else { >+- print("Created $DestDir$Conf{InstallDir}/$dir\n"); >+- } >+-} >+- >+-# >+-# Create CGI image directory >+-# >+-foreach my $dir ( ($Conf{CgiImageDir}) ) { >+- next if ( $dir eq "" || -d "$DestDir$dir" ); >+- mkpath("$DestDir$dir", 0, 0755); >+- if ( !-d "$DestDir$dir" || !my_chown($Uid, $Gid, "$DestDir$dir") ) { >+- die("Failed to create or chown $DestDir$dir"); >+- } else { >+- print("Created $DestDir$dir\n"); >+- } >+-} >+- >+-# >+-# Create other directories >+-# >+-foreach my $dir ( ( >+- "$Conf{TopDir}", >+- "$Conf{TopDir}/pool", >+- "$Conf{TopDir}/cpool", >+- "$Conf{TopDir}/pc", >+- "$Conf{TopDir}/trash", >+- "$Conf{ConfDir}", >+- "$Conf{LogDir}", >+- ) ) { >+- mkpath("$DestDir$dir", 0, 0750) if ( !-d "$DestDir$dir" ); >+- if ( !-d "$DestDir$dir" >+- || !my_chown($Uid, $Gid, "$DestDir$dir") ) { >+- die("Failed to create or chown $DestDir$dir\n"); >+- } else { >+- print("Created $DestDir$dir\n"); >+- } >+-} >+- >+-printf("Installing binaries in $DestDir$Conf{InstallDir}/bin\n"); >+-foreach my $prog ( qw( >+- bin/BackupPC >+- bin/BackupPC_archive >+- bin/BackupPC_archiveHost >+- bin/BackupPC_archiveStart >+- bin/BackupPC_attribPrint >+- bin/BackupPC_dump >+- bin/BackupPC_fixupBackupSummary >+- bin/BackupPC_link >+- bin/BackupPC_nightly >+- bin/BackupPC_restore >+- bin/BackupPC_sendEmail >+- bin/BackupPC_serverMesg >+- bin/BackupPC_trashClean >+- bin/BackupPC_tarExtract >+- bin/BackupPC_tarCreate >+- bin/BackupPC_tarPCCopy >+- bin/BackupPC_zipCreate >+- bin/BackupPC_zcat >+- ) ) { >+- InstallFile($prog, "$DestDir$Conf{InstallDir}/$prog", 0555); >+-} >+- >+-printf("Installing library in $DestDir$Conf{InstallDir}/lib\n"); >+-foreach my $lib ( qw( >+- lib/BackupPC/Attrib.pm >+- lib/BackupPC/Config.pm >+- lib/BackupPC/FileZIO.pm >+- lib/BackupPC/Lib.pm >+- lib/BackupPC/PoolWrite.pm >+- lib/BackupPC/Storage.pm >+- lib/BackupPC/View.pm >+- lib/BackupPC/CGI/AdminOptions.pm >+- lib/BackupPC/CGI/Archive.pm >+- lib/BackupPC/CGI/ArchiveInfo.pm >+- lib/BackupPC/CGI/Browse.pm >+- lib/BackupPC/CGI/DirHistory.pm >+- lib/BackupPC/CGI/EditConfig.pm >+- lib/BackupPC/CGI/EmailSummary.pm >+- lib/BackupPC/CGI/GeneralInfo.pm >+- lib/BackupPC/CGI/HostInfo.pm >+- lib/BackupPC/CGI/Lib.pm >+- lib/BackupPC/CGI/LOGlist.pm >+- lib/BackupPC/CGI/Queue.pm >+- lib/BackupPC/CGI/ReloadServer.pm >+- lib/BackupPC/CGI/RestoreFile.pm >+- lib/BackupPC/CGI/RestoreInfo.pm >+- lib/BackupPC/CGI/Restore.pm >+- lib/BackupPC/CGI/RSS.pm >+- lib/BackupPC/CGI/StartServer.pm >+- lib/BackupPC/CGI/StartStopBackup.pm >+- lib/BackupPC/CGI/StopServer.pm >+- lib/BackupPC/CGI/Summary.pm >+- lib/BackupPC/CGI/View.pm >+- lib/BackupPC/Config/Meta.pm >+- lib/BackupPC/Lang/cz.pm >+- lib/BackupPC/Lang/de.pm >+- lib/BackupPC/Lang/en.pm >+- lib/BackupPC/Lang/es.pm >+- lib/BackupPC/Lang/fr.pm >+- lib/BackupPC/Lang/it.pm >+- lib/BackupPC/Lang/ja.pm >+- lib/BackupPC/Lang/nl.pm >+- lib/BackupPC/Lang/pl.pm >+- lib/BackupPC/Lang/pt_br.pm >+- lib/BackupPC/Lang/ru.pm >+- lib/BackupPC/Lang/uk.pm >+- lib/BackupPC/Lang/zh_CN.pm >+- lib/BackupPC/Storage/Text.pm >+- lib/BackupPC/Xfer.pm >+- lib/BackupPC/Xfer/Archive.pm >+- lib/BackupPC/Xfer/Ftp.pm >+- lib/BackupPC/Xfer/Protocol.pm >+- lib/BackupPC/Xfer/Rsync.pm >+- lib/BackupPC/Xfer/RsyncDigest.pm >+- lib/BackupPC/Xfer/RsyncFileIO.pm >+- lib/BackupPC/Xfer/Smb.pm >+- lib/BackupPC/Xfer/Tar.pm >+- lib/BackupPC/Zip/FileMember.pm >+- lib/Net/FTP/AutoReconnect.pm >+- lib/Net/FTP/RetrHandle.pm >+- ) ) { >+- InstallFile($lib, "$DestDir$Conf{InstallDir}/$lib", 0444); >+-} >+- >+-if ( $Conf{CgiImageDir} ne "" ) { >+- printf("Installing images in $DestDir$Conf{CgiImageDir}\n"); >+- foreach my $img ( <images/*> ) { >+- (my $destImg = $img) =~ s{^images/}{}; >+- InstallFile($img, "$DestDir$Conf{CgiImageDir}/$destImg", 0444, 1); >+- } >+- >+- # >+- # Install new CSS file, making a backup copy if necessary >+- # >+- my $cssBackup = "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css.pre-3.3.0"; >+- if ( -f "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css" && !-f $cssBackup ) { >+- rename("$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css", $cssBackup); >+- } >+- InstallFile("conf/BackupPC_stnd.css", >+- "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css", 0444, 0); >+- InstallFile("conf/BackupPC_stnd_orig.css", >+- "$DestDir$Conf{CgiImageDir}/BackupPC_stnd_orig.css", 0444, 0); >+- InstallFile("conf/sorttable.js", >+- "$DestDir$Conf{CgiImageDir}/sorttable.js", 0444, 0); >+-} >+- >+-printf("Making init.d scripts\n"); >+-foreach my $init ( qw(gentoo-backuppc gentoo-backuppc.conf linux-backuppc >+- solaris-backuppc debian-backuppc freebsd-backuppc >+- freebsd-backuppc2 suse-backuppc slackware-backuppc ) ) { >+- InstallFile("init.d/src/$init", "init.d/$init", 0444); >+-} >+- >+-printf("Making Apache configuration file for suid-perl\n"); >+-InstallFile("httpd/src/BackupPC.conf", "httpd/BackupPC.conf", 0644); >+- >+-printf("Installing docs in $DestDir$Conf{InstallDir}/doc\n"); >+-foreach my $doc ( qw(BackupPC.pod BackupPC.html) ) { >+- InstallFile("doc/$doc", "$DestDir$Conf{InstallDir}/doc/$doc", 0444); >+-} >+- >+ printf("Installing config.pl and hosts in $DestDir$Conf{ConfDir}\n"); >+-InstallFile("conf/hosts", "$DestDir$Conf{ConfDir}/hosts", 0644) >++InstallFile("$DestDir$Conf{ConfDir}/hosts.sample", "$DestDir$Conf{ConfDir}/hosts", 0644) >+ if ( !-f "$DestDir$Conf{ConfDir}/hosts" ); >+ >+ # >+@@ -707,7 +523,7 @@ >+ # parameters and deleting ones that are no longer needed. >+ # >+ my $dest = "$DestDir$Conf{ConfDir}/config.pl"; >+-my ($distConf, $distVars) = ConfigParse("conf/config.pl"); >++my ($distConf, $distVars) = ConfigParse("$DestDir$Conf{ConfDir}/config.pl.sample"); >+ my ($oldConf, $oldVars); >+ my ($newConf, $newVars) = ($distConf, $distVars); >+ if ( -f $dest ) { >+@@ -928,13 +744,6 @@ >+ die("can't chown $Uid, $Gid $dest\n") unless my_chown($Uid, $Gid, $dest); >+ } >+ >+-if ( $Conf{CgiDir} ne "" ) { >+- printf("Installing cgi script BackupPC_Admin in $DestDir$Conf{CgiDir}\n"); >+- mkpath("$DestDir$Conf{CgiDir}", 0, 0755); >+- InstallFile("cgi-bin/BackupPC_Admin", "$DestDir$Conf{CgiDir}/BackupPC_Admin", >+- 04554); >+-} >+- >+ print <<EOF; >+ >+ Ok, it looks like we are finished. There are several more things you >diff --git a/sysutils/backuppc/files/pkg-message.in b/sysutils/backuppc/files/pkg-message.in >index c10e814..5a3d8f4 100644 >--- a/sysutils/backuppc/files/pkg-message.in >+++ b/sysutils/backuppc/files/pkg-message.in >@@ -1,18 +1,16 @@ > ========================================================================== >- - You need to customize %%ETCDIR%%/config.pl . >+ - If this is a new installation or version upgrade, >+ to create/update configuration you should run > >- If this is an upgrade, install BackupPC from port (not from package) >- and make sure the full path of the existing BackupPC >- configuration directory is %%ETCDIR%% . >- Otherwise you will need to make changes in config.pl by hand. >+ %%ETCDIR%%/update.sh > > - Add the following line to /etc/rc.conf to enable BackupPC: > > backuppc_enable="YES" > >- - Data directory is /var/db/BackupPC . >+ - Data directory is /var/db/BackupPC > >- This is where all the PC backup data is stored. >+ This is where all the backup data is stored. > This file system needs to be big enough > to accommodate all the PCs you expect to backup. > ========================================================================== >diff --git a/sysutils/backuppc/files/update.sh.in b/sysutils/backuppc/files/update.sh.in >new file mode 100644 >index 0000000..9c9ab4b >--- /dev/null >+++ b/sysutils/backuppc/files/update.sh.in >@@ -0,0 +1,11 @@ >+#!/bin/sh >+ >+perl %%PREFIX%%/libexec/backuppc/update.pl \ >+ --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 >diff --git a/sysutils/backuppc/pkg-plist b/sysutils/backuppc/pkg-plist >index ec105c1..9b3c79e 100644 >--- a/sysutils/backuppc/pkg-plist >+++ b/sysutils/backuppc/pkg-plist >@@ -1,8 +1,4 @@ > @stopdaemon backuppc >-@unexec if cmp -s %D/%%ETCDIR%%/config.pl %D/%%ETCDIR%%/config.pl.sample; then rm -f %D/%%ETCDIR%%/config.pl; fi >-@unexec if cmp -s %D/%%ETCDIR%%/hosts %D/%%ETCDIR%%/hosts.sample; then rm -f %D/%%ETCDIR%%/hosts; fi >-@rmtry %%ETCDIR%%/config.pl.sample >-@rmtry %%ETCDIR%%/hosts.sample > @mode 0555 > bin/BackupPC > bin/BackupPC_archive >@@ -163,16 +159,13 @@ man/man1/backuppc.1.gz > @group backuppc > @dirrmtry %%ETCDIR%% > @mode 0640 >-libexec/backuppc/config.pl.pre-%%DISTVERSION%% >-@exec if [ -s %D/%F -a ! -f %D/%%ETCDIR%%/%f ]; then cp -p %D/%F %D/%%ETCDIR%%/; fi >-libexec/backuppc/config.pl >-@exec if [ ! -f %D/%%ETCDIR%%/%f ]; then cp -p %D/%F %D/%%ETCDIR%%/config.pl.sample; fi >-@exec cp -p %D/%F %D/%%ETCDIR%%/ >+%%ETCDIR%%/config.pl.sample > @mode 0644 >-libexec/backuppc/hosts >-@exec if [ ! -f %D/%%ETCDIR%%/%f ]; then cp -p %D/%F %D/%%ETCDIR%%/hosts.sample; fi >-@exec cp -p %D/%F %D/%%ETCDIR%%/ >+%%ETCDIR%%/hosts.sample > @owner > @group >+@mode 0544 >+%%ETCDIR%%/update.sh >+libexec/backuppc/update.pl > @mode > @dirrm libexec/backuppc
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
moiseev
:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 192403
:
145699
| 146290