Add option to disable hardlinks

We can probably remove this later based on the use
This commit is contained in:
Girish Ramakrishnan
2017-10-16 15:15:15 -07:00
parent 76d00d4e65
commit 9273a6c726
4 changed files with 18 additions and 2 deletions

View File

@@ -107,7 +107,8 @@ function copy(apiConfig, oldFilePath, newFilePath) {
if (error) return events.emit('done', new BackupsError(BackupsError.EXTERNAL_ERROR, error.message));
// this will hardlink backups saving space
shell.exec('copy', '/bin/cp', [ '-al', oldFilePath, newFilePath ], { }, function (error) {
var cpOptions = apiConfig.noHardlinks ? '-a' : '-al';
shell.exec('copy', '/bin/cp', [ cpOptions, oldFilePath, newFilePath ], { }, function (error) {
if (error) return events.emit('done', new BackupsError(BackupsError.EXTERNAL_ERROR, error.message));
events.emit('done', null);
@@ -159,6 +160,8 @@ function testConfig(apiConfig, callback) {
if (!apiConfig.backupFolder) return callback(new BackupsError(BackupsError.BAD_FIELD, 'backupFolder is required'));
if ('noHardlinks' in apiConfig && typeof apiConfig.noHardlinks !== 'boolean') return callback(new BackupsError(BackupsError.BAD_FIELD, 'noHardlinks must be boolean'));
fs.stat(apiConfig.backupFolder, function (error, result) {
if (error) {
debug('testConfig: %s', apiConfig.backupFolder, error);