Skip to content

Commit

Permalink
Merge pull request #77 from simatec/multiplatform
Browse files Browse the repository at this point in the history
(simatec) Code clean for stable Release
  • Loading branch information
simatec authored Dec 24, 2018
2 parents 9c195eb + 03d0ec8 commit 8af6863
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 34 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Backitup is a backup solution that allows cyclical backup of an IoBroker install

## Changelog

### 1.0.0 (24.12.2018)
* (simatec) Stable Release

### 0.4.4 (19.12.2018)
* (simatec) Fix cifs-mount User

Expand Down
13 changes: 12 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"common": {
"name": "backitup",
"version": "0.4.4",
"version": "1.0.0",
"news": {
"1.0.0": {
"en": "Stable Release",
"de": "Stabiles Release",
"ru": "Стабильный релиз",
"pt": "Versão estável",
"nl": "Stabiele vrijlating",
"fr": "Version stable",
"it": "Rilascio stabile",
"es": "Liberación estable",
"pl": "Wersja stabilna"
},
"0.4.4": {
"en": "Fix cifs-mount User",
"de": "Fix Cifs-mount Benutzer",
Expand Down
6 changes: 0 additions & 6 deletions lib/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,13 @@ function executeScripts(adapter, config, callback, scripts, code) {
case 'mysql':
if ((config.name === 'total' || config.name === 'minimal' && config.mysqlEnabled === true) && config[name] && config[name].enabled) {
func = scripts[name];
//options = config[name];
options = Object.assign({}, config[name]);
}
break;

case 'redis':
if ((config.name === 'total' || config.name === 'minimal' && config.redisEnabled === true) && config[name] && config[name].enabled) {
func = scripts[name];
//options = config[name];
options = Object.assign({}, config[name]);
}
break;
Expand Down Expand Up @@ -234,10 +232,6 @@ function executeScripts(adapter, config, callback, scripts, code) {
}
}

// todo
// delete all local files if required from config.context.fileNames
// or delete all files from past backups

adapter && adapter.setState('output.line', '[EXIT] ' + (code || 0));
callback && callback();
}
Expand Down
7 changes: 0 additions & 7 deletions lib/list/cifs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const backupDir = path.join(tools.getIobDir(), 'backups').replace(/\\/g, '/');
function list(options, types, log, callback) {
if (options.enabled && options.source === 'NAS / Copy') {
if (options.mountType === 'CIFS' || options.mountType === 'NFS') {
//mount(options, log, () => nasList(options, types, log, callback));
mount(options, log, error => {
error && log.error(error);
nasList(options, types, log, callback);
Expand Down Expand Up @@ -63,11 +62,6 @@ function nasList(options, types, log, callback) {
});
}
}
/*if (options.mountType === 'CIFS' || options.mountType === 'NFS') {
umount(options, log, error => callback && callback(error, files, 'nas / copy'));
} else {
callback && callback(null, files, 'nas / copy');
}*/
callback && callback(null, files, 'nas / copy');
} else {
setImmediate(callback);
Expand Down Expand Up @@ -101,7 +95,6 @@ function copyFileCifs(options, fileName, toStoreName, log, callback) {
function getFile(options, fileName, toStoreName, log, callback) {
if (options.enabled) {
if (options.mountType === 'CIFS' || options.mountType === 'NFS') {
//mount(options, log, () => copyFileCifs(options, fileName, toStoreName, log, callback));
callback(null);
} else {
copyFileCifs(options, fileName, toStoreName, log, callback);
Expand Down
1 change: 0 additions & 1 deletion lib/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function startIOB() {
const cmd = spawn(isWin ? 'startIOB.bat' : 'bash', [isWin ? '' : 'startIOB.sh'], {detached: true, cwd: __dirname, stdio: ['ignore', 'ignore', 'ignore']});

cmd.unref();
//setTimeout(() => process.exit(), 1000);
setTimeout(function() {
process.exit();
}, 1000);
Expand Down
4 changes: 0 additions & 4 deletions lib/restore/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ function restore(options, fileName, log, callback) {
try {
targz.decompress({
src: fileName,
// options.path is not defined.
// Dest.wrong dest: options.path,
dest: options.backupDir,
tar: {
map: header => {

// Dest.wrong header.name = fileNameMysql; // rename "." to mysql_restore_backupiobroker.sql
header.name = `mysql_restore_backupiobroker.sql`;
return header;
}
Expand Down
3 changes: 0 additions & 3 deletions lib/scripts/30-mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ function command(options, log, callback) {
clearInterval(timer);

if (err) {
//options.context.errors.mysql = err.toString();
//log.error(stderr);
if (callback) {
callback(err, stderr);
callback = null;
Expand All @@ -66,7 +64,6 @@ function command(options, log, callback) {
}
});
stream.end();
//options.context.done.push('mysql');
callback();
});

Expand Down
1 change: 0 additions & 1 deletion lib/scripts/60-cifs.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ function command(options, log, callback) {
});
} else if (options.mountType === 'Copy') {
callback(`Path "${options.dir}" not found`);
// backupDir files will be cleaned in 78-clean.js task
} else {
callback();
}
Expand Down
4 changes: 0 additions & 4 deletions lib/scripts/78-clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ function command(options, log, callback) {
const errors = Object.keys(options.context.errors);

if (!errors.length) {
/*if (deleteFiles(fileNames, log, options.context.errors)) {
options.context.done.push('clean');
}*/

// may be do it configurable
let dir = options.backupDir.replace(/\\/g, '/');

Expand Down
1 change: 0 additions & 1 deletion lib/scripts/92-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function command(options, log, callback) {
}

if (historyArray.length > options.entriesNumber) {
// todo: test it!
historyArray.splice(options.entriesNumber, historyArray.length - options.entriesNumber);
}

Expand Down
5 changes: 0 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ function initConfig(secret) {
ftp: Object.assign({}, ftp, (adapter.config.ftpOwnDir === true) ? {dir: adapter.config.ftpMinimalDir} : {}),
cifs: Object.assign({}, cifs, (adapter.config.cifsOwnDir === true) ? {dir: adapter.config.cifsMinimalDir} : {}),
dropbox: Object.assign({}, dropbox, (adapter.config.dropboxOwnDir === true) ? {dir: adapter.config.dropboxMinimalDir} : {}),
//mysql,
mysql: {
enabled: adapter.config.mySqlEnabled === undefined ? true : adapter.config.mySqlEnabled,
type: 'creator',
Expand Down Expand Up @@ -399,8 +398,6 @@ function initConfig(secret) {
telegram,
email,
pushover,

//mysql,
mysql: {
enabled: adapter.config.mySqlEnabled === undefined ? true : adapter.config.mySqlEnabled,
type: 'creator',
Expand Down Expand Up @@ -479,7 +476,6 @@ function createBashScripts() {
}

if (isWin) {
// todo detect service
if (!fs.existsSync(__dirname + '/lib/stopIOB.bat')) {
fs.writeFileSync(__dirname + '/lib/stopIOB.bat', `cd "${path.join(tools.getIobDir())}"\ncall serviceIoBroker.bat stop\ncd "${path.join(__dirname, 'lib')}"\nnode execute.js`);
}
Expand All @@ -493,7 +489,6 @@ function createBashScripts() {
fs.writeFileSync(__dirname + '/lib/stop_r_IOB.bat', `cd "${path.join(tools.getIobDir())}"\ncall serviceIoBroker.bat stop\ncd "${path.join(__dirname, 'lib')}"\nnode restore.js`);
}
} else {
// todo detect pm2 or systemd
if (!fs.existsSync(__dirname + '/lib/stopIOB.sh')) {
fs.writeFileSync(__dirname + '/lib/stopIOB.sh', `cd "${path.join(tools.getIobDir())}"\nbash iobroker stop\ncd "${path.join(__dirname, 'lib')}"\nnode execute.js`);
fs.chmodSync(__dirname + '/lib/stopIOB.sh', 508);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.backitup",
"version": "0.4.4",
"version": "1.0.0",
"engines": {
"node": ">=6.0.0"
},
Expand Down

0 comments on commit 8af6863

Please sign in to comment.