-
-
Notifications
You must be signed in to change notification settings - Fork 83
Add automated installation script for Linux #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
snappyapple632
wants to merge
7
commits into
GooseMod:main
Choose a base branch
from
snappyapple632:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fc82305
Add automated install script for Linux
snappyapple632 0ffd1e9
Remove prompt for existing installation
snappyapple632 25a8ff9
Update install-openasar.sh
snappyapple632 2d48008
Fix mistake in oAsarInstall
snappyapple632 a513528
Added message for Snap installations
snappyapple632 fc7aed8
Merge branch 'GooseMod:main' into main
snappyapple632 e5faf6a
Remove redundant cd for Snap check
snappyapple632 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| #!/bin/bash | ||
|
|
||
| # _______ _______ _______ _ _______ _______ _______ _______ | ||
| # ( ___ )( ____ )( ____ \( ( /|( ___ )( ____ \( ___ )( ____ ) | ||
| # | ( ) || ( )|| ( \/| \ ( || ( ) || ( \/| ( ) || ( )| | ||
| # | | | || (____)|| (__ | \ | || (___) || (_____ | (___) || (____)| | ||
| # | | | || _____)| __) | (\ \) || ___ |(_____ )| ___ || __) | ||
| # | | | || ( | ( | | \ || ( ) | ) || ( ) || (\ ( | ||
| # | (___) || ) | (____/\| ) \ || ) ( |/\____) || ) ( || ) \ \__ | ||
| # (_______)|/ (_______/|/ )_)|/ \|\_______)|/ \||/ \__/ | ||
| # | ||
| # Installation Script for Linux. | ||
| # | ||
| # Main program: | ||
| # Checks for the existance of several common directories that Discord installs itself into. | ||
| # If one is found, it `cd`s into it, alerts user of incoming sudo prompt, and hands over to oAsarInstall. | ||
| # | ||
| # oAsarInstall: | ||
| # If no current installation of OpenAsar is found (indicated by the abscence of an "app.asar.bak" file), | ||
| # the script renames the current "app.asar" to "app.asar.bak", then downloads OpenAsar from | ||
| # the nightly GitHub page (via wget) into the current working directory. | ||
| # A sudo prompt will appear to place OpenAsar into the directory. | ||
| # If a current installation of OpenAsar DOES exist, the script will replace it. | ||
|
|
||
|
|
||
| oAsarInstall() | ||
| { | ||
| echo | ||
|
|
||
| if [ -a "app.asar.bak" ]; then | ||
| sudo rm app.asar | ||
| fi | ||
|
|
||
| sudo mv app.asar app.asar.bak | ||
| sudo wget --no-verbose https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this script always installs with sudo, even if the installation is a user installed flatpak in the $HOME directory, installing files owned by root in a user's HOME is a bad idea |
||
| echo | ||
| echo "OpenAsar has been installed! If Discord is still running, restart it." | ||
| exit 0 | ||
| } | ||
|
|
||
| echo "Checking file directories..." | ||
| echo | ||
| #Find which directory Discord is installed in. If it exists, move to oAsarInstall | ||
| if [ -d "/opt/discord/resources/" ]; then | ||
| cd /opt/discord/resources/ | ||
|
|
||
| echo "Found Discord installation in /opt/. You will now see a sudo prompt to download and install OpenAsar." | ||
| oAsarInstall | ||
| else | ||
| echo "/opt/discord/resources/ not found" | ||
| fi | ||
|
|
||
| if [ -d "/usr/lib/discord/resources/" ]; then | ||
| cd /usr/lib/discord/resources/ | ||
|
|
||
| echo "Found Discord installation in /usr/lib/. You will now see a sudo prompt to download and install OpenAsar." | ||
| oAsarInstall | ||
| else | ||
| echo "/usr/lib/discord/resources/ not found" | ||
| fi | ||
|
|
||
| if [ -d "/usr/lib64/discord/resources/" ]; then | ||
| cd /usr/lib64/discord/resources/ | ||
|
|
||
| echo "Found Discord installation in /usr/lib64/. You will now see a sudo prompt to download and install OpenAsar." | ||
| oAsarInstall | ||
| else | ||
| echo "/usr/lib64/discord/resources/ not found" | ||
| fi | ||
|
|
||
| if [ -d "/usr/share/discord/resources/" ]; then | ||
| cd /usr/share/discord/resources/ | ||
|
|
||
| echo "Found Discord installation in /usr/share/. You will now see a sudo prompt to download and install OpenAsar." | ||
| oAsarInstall | ||
| else | ||
| echo "/usr/share/discord/resources/ not found" | ||
| fi | ||
|
|
||
| if [ -d "/var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/" ]; then | ||
| cd /var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/ | ||
|
|
||
| echo "Found Discord installation in /var/lib/flatpak/app/. You will now see a sudo prompt to download and install OpenAsar." | ||
| oAsarInstall | ||
| else | ||
| echo "/var/lib/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/ dosen't exist" | ||
| fi | ||
|
|
||
| if [ -d "$HOME/.local/share/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/" ]; then | ||
| cd "$HOME/.local/share/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/" | ||
|
|
||
| echo "Found Discord installation in ~/.local/share/flatpak/app/. You will now see a sudo prompt to download and install OpenAsar." | ||
| oAsarInstall | ||
| else | ||
| echo "$HOME/.local/share/flatpak/app/com.discordapp.Discord/current/active/files/discord/resources/ not found" | ||
| fi | ||
|
|
||
| if [ -d "/snap/discord/current/usr/share/discord/resources/" ]; then | ||
| echo | ||
| echo "Found Discord installation in Snap, but Snap packages are read-only. Consider using Flatpak or your distribution's native installation option." | ||
|
|
||
| exit 2 | ||
| fi | ||
|
|
||
| #None of the directory searches are successful | ||
| echo "No Discord directories were found. Exiting..." | ||
| exit 1 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing the non .bak app.asar is most definitely not what the script wants to be doing if the next line is mv app.asar app.asar.bak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that the mv would clobber the file anyway so we could just delete this just as well, I just thought to at least not have it destroy the current app.asar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would personally do if the .bak exists delete it, then copy (move) the original to the .bak ideally youd also want a way to backup the initial non-openasar too but that'd be more complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made my own basic bash script that does exactly that for myself, it just compares the file size, the non openasar .asar is huge so it's easy to tell them apart