mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
Debian Packaging support added
This commit is contained in:
parent
2d42bbd23d
commit
fffdd336c6
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,7 +4,9 @@ dist/
|
||||
# user specific
|
||||
cache/
|
||||
local/
|
||||
# debian build specific
|
||||
deb-struct/usr
|
||||
# deply build binaries
|
||||
deploy/linux/build
|
||||
deploy/win32/build
|
||||
deploy/darwin/build
|
||||
deploy/darwin/build
|
||||
|
10
control
Normal file
10
control
Normal file
@ -0,0 +1,10 @@
|
||||
Package: Spotube
|
||||
Version: 0.0.1
|
||||
Section: sound
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Essential: no
|
||||
Installed-Size: 44000
|
||||
Maintainer: KR Tirtho
|
||||
Description: A music streaming app combining the power of Spotify & Youtube
|
||||
Homepage: https://github.com/KRTirtho/spotube
|
4
deb-config.json
Normal file
4
deb-config.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"appName": "name",
|
||||
"version": "0.1"
|
||||
}
|
10
deb-struct/DEBIAN/control
Normal file
10
deb-struct/DEBIAN/control
Normal file
@ -0,0 +1,10 @@
|
||||
Package: Spotube
|
||||
Version: 0.0.1
|
||||
Section: sound
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Essential: no
|
||||
Installed-Size: 44000
|
||||
Maintainer: KR Tirtho
|
||||
Description: A music streaming app combining the power of Spotify & Youtube
|
||||
Homepage: https://github.com/KRTirtho/spotube
|
3
deploy/linux/spotube/Spotube Icon.svg
Normal file
3
deploy/linux/spotube/Spotube Icon.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024" width="1024" height="1024"><defs><path d="M864.5 488.49C864.5 680.95 708.5 837.21 516.36 837.21C324.22 837.21 168.22 680.95 168.22 488.49C168.22 296.03 324.22 139.78 516.36 139.78C708.5 139.78 864.5 296.03 864.5 488.49Z" id="amHaSVpu"></path><path d="" id="a2BJMy7Jb"></path><path d="M311.12 310.07C313.34 313.32 304.24 320.57 310.85 329.83C318.01 339.85 343.74 336.24 360.41 316.59C372.91 301.85 475.1 266.53 511.85 269.93C588.19 276.99 575.39 271.83 590.61 281.1C596.7 284.81 639.52 293.78 662.13 310.85C684.73 327.91 711.65 343.39 715.92 338.17C725.54 326.39 743.34 305.37 658.01 254.46C616.69 229.81 620.32 239.57 587.05 230.59C533.9 216.24 472.16 220.95 401.83 244.73C336.72 281.52 306.48 303.3 311.12 310.07Z" id="a1tDWZImgU"></path><path d="M411.75 413.54C413 415.03 367.9 428.18 360.73 442.12C349.52 463.92 375.04 487.76 385.62 472.66C392.39 463 485.79 428.29 508.37 428.23C555.27 428.11 596.35 438.36 606.16 443.1C614 446.9 672.19 473.83 676.79 467C681.97 459.31 702.29 441.03 647.4 415.1C607.69 396.35 600.7 394.71 570 390.75C547.31 387.83 524.26 387.05 500.84 388.41C438.23 401.33 408.53 409.7 411.75 413.54Z" id="d5X4Y3iXxi"></path><path d="M401.51 326.48C402.99 328.06 352.9 339.29 345.48 353.13C333.86 374.78 363.61 400.24 374.82 385.38C381.99 375.88 485.36 345.01 510.73 346.03C563.41 348.13 610.02 360.52 621.25 365.81C630.24 370.04 696.82 400.2 701.68 393.48C707.16 385.9 729.17 368.27 666.33 339.28C620.88 318.31 612.95 316.31 578.28 310.83C552.66 306.77 526.72 304.88 500.48 305.15C430.72 315.32 397.73 322.42 401.51 326.48Z" id="caQrsW984"></path><path d="M538.91 551.22C529.19 537.59 505.67 536.18 497.12 555.44C488.61 574.6 420.53 727.92 412.02 747.09C404.35 764.36 418.47 783.09 436.92 780.92C457.39 778.53 621.12 759.48 641.58 757.1C659.83 755 669.2 734.02 658.48 719.06C634.56 685.49 550.87 568 538.91 551.22Z" id="gcFKZeS95"></path><path d="M520.79 470.72C521.19 474.45 518.48 477.8 514.75 478.2C512.05 478.49 510.72 478.63 508.02 478.92C504.28 479.32 500.93 476.61 500.53 472.88C500.01 467.97 499.16 460.01 498.64 455.1C498.24 451.36 500.94 448.01 504.68 447.62C507.38 447.33 508.71 447.19 511.41 446.9C515.14 446.5 518.49 449.2 518.89 452.94C519.42 457.85 520.27 465.81 520.79 470.72Z" id="aFNm6T4Ou"></path><path d="M525.36 513.59C525.76 517.32 523.06 520.67 519.32 521.07C516.62 521.36 515.29 521.5 512.59 521.79C508.86 522.19 505.51 519.48 505.11 515.75C504.58 510.84 503.73 502.88 503.21 497.97C502.81 494.23 505.52 490.88 509.25 490.48C511.95 490.2 513.28 490.05 515.98 489.77C519.72 489.37 523.07 492.07 523.47 495.81C523.99 500.71 524.84 508.68 525.36 513.59Z" id="f44lxYrdu7"></path></defs><g><g><g><use xlink:href="#amHaSVpu" opacity="1" fill="#1db954" fill-opacity="1"></use></g><g><g><use xlink:href="#a2BJMy7Jb" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="1"></use></g></g><g><g><use xlink:href="#a1tDWZImgU" opacity="1" fill="#ffffff" fill-opacity="1"></use></g><g><use xlink:href="#d5X4Y3iXxi" opacity="1" fill="#ffffff" fill-opacity="1"></use></g><g><use xlink:href="#caQrsW984" opacity="1" fill="#ffffff" fill-opacity="1"></use></g></g><g><use xlink:href="#gcFKZeS95" opacity="1" fill="#ffffff" fill-opacity="1"></use><g><use xlink:href="#gcFKZeS95" opacity="1" fill-opacity="0" stroke="#000000" stroke-width="1" stroke-opacity="0"></use></g></g><g><g><use xlink:href="#aFNm6T4Ou" opacity="1" fill="#ffffff" fill-opacity="1"></use></g><g><use xlink:href="#f44lxYrdu7" opacity="1" fill="#ffffff" fill-opacity="1"></use></g></g></g></g></svg>
|
After Width: | Height: | Size: 3.7 KiB |
@ -2,7 +2,7 @@
|
||||
Type=Application
|
||||
Name=Spotube
|
||||
Exec=AppRun
|
||||
Icon=default
|
||||
Icon=spotube
|
||||
Comment=A music streaming app combining the power of Spotify & Youtube
|
||||
Terminal=true
|
||||
Terminal=false
|
||||
Categories=Music;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 58 KiB |
BIN
deploy/linux/spotube/spotube.png
Normal file
BIN
deploy/linux/spotube/spotube.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
@ -11,7 +11,8 @@
|
||||
"start": "qode ./dist/index.js",
|
||||
"start:trace": "qode ./dist/index.js --trace",
|
||||
"debug": "qode --inspect ./dist/index.js",
|
||||
"pack": "nodegui-packer -p ./dist"
|
||||
"pack": "nodegui-packer -p ./dist",
|
||||
"pack-deb": "node scripts/build-deb.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nodegui/nodegui": "^0.27.0",
|
||||
|
86
scripts/build-deb.js
Normal file
86
scripts/build-deb.js
Normal file
@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const process = require("child_process");
|
||||
// Get the foldername
|
||||
const deployDir = path.join("deploy"); // ./deploy relative to where command is executed
|
||||
const debStructDir = path.join(__dirname, "..", "deb-struct"); // ./deb-struct relative to where command is executed
|
||||
const configFile = path.join(deployDir, "config.json");
|
||||
const appName = JSON.parse(fs.readFileSync(configFile, { encoding: 'utf8' })).appName;
|
||||
const appNameSanitized = appName.replace(' ', '').toLowerCase();
|
||||
const buildFolder = path.join(deployDir, "linux", "build", appName);
|
||||
function cleanDirectories() {
|
||||
console.log("Cleaning DEBIAN:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/DEBIAN/*'));
|
||||
console.log("Cleaning bin:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/usr/bin/*'));
|
||||
console.log("Cleaning lib:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/usr/lib/*'));
|
||||
console.log("Cleaning applications:");
|
||||
console.log(process.execSync('rm -rf ' + debStructDir + '/usr/share/applications/*'));
|
||||
}
|
||||
function copyControlFile() {
|
||||
console.log("Copying control:");
|
||||
console.log(process.execSync('cp ./control ' + debStructDir + '/DEBIAN/control'));
|
||||
}
|
||||
function copyBuildFolderToLib() {
|
||||
const folderPath = path.join(debStructDir, "usr", "lib");
|
||||
console.log("Copying Build Folder:");
|
||||
console.log(process.execSync('cp -R "' + buildFolder + '" "' + folderPath + '"'));
|
||||
console.log(process.execSync('cp -R ./assets "' + path.join(folderPath, appName) + '"'));
|
||||
if (appName !== appNameSanitized) {
|
||||
console.log(process.execSync('mv "' + path.join(folderPath, appName) + '" "' + path.join(folderPath, appNameSanitized) + '"'));
|
||||
}
|
||||
}
|
||||
function createSymlinkToBin() {
|
||||
const folderPath = '"' + path.join(debStructDir, "usr", "bin", appName) + '"';
|
||||
console.log("Generating Symlink:");
|
||||
console.log(process.execSync('ln -s /usr/lib/' + appNameSanitized + '/qode ' + folderPath));
|
||||
}
|
||||
function copyDesktopFileToApplications() {
|
||||
console.log("Copying Desktop File:");
|
||||
const desktopSrc = path.join(buildFolder, getFilesFromPath(buildFolder, '.desktop')[0]);
|
||||
const desktopDest = path.join(debStructDir, 'usr', 'share', 'applications', appName.replace(' ', '').toLowerCase() + '.desktop');
|
||||
console.log(process.execSync('cp "' + desktopSrc + '" "' + desktopDest + '"'));
|
||||
// Copy icon and change relative Icon path to absolute path
|
||||
const desktopContents = fs.readFileSync(desktopDest).toString();
|
||||
let m;
|
||||
const regex = /^Icon=(.*)$/m;
|
||||
const matches = regex.exec(desktopContents);
|
||||
if (matches && matches.length > 1) {
|
||||
const iconFileName = matches[1];
|
||||
if (!path.isAbsolute(iconFileName)) {
|
||||
// check if file exists, look for extensions {.png,.svg,.svgz,.xpm} as @nodegui/packer does
|
||||
let iconFileExt = '';
|
||||
for (const fileExt of ['png', 'svg', 'svgz', 'xpm']) {
|
||||
if (fs.existsSync(path.join(path.dirname(desktopSrc), iconFileName + '.' + fileExt))) {
|
||||
iconFileExt = fileExt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!iconFileExt) {
|
||||
throw new Error(iconFileName + '{.png,.svg,.svgz,.xpm} defined in desktop file but not found in ' + path.dirname(desktopSrc));
|
||||
}
|
||||
const absIconPath = '/' + path.join('usr', 'lib', appNameSanitized, iconFileName + '.' + iconFileExt);
|
||||
fs.writeFileSync(desktopDest, desktopContents.replace(regex, 'Icon=' + absIconPath));
|
||||
console.log('Adjusted relative icon path: ' + iconFileName + ' => ' + absIconPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createDeb() {
|
||||
// Create DEBIAN File
|
||||
console.log("Generating Debian:");
|
||||
console.log(process.execSync('dpkg-deb --build "' + debStructDir + '" "' + appNameSanitized + '.deb"'));
|
||||
}
|
||||
function getFilesFromPath(path, extension) {
|
||||
let files = fs.readdirSync(path);
|
||||
return files.filter(file => file.match(new RegExp(`.*\.(${extension})`, 'ig')));
|
||||
}
|
||||
cleanDirectories();
|
||||
copyControlFile();
|
||||
copyBuildFolderToLib();
|
||||
createSymlinkToBin();
|
||||
copyDesktopFileToApplications();
|
||||
createDeb();
|
||||
//# sourceMappingURL=build-deb.js.map
|
Loading…
Reference in New Issue
Block a user