Skip to content

Commit

Permalink
Add shell script to AppImage to fix #26
Browse files Browse the repository at this point in the history
  • Loading branch information
jely2002 committed Dec 3, 2020
1 parent 0f8bb74 commit 109ac77
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 183 deletions.
20 changes: 20 additions & 0 deletions fix-linux-builds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const execa = require ( 'execa' ),
fs = require ( 'fs' ),
path = require ( 'path' );

function isLinux ( targets ) {
const re = /AppImage|snap|deb|rpm|freebsd|pacman/i;
return !!targets.find ( target => re.test ( target.name ) );
}

async function afterPack ({ targets, appOutDir }) {
if ( !isLinux ( targets ) ) return;
const scriptPath = path.join(appOutDir, 'youtube-dl-gui'),
script = '#!/bin/bash\n"${BASH_SOURCE%/*}"/youtube-dl-gui.bin "$@" --no-sandbox';
await execa('mv', ['youtube-dl-gui', 'youtube-dl-gui.bin'], {"cwd": appOutDir});
fs.writeFileSync (scriptPath, script);
await execa ('chmod', ['+x', 'youtube-dl-gui'], {"cwd": appOutDir});

}

module.exports = afterPack;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"url": "https://github.com/jely2002/youtube-dl-gui.git"
},
"build": {
"afterAllArtifactBuild": "./repack-appimage.js",
"afterPack": "./fix-linux-builds.js",
"appId": "com.jelleglebbeek.youtube-dl-gui",
"productName": "YouTube Downloader GUI",
"copyright": "Copyright © 2020 Jelle Glebbeek",
Expand Down
182 changes: 0 additions & 182 deletions repack-appimage.js

This file was deleted.

0 comments on commit 109ac77

Please sign in to comment.