diff options
author | A user <pedro.santos.cartaxo@gmail.com> | 2022-12-02 12:55:53 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 16:55:53 +0100 |
commit | 62b2acebe6806c7b0e2ca6a43c6b2419a627b8dc (patch) | |
tree | 381d6f7420fc8ead35ce1dca09ef79df98ab8ce9 /scripts | |
parent | 41dddc9eee6f19fb5055545811aff1e282790a9c (diff) | |
download | Vencord-62b2acebe6806c7b0e2ca6a43c6b2419a627b8dc.tar.gz Vencord-62b2acebe6806c7b0e2ca6a43c6b2419a627b8dc.tar.bz2 Vencord-62b2acebe6806c7b0e2ca6a43c6b2419a627b8dc.zip |
Add support for Flatpak for Git updating (#274)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/patcher/install.js | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/scripts/patcher/install.js b/scripts/patcher/install.js index 036b0fa..852f3a2 100755 --- a/scripts/patcher/install.js +++ b/scripts/patcher/install.js @@ -39,6 +39,7 @@ const { getDarwinDirs, getLinuxDirs, ENTRYPOINT, + question } = require("./common"); switch (process.platform) { @@ -62,15 +63,14 @@ async function install(installations) { // Attempt to give flatpak perms if (selected.isFlatpak) { try { - const { branch } = selected; const cwd = process.cwd(); - const globalCmd = `flatpak override ${branch} --filesystem=${cwd}`; - const userCmd = `flatpak override --user ${branch} --filesystem=${cwd}`; + const globalCmd = `flatpak override ${selected.branch} --filesystem=${cwd}`; + const userCmd = `flatpak override --user ${selected.branch} --filesystem=${cwd}`; const cmd = selected.location.startsWith("/home") ? userCmd : globalCmd; execSync(cmd); - console.log("Successfully gave write perms to Discord Flatpak."); + console.log("Gave write perms to Discord Flatpak."); } catch (e) { console.log("Failed to give write perms to Discord Flatpak."); console.log( @@ -79,6 +79,29 @@ async function install(installations) { ); process.exit(1); } + + const answer = await question( + `Would you like to allow ${selected.branch} to talk to org.freedesktop.Flatpak?\n` + + "This is essentially full host access but necessary to spawn git. Without it, the updater will not work\n" + + "Consider using the http based updater (using the gui installer) instead if you want to maintain the sandbox.\n" + + "[y/N]: " + ); + + if (["y", "yes", "yeah"].includes(answer.toLowerCase())) { + try { + const globalCmd = `flatpak override ${selected.branch} --talk-name=org.freedesktop.Flatpak`; + const userCmd = `flatpak override --user ${selected.branch} --talk-name=org.freedesktop.Flatpak`; + const cmd = selected.location.startsWith("/home") + ? userCmd + : globalCmd; + execSync(cmd); + console.log("Sucessfully gave talk permission"); + } catch (err) { + console.error("Failed to give talk permission\n", err); + } + } else { + console.log(`Not giving full host access. If you change your mind later, you can run:\nflatpak override ${selected.branch} --talk-name=org.freedesktop.Flatpak`); + } } for (const version of selected.versions) { |