Use unzip if available

pull/125/head
Piero Toffanin 2020-09-10 12:55:22 -04:00
rodzic 802d72a48b
commit 8439a04fd4
6 zmienionych plików z 30 dodań i 9 usunięć

Wyświetl plik

@ -5,7 +5,7 @@ EXPOSE 3000
USER root
RUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs python-gdal p7zip-full && npm install -g nodemon && \
RUN apt-get install -y nodejs python-gdal unzip p7zip-full && npm install -g nodemon && \
ln -s /code/SuperBuild/install/bin/entwine /usr/bin/entwine && \
ln -s /code/SuperBuild/install/bin/pdal /usr/bin/pdal

Wyświetl plik

@ -54,11 +54,11 @@ If you are already running [ODM](https://github.com/OpenDroneMap/ODM) on Ubuntu
1) Install Entwine: https://entwine.io/quickstart.html#installation
2) Install node.js, npm dependencies and 7zip:
2) Install node.js, npm dependencies, 7zip and unzip:
```bash
sudo curl --silent --location https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install -y nodejs python-gdal p7zip-full
sudo apt-get install -y nodejs python-gdal p7zip-full unzip
git clone https://github.com/OpenDroneMap/NodeODM
cd NodeODM
npm install

Wyświetl plik

@ -119,7 +119,8 @@ config.maxConcurrency = parseInt(argv.max_concurrency || fromConfigFile("maxConc
config.maxRuntime = parseInt(argv.max_runtime || fromConfigFile("maxRuntime", -1));
// Detect 7z availability
const childProcess = spawnSync("7z", ['--help']);
config.has7z = childProcess.status === 0;
config.has7z = spawnSync("7z", ['--help']).status === 0;
config.hasUnzip = spawnSync("unzip", ['--help']).status === 0;
module.exports = config;

Wyświetl plik

@ -901,9 +901,9 @@ if (config.test) {
if (config.testDropUploads) logger.info("Uploads will drop at random");
}
if (!config.has7z){
logger.warn("The 7z program is not installed, falling back to legacy (zipping will be slower)");
}
if (!config.hasUnzip) logger.warn("The unzip program is not installed, (certain unzip operations might be slower)");
if (!config.has7z) logger.warn("The 7z program is not installed, falling back to legacy (zipping will be slower)");
let commands = [
cb => odmInfo.initialize(cb),

Wyświetl plik

@ -107,5 +107,13 @@ module.exports = {
},
["destination", "file"],
null,
false),
unzip: makeRunner("unzip", function(options){
const opts = options.noDirectories ? ["-j"] : [];
return opts.concat(["-qq", "-o", options.file, "-d", options.destination]);
},
["destination", "file"],
null,
false)
};

Wyświetl plik

@ -5,7 +5,19 @@ const fs = require('fs');
module.exports = {
unzip: function(file, outputDir, cb, noDirectories = false){
if (config.has7z){
if (config.hasUnzip){
processRunner.unzip({
file: file,
destination: outputDir,
noDirectories
}, (err, code, _) => {
if (err) cb(err);
else{
if (code === 0) cb();
else cb(new Error(`Could not extract .zip file, unzip exited with code ${code}`));
}
});
}else if (config.has7z){
processRunner.sevenUnzip({
file: file,
destination: outputDir,