| 56 | | $host = strtolower($host); |
|---|
| 57 | | $filename = "/etc/backuppc/".$host.".pl"; |
|---|
| 58 | | if (!($fh = fopen($filename, "w"))) |
|---|
| 59 | | halt("cannot create file $filename"); |
|---|
| 60 | | fwrite($fh, "# Configuration of $host\n\$Conf{XferMethod} = 'smb';\n\n\$Conf{SmbShareName} = [];\n\n"); |
|---|
| 61 | | #fwrite($fh, "\$Conf{TarClientCmd} = '/usr/bin/env LANG=en \$tarPath -c -v -f - -C \$shareName --totals';\n\n"); |
|---|
| 62 | | fwrite($fh, "\n# *** Unchanged Configuration ***\n"); |
|---|
| 63 | | fwrite($fh, "\n\n# ***\n"); |
|---|
| 64 | | fclose($fh); |
|---|
| | 56 | $host = strtolower($host); |
|---|
| | 57 | $filename = "/etc/backuppc/".$host.".pl"; |
|---|
| | 58 | if (!($fh = fopen($filename, "w"))) |
|---|
| | 59 | halt("cannot create file $filename"); |
|---|
| | 60 | fwrite($fh, "# Configuration of $host\n\$Conf{XferMethod} = 'smb';\n\n\$Conf{SmbShareName} = [];\n\n"); |
|---|
| | 61 | #fwrite($fh, "\$Conf{TarClientCmd} = '/usr/bin/env LANG=en \$tarPath -c -v -f - -C \$shareName --totals';\n\n"); |
|---|
| | 62 | fwrite($fh, "\n# *** Unchanged Configuration ***\n"); |
|---|
| | 63 | fwrite($fh, "\n\n# ***\n"); |
|---|
| | 64 | fclose($fh); |
|---|
| 74 | | $filename = '/etc/backuppc/hosts'; |
|---|
| 75 | | $fh = fopen($filename, "r+"); |
|---|
| 76 | | $f_str = fread($fh, filesize($filename)); |
|---|
| 77 | | $str = "$host \t $dhcp \t backuppc\n"; |
|---|
| 78 | | if (!strstr($f_str, "\n".$str)) { |
|---|
| 79 | | # only add if it does not exist |
|---|
| 80 | | if (fwrite($fh, $str) == FALSE) |
|---|
| 81 | | halt("cannot write to $filename"); |
|---|
| 82 | | } |
|---|
| 83 | | fclose($fh); |
|---|
| 84 | | generateDefaultFile($host); |
|---|
| 85 | | reloadBPC(); |
|---|
| | 74 | $filename = '/etc/backuppc/hosts'; |
|---|
| | 75 | $fh = fopen($filename, "r+"); |
|---|
| | 76 | $f_str = fread($fh, filesize($filename)); |
|---|
| | 77 | $str = "$host \t $dhcp \t backuppc\n"; |
|---|
| | 78 | if (!strstr($f_str, "\n".$str)) { |
|---|
| | 79 | # only add if it does not exist |
|---|
| | 80 | if (fwrite($fh, $str) == FALSE) |
|---|
| | 81 | halt("cannot write to $filename"); |
|---|
| | 82 | } |
|---|
| | 83 | fclose($fh); |
|---|
| | 84 | generateDefaultFile($host); |
|---|
| | 85 | reloadBPC(); |
|---|
| 98 | | $filename = '/etc/backuppc/hosts'; |
|---|
| 99 | | |
|---|
| 100 | | $fh = fopen($filename, "rb"); |
|---|
| 101 | | $f_str = fread($fh, filesize($filename)); |
|---|
| 102 | | fclose($fh); |
|---|
| 103 | | |
|---|
| 104 | | $reg = "/[^#\s]*".$host."\s+[01]/"; |
|---|
| 105 | | $replacement = "$host \t $dhcp"; |
|---|
| 106 | | $f_str = preg_replace($reg, $replacement, $f_str); |
|---|
| 107 | | |
|---|
| 108 | | $fh = fopen($filename, "w"); |
|---|
| 109 | | if (fwrite($fh, $f_str) == FALSE) |
|---|
| 110 | | halt("cannot write to $filename"); |
|---|
| 111 | | fclose($fh); |
|---|
| | 98 | $filename = '/etc/backuppc/hosts'; |
|---|
| | 99 | |
|---|
| | 100 | $fh = fopen($filename, "rb"); |
|---|
| | 101 | $f_str = fread($fh, filesize($filename)); |
|---|
| | 102 | fclose($fh); |
|---|
| | 103 | |
|---|
| | 104 | $reg = "/[^#\s]*".$host."\s+[01]/"; |
|---|
| | 105 | $replacement = "$host \t $dhcp"; |
|---|
| | 106 | $f_str = preg_replace($reg, $replacement, $f_str); |
|---|
| | 107 | |
|---|
| | 108 | $fh = fopen($filename, "w"); |
|---|
| | 109 | if (fwrite($fh, $f_str) == FALSE) |
|---|
| | 110 | halt("cannot write to $filename"); |
|---|
| | 111 | fclose($fh); |
|---|
| 166 | | if (!isset($full)) { |
|---|
| 167 | | $reg = "/[\$]Conf\{FullPeriod\}\s*=\s*(.+);/"; |
|---|
| 168 | | if (preg_match($reg, $filestr, $m)) { |
|---|
| 169 | | $full = $m[1]; |
|---|
| 170 | | } |
|---|
| 171 | | } |
|---|
| 172 | | if (!isset($incr)) { |
|---|
| 173 | | $reg = "/[\$]Conf\{IncrPeriod\}\s*=\s*(.+);/"; |
|---|
| 174 | | if (preg_match($reg, $filestr, $m)) { |
|---|
| 175 | | $incr = $m[1]; |
|---|
| 176 | | } |
|---|
| 177 | | } |
|---|
| 178 | | |
|---|
| 179 | | if (!isset($blackout_begin)) { |
|---|
| 180 | | $reg = "/[\$]Conf\{BlackoutHourBegin\}\s*=\s*(.+);/"; |
|---|
| 181 | | if (preg_match($reg, $filestr, $m)) |
|---|
| 182 | | $blackout_begin = $m[1]; |
|---|
| 183 | | } |
|---|
| 184 | | |
|---|
| 185 | | if (!isset($blackout_end)) { |
|---|
| 186 | | $reg = "/[\$]Conf\{BlackoutHourEnd\}\s*=\s*(.+);/"; |
|---|
| 187 | | if (preg_match($reg, $filestr, $m)) |
|---|
| 188 | | $blackout_end = $m[1]; |
|---|
| 189 | | } |
|---|
| 190 | | |
|---|
| 191 | | if (!isset($blackout_days)) { |
|---|
| 192 | | $reg = "/[\$]Conf\{BlackoutWeekDays\}\s*=\s*\[(.+)\];/"; |
|---|
| 193 | | if (preg_match($reg, $filestr, $m)) { |
|---|
| 194 | | $blackoutdays_tmp = array_map("trim", explode(",", $m[1])); |
|---|
| 195 | | $blackout_days=array(); |
|---|
| 196 | | for ($i=0; $i<7; $i++) |
|---|
| 197 | | $blackout_days[$i]=(in_array($i, $blackoutdays_tmp)); |
|---|
| 198 | | } |
|---|
| 199 | | } |
|---|
| | 166 | if (!isset($full)) { |
|---|
| | 167 | $reg = "/[\$]Conf\{FullPeriod\}\s*=\s*(.+);/"; |
|---|
| | 168 | if (preg_match($reg, $filestr, $m)) { |
|---|
| | 169 | $full = $m[1]; |
|---|
| | 170 | } |
|---|
| | 171 | } |
|---|
| | 172 | if (!isset($incr)) { |
|---|
| | 173 | $reg = "/[\$]Conf\{IncrPeriod\}\s*=\s*(.+);/"; |
|---|
| | 174 | if (preg_match($reg, $filestr, $m)) { |
|---|
| | 175 | $incr = $m[1]; |
|---|
| | 176 | } |
|---|
| | 177 | } |
|---|
| | 178 | |
|---|
| | 179 | if (!isset($blackout_begin)) { |
|---|
| | 180 | $reg = "/[\$]Conf\{BlackoutHourBegin\}\s*=\s*(.+);/"; |
|---|
| | 181 | if (preg_match($reg, $filestr, $m)) |
|---|
| | 182 | $blackout_begin = $m[1]; |
|---|
| | 183 | } |
|---|
| | 184 | |
|---|
| | 185 | if (!isset($blackout_end)) { |
|---|
| | 186 | $reg = "/[\$]Conf\{BlackoutHourEnd\}\s*=\s*(.+);/"; |
|---|
| | 187 | if (preg_match($reg, $filestr, $m)) |
|---|
| | 188 | $blackout_end = $m[1]; |
|---|
| | 189 | } |
|---|
| | 190 | |
|---|
| | 191 | if (!isset($blackout_days)) { |
|---|
| | 192 | $reg = "/[\$]Conf\{BlackoutWeekDays\}\s*=\s*\[(.+)\];/"; |
|---|
| | 193 | if (preg_match($reg, $filestr, $m)) { |
|---|
| | 194 | $blackoutdays_tmp = array_map("trim", explode(",", $m[1])); |
|---|
| | 195 | $blackout_days=array(); |
|---|
| | 196 | for ($i=0; $i<7; $i++) |
|---|
| | 197 | $blackout_days[$i]=(in_array($i, $blackoutdays_tmp)); |
|---|
| | 198 | } |
|---|
| | 199 | } |
|---|
| 216 | | // values from host file |
|---|
| 217 | | $host_file = strtolower($host); |
|---|
| 218 | | |
|---|
| 219 | | $filename = '/etc/backuppc/'.$host_file.'.pl'; |
|---|
| 220 | | $filelines = @file($filename); |
|---|
| 221 | | if (empty($filelines)) { |
|---|
| 222 | | halt("Error while reading $host configuration file; $filename does not exist or is empty."); |
|---|
| 223 | | return false; |
|---|
| 224 | | } |
|---|
| 225 | | |
|---|
| 226 | | $filestr = deleteComments($filelines); |
|---|
| 227 | | |
|---|
| 228 | | $reg = "/[\$]Conf\{XferMethod\}\s*=\s*\'(.+)\';/"; |
|---|
| 229 | | preg_match($reg, $filestr, $m); |
|---|
| 230 | | $xfermethod_orig = $m[1]; |
|---|
| 231 | | if ($xfermethod_orig == "tar") { |
|---|
| 232 | | $reg = "/[\$]Conf\{TarClientCmd\}\s*=\s*\'(.+)\';/"; |
|---|
| 233 | | if (!preg_match($reg, $filestr, $m)) |
|---|
| 234 | | $xfermethod_orig = "tarssh"; |
|---|
| 235 | | } |
|---|
| 236 | | |
|---|
| 237 | | $xfer_changed = false; |
|---|
| 238 | | if (isset($xfermethod)) { |
|---|
| 239 | | if ($xfermethod_orig != $xfermethod) |
|---|
| 240 | | $xfer_changed = true; |
|---|
| 241 | | } else |
|---|
| 242 | | $xfermethod = $xfermethod_orig; |
|---|
| 243 | | |
|---|
| 244 | | $str = ucfirst($xfermethod); |
|---|
| 245 | | |
|---|
| 246 | | if (!isset($shares) && !($xfer_changed)) { |
|---|
| 247 | | $shares=array(); |
|---|
| 248 | | if ($xfermethod == "rsyncd") |
|---|
| 249 | | $reg = "/[\$]Conf\{RsyncShareName\}\s*=\s*\[(.*)\];/"; |
|---|
| 250 | | else |
|---|
| 251 | | if ($xfermethod == "tarssh") |
|---|
| 252 | | $reg = "/[\$]Conf\{TarShareName\}\s*=\s*\[(.*)\];/"; |
|---|
| 253 | | else |
|---|
| 254 | | $reg = "/[\$]Conf\{".$str."ShareName\}\s*=\s*\[(.*)\];/"; |
|---|
| 255 | | preg_match($reg, $filestr, $m); |
|---|
| 256 | | $shares_full = explode(",", $m[1]); |
|---|
| 257 | | $reg = "/\'(.*)\'/"; |
|---|
| 258 | | $j = 0; |
|---|
| 259 | | for ($i=0; $i<count($shares_full); $i++) { |
|---|
| 260 | | preg_match($reg, $shares_full[$i], $m); |
|---|
| 261 | | if ($m[1]) { // this is to eliminate empty inputs in table |
|---|
| 262 | | $shares[$j] = $m[1]; |
|---|
| 263 | | $j++; |
|---|
| 264 | | } |
|---|
| 265 | | } |
|---|
| 266 | | } |
|---|
| 267 | | |
|---|
| 268 | | if (!($xfer_changed) && ($xfermethod == 'smb' || $xfermethod == 'rsyncd') && !isset($username) && !isset($passwd)) { |
|---|
| 269 | | $reg = "/[\$]Conf\{".$str."ShareUserName\}\s*=\s*\'(.*)\';/"; |
|---|
| 270 | | preg_match($reg, $filestr, $m); |
|---|
| 271 | | $username = $m[1]; |
|---|
| 272 | | |
|---|
| 273 | | $reg = "/[\$]Conf\{".$str."SharePasswd\}\s*=\s*\'(.*)\';/"; |
|---|
| 274 | | preg_match($reg, $filestr, $m); |
|---|
| 275 | | $passwd = $m[1]; |
|---|
| 276 | | } |
|---|
| 277 | | |
|---|
| 278 | | findCommonSettings($filestr, $full, $incr, $blackout_begin, $blackout_end, $blackout_days); |
|---|
| 279 | | |
|---|
| 280 | | // values from config.pl |
|---|
| 281 | | $filename = '/etc/backuppc/config.pl'; |
|---|
| 282 | | |
|---|
| 283 | | $filelines = @file($filename); |
|---|
| 284 | | if (empty($filelines)) { |
|---|
| 285 | | halt("Error while reading configuration file; $filename does not exist or is empty."); |
|---|
| 286 | | return false; |
|---|
| 287 | | } |
|---|
| 288 | | |
|---|
| 289 | | $filestr = deleteComments($filelines); |
|---|
| 290 | | |
|---|
| 291 | | findCommonSettings($filestr, $full, $incr, $blackout_begin, $blackout_end, $blackout_days); |
|---|
| | 216 | // values from host file |
|---|
| | 217 | $host_file = strtolower($host); |
|---|
| | 218 | |
|---|
| | 219 | $filename = '/etc/backuppc/'.$host_file.'.pl'; |
|---|
| | 220 | $filelines = @file($filename); |
|---|
| | 221 | if (empty($filelines)) { |
|---|
| | 222 | halt("Error while reading $host configuration file; $filename does not exist or is empty."); |
|---|
| | 223 | return false; |
|---|
| | 224 | } |
|---|
| | 225 | |
|---|
| | 226 | $filestr = deleteComments($filelines); |
|---|
| | 227 | |
|---|
| | 228 | $reg = "/[\$]Conf\{XferMethod\}\s*=\s*\'(.+)\';/"; |
|---|
| | 229 | preg_match($reg, $filestr, $m); |
|---|
| | 230 | $xfermethod_orig = $m[1]; |
|---|
| | 231 | if ($xfermethod_orig == "tar") { |
|---|
| | 232 | $reg = "/[\$]Conf\{TarClientCmd\}\s*=\s*\'(.+)\';/"; |
|---|
| | 233 | if (!preg_match($reg, $filestr, $m)) |
|---|
| | 234 | $xfermethod_orig = "tarssh"; |
|---|
| | 235 | } |
|---|
| | 236 | |
|---|
| | 237 | $xfer_changed = false; |
|---|
| | 238 | if (isset($xfermethod)) { |
|---|
| | 239 | if ($xfermethod_orig != $xfermethod) |
|---|
| | 240 | $xfer_changed = true; |
|---|
| | 241 | } else |
|---|
| | 242 | $xfermethod = $xfermethod_orig; |
|---|
| | 243 | |
|---|
| | 244 | $str = ucfirst($xfermethod); |
|---|
| | 245 | |
|---|
| | 246 | if (!isset($shares) && !($xfer_changed)) { |
|---|
| | 247 | $shares=array(); |
|---|
| | 248 | if ($xfermethod == "rsyncd") |
|---|
| | 249 | $reg = "/[\$]Conf\{RsyncShareName\}\s*=\s*\[(.*)\];/"; |
|---|
| | 250 | else |
|---|
| | 251 | if ($xfermethod == "tarssh") |
|---|
| | 252 | $reg = "/[\$]Conf\{TarShareName\}\s*=\s*\[(.*)\];/"; |
|---|
| | 253 | else |
|---|
| | 254 | $reg = "/[\$]Conf\{".$str."ShareName\}\s*=\s*\[(.*)\];/"; |
|---|
| | 255 | preg_match($reg, $filestr, $m); |
|---|
| | 256 | $shares_full = explode(",", $m[1]); |
|---|
| | 257 | $reg = "/\'(.*)\'/"; |
|---|
| | 258 | $j = 0; |
|---|
| | 259 | for ($i=0; $i<count($shares_full); $i++) { |
|---|
| | 260 | preg_match($reg, $shares_full[$i], $m); |
|---|
| | 261 | if ($m[1]) { // this is to eliminate empty inputs in table |
|---|
| | 262 | $shares[$j] = $m[1]; |
|---|
| | 263 | $j++; |
|---|
| | 264 | } |
|---|
| | 265 | } |
|---|
| | 266 | } |
|---|
| | 267 | |
|---|
| | 268 | if (!($xfer_changed) && ($xfermethod == 'smb' || $xfermethod == 'rsyncd') && !isset($username) && !isset($passwd)) { |
|---|
| | 269 | $reg = "/[\$]Conf\{".$str."ShareUserName\}\s*=\s*\'(.*)\';/"; |
|---|
| | 270 | preg_match($reg, $filestr, $m); |
|---|
| | 271 | $username = $m[1]; |
|---|
| | 272 | |
|---|
| | 273 | $reg = "/[\$]Conf\{".$str."SharePasswd\}\s*=\s*\'(.*)\';/"; |
|---|
| | 274 | preg_match($reg, $filestr, $m); |
|---|
| | 275 | $passwd = $m[1]; |
|---|
| | 276 | } |
|---|
| | 277 | |
|---|
| | 278 | findCommonSettings($filestr, $full, $incr, $blackout_begin, $blackout_end, $blackout_days); |
|---|
| | 279 | |
|---|
| | 280 | // values from config.pl |
|---|
| | 281 | $filename = '/etc/backuppc/config.pl'; |
|---|
| | 282 | |
|---|
| | 283 | $filelines = @file($filename); |
|---|
| | 284 | if (empty($filelines)) { |
|---|
| | 285 | halt("Error while reading configuration file; $filename does not exist or is empty."); |
|---|
| | 286 | return false; |
|---|
| | 287 | } |
|---|
| | 288 | |
|---|
| | 289 | $filestr = deleteComments($filelines); |
|---|
| | 290 | |
|---|
| | 291 | findCommonSettings($filestr, $full, $incr, $blackout_begin, $blackout_end, $blackout_days); |
|---|
| 309 | | if(!file_exists('/var/lib/backuppc/.ssh')) |
|---|
| 310 | | mkdir("/var/lib/backuppc/.ssh", 0644); |
|---|
| 311 | | if (!file_exists('/var/lib/backuppc/.ssh/id_rsa.pub')) { |
|---|
| 312 | | if (!file_exists('~/.ssh/id_rsa.pub')) |
|---|
| 313 | | exec("ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa"); |
|---|
| 314 | | |
|---|
| 315 | | copy("/root/.ssh/id_rsa", "/var/lib/backuppc/.ssh/id_rsa"); |
|---|
| 316 | | copy("/root/.ssh/id_rsa.pub", "/var/lib/backuppc/.ssh/id_rsa.pub"); |
|---|
| 317 | | } |
|---|
| 318 | | if (!file_exists('/var/lib/backuppc/.ssh/BackupPC_id_rsa.pub')) { |
|---|
| 319 | | copy("/root/.ssh/id_rsa.pub", "/var/lib/backuppc/.ssh/BackupPC_id_rsa.pub"); |
|---|
| 320 | | } |
|---|
| | 309 | $bpchome = "/var/lib/backuppc"; |
|---|
| | 310 | |
|---|
| | 311 | if (!file_exists('$bpchome/.ssh/id_rsa.pub')) { |
|---|
| | 312 | if (!file_exists('$bpchome/.ssh')) |
|---|
| | 313 | mkdir("$bpchome/.ssh", 0700); |
|---|
| | 314 | if (!file_exists('$bpchome/.ssh/id_rsa.pub')) |
|---|
| | 315 | exec("ssh-keygen -t rsa -N '' -f $bpchome/.ssh/id_rsa"); |
|---|
| | 316 | |
|---|
| | 317 | copy("$bpchome/.ssh/id_rsa.pub", "$bpchome/.ssh/BackupPC_id_rsa.pub"); |
|---|
| | 318 | exec("chown -R backuppc:backuppc $bpchome/.ssh/"); |
|---|
| | 319 | exec("chmod -R og-rwx $bpchome/.ssh/"); |
|---|
| | 320 | } |
|---|
| 351 | | $host_file = strtolower($host); |
|---|
| 352 | | $filename = "/etc/backuppc/".$host_file.".pl"; |
|---|
| 353 | | |
|---|
| 354 | | $unchangedConf = getUnchangedConf($host); |
|---|
| 355 | | |
|---|
| 356 | | if (!($fh = fopen($filename, "w"))) |
|---|
| 357 | | halt("cannot create file $filename"); |
|---|
| 358 | | fwrite($fh, "# Configuration of $host\n"); |
|---|
| 359 | | if ($xfermethod == "tarssh") |
|---|
| 360 | | fwrite($fh, "\$Conf{XferMethod} = 'tar';\n\n"); |
|---|
| 361 | | else |
|---|
| 362 | | fwrite($fh, "\$Conf{XferMethod} = '$xfermethod';\n\n"); |
|---|
| 363 | | |
|---|
| 364 | | if ($xfermethod == "tar" || $xfermethod == "tarssh") { |
|---|
| 365 | | fwrite($fh, "\$Conf{TarShareName} = $shares_str;\n\n"); |
|---|
| 366 | | if ($xfermethod == "tar") |
|---|
| 367 | | fwrite($fh, "\$Conf{TarClientCmd} = '/usr/bin/env LANG=en \$tarPath -c -v -f - -C \$shareName --totals';\n\n"); |
|---|
| 368 | | } else |
|---|
| 369 | | if ($xfermethod == "smb" ) { |
|---|
| 370 | | fwrite($fh, "\$Conf{SmbShareName} = $shares_str;\n\n"); |
|---|
| 371 | | fwrite($fh, "\$Conf{SmbShareUserName} = '$username';\n"); |
|---|
| 372 | | fwrite($fh, "\$Conf{SmbSharePasswd} = '$passwd';\n\n"); |
|---|
| 373 | | } else |
|---|
| 374 | | if ($xfermethod == "rsync" || $xfermethod == "rsyncd") { |
|---|
| 375 | | fwrite($fh, "\$Conf{RsyncShareName} = $shares_str;\n\n"); |
|---|
| 376 | | if ($xfermethod == "rsyncd") { |
|---|
| 377 | | fwrite($fh, "\$Conf{RsyncdShareUserName} = '$username';\n"); |
|---|
| 378 | | fwrite($fh, "\$Conf{RsyncdSharePasswd} = '$passwd';\n\n"); |
|---|
| 379 | | } |
|---|
| 380 | | } |
|---|
| | 351 | $host_file = strtolower($host); |
|---|
| | 352 | $filename = "/etc/backuppc/".$host_file.".pl"; |
|---|
| | 353 | |
|---|
| | 354 | $unchangedConf = getUnchangedConf($host); |
|---|
| | 355 | |
|---|
| | 356 | if (!($fh = fopen($filename, "w"))) |
|---|
| | 357 | halt("cannot create file $filename"); |
|---|
| | 358 | fwrite($fh, "# Configuration of $host\n"); |
|---|
| | 359 | if ($xfermethod == "tarssh") |
|---|
| | 360 | fwrite($fh, "\$Conf{XferMethod} = 'tar';\n\n"); |
|---|
| | 361 | else |
|---|
| | 362 | fwrite($fh, "\$Conf{XferMethod} = '$xfermethod';\n\n"); |
|---|
| | 363 | |
|---|
| | 364 | if ($xfermethod == "tar" || $xfermethod == "tarssh") { |
|---|
| | 365 | fwrite($fh, "\$Conf{TarShareName} = $shares_str;\n\n"); |
|---|
| | 366 | if ($xfermethod == "tar") |
|---|
| | 367 | fwrite($fh, "\$Conf{TarClientCmd} = '/usr/bin/env LANG=en \$tarPath -c -v -f - -C \$shareName --totals';\n\n"); |
|---|
| | 368 | } else |
|---|
| | 369 | if ($xfermethod == "smb" ) { |
|---|
| | 370 | fwrite($fh, "\$Conf{SmbShareName} = $shares_str;\n\n"); |
|---|
| | 371 | fwrite($fh, "\$Conf{SmbShareUserName} = '$username';\n"); |
|---|
| | 372 | fwrite($fh, "\$Conf{SmbSharePasswd} = '$passwd';\n\n"); |
|---|
| | 373 | } else |
|---|
| | 374 | if ($xfermethod == "rsync" || $xfermethod == "rsyncd") { |
|---|
| | 375 | fwrite($fh, "\$Conf{RsyncShareName} = $shares_str;\n\n"); |
|---|
| | 376 | if ($xfermethod == "rsyncd") { |
|---|
| | 377 | fwrite($fh, "\$Conf{RsyncdShareUserName} = '$username';\n"); |
|---|
| | 378 | fwrite($fh, "\$Conf{RsyncdSharePasswd} = '$passwd';\n\n"); |
|---|
| | 379 | } |
|---|
| | 380 | } |
|---|