mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 13:25:24 +03:00
Create debian packages
This commit is contained in:
parent
ffce26b85e
commit
7fcd4e5567
7 changed files with 122 additions and 30 deletions
7
assets/linux/betaflight-configurator-english.desktop
Normal file
7
assets/linux/betaflight-configurator-english.desktop
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Betaflight Configurator (English)
|
||||||
|
Comment=Crossplatform configuration tool for the Betaflight flight control system
|
||||||
|
Exec=bash -c "LANGUAGE=en /opt/betaflight/betaflight-configurator/betaflight-configurator"
|
||||||
|
Icon=/opt/betaflight/betaflight-configurator/icon/bf_icon_english_128.png
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
7
assets/linux/betaflight-configurator.desktop
Normal file
7
assets/linux/betaflight-configurator.desktop
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Betaflight Configurator
|
||||||
|
Comment=Crossplatform configuration tool for the Betaflight flight control system
|
||||||
|
Exec=/opt/betaflight/betaflight-configurator/betaflight-configurator
|
||||||
|
Icon=/opt/betaflight/betaflight-configurator/icon/bf_icon_128.png
|
||||||
|
Terminal=false
|
||||||
|
Type=Application
|
BIN
assets/linux/icon/bf_icon_128.png
Normal file
BIN
assets/linux/icon/bf_icon_128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
assets/linux/icon/bf_icon_english_128.png
Normal file
BIN
assets/linux/icon/bf_icon_english_128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
120
gulpfile.js
120
gulpfile.js
|
@ -6,15 +6,18 @@ var child_process = require('child_process');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var archiver = require('archiver');
|
var zip = require('gulp-zip');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
var NwBuilder = require('nw-builder');
|
var NwBuilder = require('nw-builder');
|
||||||
var makensis = require('makensis');
|
var makensis = require('makensis');
|
||||||
|
var deb = require('gulp-debian');
|
||||||
|
|
||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
var concat = require('gulp-concat');
|
var concat = require('gulp-concat');
|
||||||
var install = require("gulp-install");
|
var install = require("gulp-install");
|
||||||
|
var rename = require('gulp-rename');
|
||||||
var runSequence = require('run-sequence');
|
var runSequence = require('run-sequence');
|
||||||
|
var mergeStream = require('merge-stream');
|
||||||
var os = require('os');
|
var os = require('os');
|
||||||
|
|
||||||
var distDir = './dist/';
|
var distDir = './dist/';
|
||||||
|
@ -316,14 +319,40 @@ gulp.task('apps', ['dist', 'clean-apps'], function (done) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
runSequence('post-build', function() {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('No platform suitable for the apps task')
|
console.log('No platform suitable for the apps task')
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('post-build', function (done) {
|
||||||
|
|
||||||
|
var platforms = getPlatforms();
|
||||||
|
|
||||||
|
var merged = mergeStream();
|
||||||
|
|
||||||
|
if (platforms.indexOf('linux32') != -1) {
|
||||||
|
// Copy Ubuntu launcher scripts to destination dir
|
||||||
|
var launcherDir = path.join(appsDir, pkg.name, 'linux32');
|
||||||
|
console.log('Copy Ubuntu launcher scripts to ' + launcherDir);
|
||||||
|
merged.add(gulp.src('assets/linux/**')
|
||||||
|
.pipe(gulp.dest(launcherDir)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platforms.indexOf('linux64') != -1) {
|
||||||
|
// Copy Ubuntu launcher scripts to destination dir
|
||||||
|
var launcherDir = path.join(appsDir, pkg.name, 'linux64');
|
||||||
|
console.log('Copy Ubuntu launcher scripts to ' + launcherDir);
|
||||||
|
merged.add(gulp.src('assets/linux/**')
|
||||||
|
.pipe(gulp.dest(launcherDir)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return merged.isEmpty() ? done() : merged;
|
||||||
|
});
|
||||||
// Create debug app directories in ./debug
|
// Create debug app directories in ./debug
|
||||||
gulp.task('debug', ['dist', 'clean-debug'], function (done) {
|
gulp.task('debug', ['dist', 'clean-debug'], function (done) {
|
||||||
var platforms = getPlatforms();
|
var platforms = getPlatforms();
|
||||||
|
@ -392,30 +421,63 @@ function release_win(arch) {
|
||||||
|
|
||||||
// Create distribution package (zip) for windows and linux platforms
|
// Create distribution package (zip) for windows and linux platforms
|
||||||
function release(arch) {
|
function release(arch) {
|
||||||
var src = path.join(appsDir, pkg.name, arch);
|
var src = path.join(appsDir, pkg.name, arch, '**');
|
||||||
var output = fs.createWriteStream(path.join(releaseDir, get_release_filename(arch, 'zip')));
|
var output = get_release_filename(arch, 'zip');
|
||||||
var archive = archiver('zip', {
|
|
||||||
zlib: { level: 9 }
|
console.log('zip package started: ' + arch);
|
||||||
});
|
return gulp.src(src, {base: path.join(appsDir, pkg.name, arch) })
|
||||||
archive.on('warning', function (err) { throw err; });
|
.pipe(rename(function(actualPath){ actualPath.dirname = path.join('Betaflight Configurator', actualPath.dirname) }))
|
||||||
archive.on('error', function (err) { throw err; });
|
.pipe(zip(output))
|
||||||
archive.pipe(output);
|
.pipe(gulp.dest(releaseDir));
|
||||||
archive.directory(src, 'Betaflight Configurator');
|
}
|
||||||
return archive.finalize();
|
|
||||||
|
function release_deb(arch) {
|
||||||
|
|
||||||
|
var debArch;
|
||||||
|
|
||||||
|
switch (arch) {
|
||||||
|
case 'linux32':
|
||||||
|
debArch = 'i386';
|
||||||
|
break;
|
||||||
|
case 'linux64':
|
||||||
|
debArch = 'amd64';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.error("Deb package error, arch: " + arch);
|
||||||
|
process.exit(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Debian package started arch: " + arch);
|
||||||
|
|
||||||
|
return gulp.src([path.join(appsDir, pkg.name, arch, '*')])
|
||||||
|
.pipe(deb({
|
||||||
|
package: pkg.name,
|
||||||
|
version: pkg.version,
|
||||||
|
section: 'base',
|
||||||
|
priority: 'optional',
|
||||||
|
architecture: debArch,
|
||||||
|
maintainer: pkg.author,
|
||||||
|
description: pkg.description,
|
||||||
|
postinst: ['xdg-desktop-menu install /opt/betaflight/betaflight-configurator/betaflight-configurator.desktop /opt/betaflight/betaflight-configurator/betaflight-configurator-english.desktop'],
|
||||||
|
prerm: ['xdg-desktop-menu uninstall betaflight-configurator.desktop betaflight-configurator-english.desktop'],
|
||||||
|
depends: 'libgconf-2-4',
|
||||||
|
changelog: [],
|
||||||
|
_target: 'opt/betaflight/betaflight-configurator',
|
||||||
|
_out: releaseDir,
|
||||||
|
_clean: true
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create distribution package for chromeos platform
|
// Create distribution package for chromeos platform
|
||||||
function release_chromeos() {
|
function release_chromeos() {
|
||||||
var src = distDir;
|
var src = distDir + '/**';
|
||||||
var output = fs.createWriteStream(path.join(releaseDir, get_release_filename('chromeos', 'zip')));
|
var output = get_release_filename('chromeos', 'zip');
|
||||||
var archive = archiver('zip', {
|
|
||||||
zlib: { level: 9 }
|
console.log('chromeos package started');
|
||||||
});
|
return gulp.src(src)
|
||||||
archive.on('warning', function (err) { throw err; });
|
.pipe(zip(output))
|
||||||
archive.on('error', function (err) { throw err; });
|
.pipe(gulp.dest(releaseDir));
|
||||||
archive.pipe(output);
|
|
||||||
archive.directory(src, false);
|
|
||||||
return archive.finalize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create distribution package for macOS platform
|
// Create distribution package for macOS platform
|
||||||
|
@ -446,7 +508,7 @@ function release_osx64() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create distributable .zip files in ./release
|
// Create distributable .zip files in ./release
|
||||||
gulp.task('release', ['apps', 'clean-release'], function () {
|
gulp.task('release', ['apps', 'clean-release'], function (done) {
|
||||||
fs.mkdir(releaseDir, '0775', function(err) {
|
fs.mkdir(releaseDir, '0775', function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.code !== 'EEXIST') {
|
if (err.code !== 'EEXIST') {
|
||||||
|
@ -458,20 +520,24 @@ gulp.task('release', ['apps', 'clean-release'], function () {
|
||||||
var platforms = getPlatforms();
|
var platforms = getPlatforms();
|
||||||
console.log('Packing release.');
|
console.log('Packing release.');
|
||||||
|
|
||||||
|
var merged = mergeStream();
|
||||||
|
|
||||||
if (platforms.indexOf('chromeos') !== -1) {
|
if (platforms.indexOf('chromeos') !== -1) {
|
||||||
release_chromeos();
|
merged.add(release_chromeos());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platforms.indexOf('linux64') !== -1) {
|
if (platforms.indexOf('linux64') !== -1) {
|
||||||
release('linux64');
|
merged.add(release('linux64'));
|
||||||
|
merged.add(release_deb('linux64'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platforms.indexOf('linux32') !== -1) {
|
if (platforms.indexOf('linux32') !== -1) {
|
||||||
release('linux32');
|
merged.add(release('linux32'));
|
||||||
|
merged.add(release_deb('linux32'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platforms.indexOf('osx64') !== -1) {
|
if (platforms.indexOf('osx64') !== -1) {
|
||||||
release_osx64();
|
merged.add(release_osx64());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platforms.indexOf('win32') !== -1) {
|
if (platforms.indexOf('win32') !== -1) {
|
||||||
|
@ -481,6 +547,8 @@ gulp.task('release', ['apps', 'clean-release'], function () {
|
||||||
if (platforms.indexOf('win64') !== -1) {
|
if (platforms.indexOf('win64') !== -1) {
|
||||||
release_win('win64');
|
release_win('win64');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return merged.isEmpty() ? done() : merged;
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['debug']);
|
gulp.task('default', ['debug']);
|
||||||
|
|
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "betaflight-configurator",
|
"name": "betaflight-configurator",
|
||||||
"version": "10.0.0-rc4",
|
"version": "10.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -2036,6 +2036,12 @@
|
||||||
"integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=",
|
"integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"makensis": {
|
||||||
|
"version": "0.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/makensis/-/makensis-0.9.0.tgz",
|
||||||
|
"integrity": "sha512-J7l6dARQ+bnKkSCsvzpLmdwZsEko6lR0M8ljMgfpH1P9Bck3LioQiIwsPCdfL74KPHzO8wWJJpHkhH1bSZkuvQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"map-cache": {
|
"map-cache": {
|
||||||
"version": "0.2.2",
|
"version": "0.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
|
||||||
|
|
|
@ -23,19 +23,23 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"archiver": "^2.0.3",
|
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
"gulp": "~3.9.1",
|
"gulp": "~3.9.1",
|
||||||
"gulp-concat": "~2.6.1",
|
"gulp-concat": "~2.6.1",
|
||||||
|
"gulp-debian": "~0.1.6",
|
||||||
"gulp-install": "^1.1.0",
|
"gulp-install": "^1.1.0",
|
||||||
|
"gulp-rename": "~1.2.2",
|
||||||
|
"gulp-zip": "^4.1.0",
|
||||||
"inflection": "1.12.0",
|
"inflection": "1.12.0",
|
||||||
"jquery-ui-npm": "1.12.0",
|
"jquery-ui-npm": "1.12.0",
|
||||||
"makensis": "^0.9.0",
|
"makensis": "^0.9.0",
|
||||||
|
"merge-stream": "^1.0.1",
|
||||||
"nw-builder": "^3.4.1",
|
"nw-builder": "^3.4.1",
|
||||||
"os": "^0.1.1",
|
"os": "^0.1.1",
|
||||||
"platform-dependent-modules": "0.0.14",
|
"platform-dependent-modules": "0.0.14",
|
||||||
"run-sequence": "^2.2.0",
|
"run-sequence": "^2.2.0",
|
||||||
"temp": "^0.8.3"
|
"temp": "^0.8.3",
|
||||||
|
"title-case": "^2.1.0"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"platformDependentModules": {
|
"platformDependentModules": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue