Lines 1-276
Link Here
|
1 |
--- ./update.pl.orig 2014-09-03 13:36:33.000000000 +0400 |
|
|
2 |
+++ ./update.pl 2014-09-03 13:56:16.000000000 +0400 |
3 |
@@ -222,7 +222,7 @@ |
4 |
if ( $ConfigPath ne "" && -r $ConfigPath ) { |
5 |
(my $confDir = $ConfigPath) =~ s{/[^/]+$}{}; |
6 |
die("BackupPC::Lib->new failed\n") |
7 |
- if ( !($bpc = BackupPC::Lib->new(".", ".", $confDir, 1)) ); |
8 |
+ if ( !($bpc = BackupPC::Lib->new(".", $opts{"install-dir"}, $confDir, 1)) ); |
9 |
%Conf = $bpc->Conf(); |
10 |
%OrigConf = %Conf; |
11 |
if ( !$opts{fhs} ) { |
12 |
@@ -494,239 +494,21 @@ |
13 |
|
14 |
print <<EOF; |
15 |
|
16 |
-Ok, we're about to: |
17 |
- |
18 |
- - install the binaries, lib and docs in $Conf{InstallDir}, |
19 |
- - create the data directory $Conf{TopDir}, |
20 |
- - create/update the config.pl file $Conf{ConfDir}/config.pl, |
21 |
- - optionally install the cgi-bin interface. |
22 |
+Ok, we're about to create/update the config.pl file $Conf{ConfDir}/config.pl. |
23 |
|
24 |
EOF |
25 |
|
26 |
exit unless prompt("--> Do you want to continue?", "y") =~ /y/i; |
27 |
|
28 |
# |
29 |
-# Create install directories |
30 |
-# |
31 |
-foreach my $dir ( qw(bin share/doc/BackupPC |
32 |
- lib/BackupPC/CGI |
33 |
- lib/BackupPC/Config |
34 |
- lib/BackupPC/Lang |
35 |
- lib/BackupPC/Storage |
36 |
- lib/BackupPC/Xfer |
37 |
- lib/BackupPC/Zip |
38 |
- lib/Net/FTP |
39 |
- ) ) { |
40 |
- next if ( -d "$DestDir$Conf{InstallDir}/$dir" ); |
41 |
- mkpath("$DestDir$Conf{InstallDir}/$dir", 0, 0755); |
42 |
- if ( !-d "$DestDir$Conf{InstallDir}/$dir" |
43 |
- || !my_chown($Uid, $Gid, "$DestDir$Conf{InstallDir}/$dir") ) { |
44 |
- die("Failed to create or chown $DestDir$Conf{InstallDir}/$dir\n"); |
45 |
- } else { |
46 |
- print("Created $DestDir$Conf{InstallDir}/$dir\n"); |
47 |
- } |
48 |
-} |
49 |
- |
50 |
-# |
51 |
-# Create CGI image directory |
52 |
-# |
53 |
-foreach my $dir ( ($Conf{CgiImageDir}) ) { |
54 |
- next if ( $dir eq "" || -d "$DestDir$dir" ); |
55 |
- mkpath("$DestDir$dir", 0, 0755); |
56 |
- if ( !-d "$DestDir$dir" || !my_chown($Uid, $Gid, "$DestDir$dir") ) { |
57 |
- die("Failed to create or chown $DestDir$dir"); |
58 |
- } else { |
59 |
- print("Created $DestDir$dir\n"); |
60 |
- } |
61 |
-} |
62 |
- |
63 |
-# |
64 |
-# Create other directories |
65 |
-# |
66 |
-foreach my $dir ( ( |
67 |
- "$Conf{TopDir}", |
68 |
- "$Conf{TopDir}/pool", |
69 |
- "$Conf{TopDir}/cpool", |
70 |
- "$Conf{TopDir}/pc", |
71 |
- "$Conf{ConfDir}", |
72 |
- "$Conf{LogDir}", |
73 |
- "$Conf{RunDir}", |
74 |
- ) ) { |
75 |
- mkpath("$DestDir$dir", 0, 0750) if ( !-d "$DestDir$dir" ); |
76 |
- if ( !-d "$DestDir$dir" |
77 |
- || !my_chown($Uid, $Gid, "$DestDir$dir") ) { |
78 |
- die("Failed to create or chown $DestDir$dir\n"); |
79 |
- } else { |
80 |
- print("Created $DestDir$dir\n"); |
81 |
- } |
82 |
-} |
83 |
- |
84 |
-printf("Installing binaries in $DestDir$Conf{InstallDir}/bin\n"); |
85 |
-foreach my $prog ( qw( |
86 |
- bin/BackupPC |
87 |
- bin/BackupPC_Admin_SCGI |
88 |
- bin/BackupPC_archive |
89 |
- bin/BackupPC_archiveHost |
90 |
- bin/BackupPC_archiveStart |
91 |
- bin/BackupPC_attribPrint |
92 |
- bin/BackupPC_backupDelete |
93 |
- bin/BackupPC_backupDuplicate |
94 |
- bin/BackupPC_dump |
95 |
- bin/BackupPC_fixupBackupSummary |
96 |
- bin/BackupPC_fsck |
97 |
- bin/BackupPC_ls |
98 |
- bin/BackupPC_nightly |
99 |
- bin/BackupPC_poolCntPrint |
100 |
- bin/BackupPC_refCountUpdate |
101 |
- bin/BackupPC_restore |
102 |
- bin/BackupPC_rrdUpdate |
103 |
- bin/BackupPC_sendEmail |
104 |
- bin/BackupPC_serverMesg |
105 |
- bin/BackupPC_tarCreate |
106 |
- bin/BackupPC_tarExtract |
107 |
- bin/BackupPC_zcat |
108 |
- bin/BackupPC_zipCreate |
109 |
- ) ) { |
110 |
- InstallFile($prog, "$DestDir$Conf{InstallDir}/$prog", 0555); |
111 |
-} |
112 |
- |
113 |
-# |
114 |
-# remove old pre-v4 programs |
115 |
-# |
116 |
-foreach my $prog ( qw( |
117 |
- bin/BackupPC_link |
118 |
- bin/BackupPC_tarPCCopy |
119 |
- bin/BackupPC_trashClean |
120 |
- bin/BackupPC_compressPool |
121 |
- ) ) { |
122 |
- unlink("$DestDir$Conf{InstallDir}/$prog"); |
123 |
-} |
124 |
- |
125 |
-printf("Installing library in $DestDir$Conf{InstallDir}/lib\n"); |
126 |
-foreach my $lib ( qw( |
127 |
- lib/BackupPC/Config/Meta.pm |
128 |
- lib/BackupPC/DirOps.pm |
129 |
- lib/BackupPC/Lib.pm |
130 |
- lib/BackupPC/Storage.pm |
131 |
- lib/BackupPC/View.pm |
132 |
- lib/BackupPC/Xfer/Archive.pm |
133 |
- lib/BackupPC/Xfer/Ftp.pm |
134 |
- lib/BackupPC/Xfer/Protocol.pm |
135 |
- lib/BackupPC/Xfer/Rsync.pm |
136 |
- lib/BackupPC/Xfer/Smb.pm |
137 |
- lib/BackupPC/Xfer/Tar.pm |
138 |
- lib/BackupPC/Xfer.pm |
139 |
- lib/BackupPC/Zip/FileMember.pm |
140 |
- lib/Net/FTP/AutoReconnect.pm |
141 |
- lib/Net/FTP/RetrHandle.pm |
142 |
- lib/BackupPC/CGI/AdminOptions.pm |
143 |
- lib/BackupPC/CGI/Archive.pm |
144 |
- lib/BackupPC/CGI/ArchiveInfo.pm |
145 |
- lib/BackupPC/CGI/Browse.pm |
146 |
- lib/BackupPC/CGI/DirHistory.pm |
147 |
- lib/BackupPC/CGI/EditConfig.pm |
148 |
- lib/BackupPC/CGI/EmailSummary.pm |
149 |
- lib/BackupPC/CGI/GeneralInfo.pm |
150 |
- lib/BackupPC/CGI/HostInfo.pm |
151 |
- lib/BackupPC/CGI/Lib.pm |
152 |
- lib/BackupPC/CGI/LOGlist.pm |
153 |
- lib/BackupPC/CGI/Queue.pm |
154 |
- lib/BackupPC/CGI/ReloadServer.pm |
155 |
- lib/BackupPC/CGI/Restore.pm |
156 |
- lib/BackupPC/CGI/RestoreFile.pm |
157 |
- lib/BackupPC/CGI/RestoreInfo.pm |
158 |
- lib/BackupPC/CGI/RSS.pm |
159 |
- lib/BackupPC/CGI/StartServer.pm |
160 |
- lib/BackupPC/CGI/StartStopBackup.pm |
161 |
- lib/BackupPC/CGI/StopServer.pm |
162 |
- lib/BackupPC/CGI/Summary.pm |
163 |
- lib/BackupPC/CGI/View.pm |
164 |
- lib/BackupPC/Lang/cz.pm |
165 |
- lib/BackupPC/Lang/de.pm |
166 |
- lib/BackupPC/Lang/en.pm |
167 |
- lib/BackupPC/Lang/es.pm |
168 |
- lib/BackupPC/Lang/fr.pm |
169 |
- lib/BackupPC/Lang/it.pm |
170 |
- lib/BackupPC/Lang/ja.pm |
171 |
- lib/BackupPC/Lang/nl.pm |
172 |
- lib/BackupPC/Lang/pl.pm |
173 |
- lib/BackupPC/Lang/pt_br.pm |
174 |
- lib/BackupPC/Lang/ru.pm |
175 |
- lib/BackupPC/Lang/uk.pm |
176 |
- lib/BackupPC/Lang/zh_CN.pm |
177 |
- lib/BackupPC/Storage/Text.pm |
178 |
- ) ) { |
179 |
- InstallFile($lib, "$DestDir$Conf{InstallDir}/$lib", 0444); |
180 |
-} |
181 |
- |
182 |
-# |
183 |
-# remove old pre-v4 libraries |
184 |
-# |
185 |
-foreach my $lib ( qw( |
186 |
- lib/BackupPC/Attrib.pm |
187 |
- lib/BackupPC/Config.pm |
188 |
- lib/BackupPC/FileZIO.pm |
189 |
- lib/BackupPC/PoolWrite.pm |
190 |
- lib/BackupPC/Xfer/RsyncDigest.pm |
191 |
- lib/BackupPC/Xfer/RsyncFileIO.pm |
192 |
- ) ) { |
193 |
- unlink("$DestDir$Conf{InstallDir}/$lib"); |
194 |
-} |
195 |
- |
196 |
-# |
197 |
# clean pid and sock files from old location (they are now in $Conf{RunDir}, and they |
198 |
# get re-created each time BackupPC starts, so it's ok if RunDir eq LogDir). |
199 |
# |
200 |
unlink("$DestDir$Conf{LogDir}/BackupPC.pid") if ( -f "$DestDir$Conf{LogDir}/BackupPC.pid" ); |
201 |
unlink("$DestDir$Conf{LogDir}/BackupPC.sock") if ( -e "$DestDir$Conf{LogDir}/BackupPC.sock" ); |
202 |
|
203 |
-if ( $Conf{CgiImageDir} ne "" ) { |
204 |
- printf("Installing images in $DestDir$Conf{CgiImageDir}\n"); |
205 |
- foreach my $img ( <images/*> ) { |
206 |
- (my $destImg = $img) =~ s{^images/}{}; |
207 |
- InstallFile($img, "$DestDir$Conf{CgiImageDir}/$destImg", 0444, 1); |
208 |
- } |
209 |
- |
210 |
- # |
211 |
- # Install new CSS file, making a backup copy if necessary |
212 |
- # |
213 |
- my $cssBackup = "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css.pre-4.0.0alpha3"; |
214 |
- if ( -f "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css" && !-f $cssBackup ) { |
215 |
- rename("$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css", $cssBackup); |
216 |
- } |
217 |
- InstallFile("conf/BackupPC_stnd.css", |
218 |
- "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css", 0444, 0); |
219 |
- InstallFile("conf/BackupPC_stnd_orig.css", |
220 |
- "$DestDir$Conf{CgiImageDir}/BackupPC_stnd_orig.css", 0444, 0); |
221 |
- InstallFile("conf/sorttable.js", |
222 |
- "$DestDir$Conf{CgiImageDir}/sorttable.js", 0444, 0); |
223 |
-} |
224 |
- |
225 |
-printf("Making init.d scripts\n"); |
226 |
-foreach my $init ( qw(gentoo-backuppc gentoo-backuppc.conf linux-backuppc |
227 |
- solaris-backuppc debian-backuppc freebsd-backuppc |
228 |
- freebsd-backuppc2 suse-backuppc slackware-backuppc ) ) { |
229 |
- InstallFile("init.d/src/$init", "init.d/$init", 0444); |
230 |
-} |
231 |
- |
232 |
-printf("Making Apache configuration file for suid-perl\n"); |
233 |
-InstallFile("httpd/src/BackupPC.conf", "httpd/BackupPC.conf", 0644); |
234 |
- |
235 |
-printf("Installing docs in $DestDir$Conf{InstallDir}/share/doc/BackupPC\n"); |
236 |
-foreach my $doc ( qw(BackupPC.pod BackupPC.html) ) { |
237 |
- InstallFile("doc/$doc", "$DestDir$Conf{InstallDir}/share/doc/BackupPC/$doc", 0444); |
238 |
- # |
239 |
- # clean up files from old directory |
240 |
- # |
241 |
- unlink("$DestDir$Conf{InstallDir}/doc/$doc") if ( -f "$DestDir$Conf{InstallDir}/doc/$doc" ); |
242 |
-} |
243 |
-# |
244 |
-# clean up old directory (ok if it quietly fails if there are other files in that directory) |
245 |
-# |
246 |
-rmdir("$DestDir$Conf{InstallDir}/doc") if ( -d "$DestDir$Conf{InstallDir}/doc" ); |
247 |
- |
248 |
printf("Installing config.pl and hosts in $DestDir$Conf{ConfDir}\n"); |
249 |
-InstallFile("conf/hosts", "$DestDir$Conf{ConfDir}/hosts", 0644) |
250 |
+InstallFile("$DestDir$Conf{ConfDir}/hosts.sample", "$DestDir$Conf{ConfDir}/hosts", 0644) |
251 |
if ( !-f "$DestDir$Conf{ConfDir}/hosts" ); |
252 |
|
253 |
# |
254 |
@@ -735,7 +517,7 @@ |
255 |
# parameters and deleting ones that are no longer needed. |
256 |
# |
257 |
my $dest = "$DestDir$Conf{ConfDir}/config.pl"; |
258 |
-my ($distConf, $distVars) = ConfigParse("conf/config.pl"); |
259 |
+my ($distConf, $distVars) = ConfigParse("$DestDir$Conf{ConfDir}/config.pl.sample"); |
260 |
my ($oldConf, $oldVars); |
261 |
my ($newConf, $newVars) = ($distConf, $distVars); |
262 |
if ( -f $dest ) { |
263 |
@@ -974,13 +756,6 @@ |
264 |
die("can't chown $Uid, $Gid $dest\n") unless my_chown($Uid, $Gid, $dest); |
265 |
} |
266 |
|
267 |
-if ( $Conf{CgiDir} ne "" ) { |
268 |
- printf("Installing cgi script BackupPC_Admin in $DestDir$Conf{CgiDir}\n"); |
269 |
- mkpath("$DestDir$Conf{CgiDir}", 0, 0755); |
270 |
- InstallFile("cgi-bin/BackupPC_Admin", "$DestDir$Conf{CgiDir}/BackupPC_Admin", |
271 |
- 04554); |
272 |
-} |
273 |
- |
274 |
print <<EOF; |
275 |
|
276 |
Ok, it looks like we are finished. There are several more things you |