-
Notifications
You must be signed in to change notification settings - Fork 45
Feat: Linux Installation Script #122
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
reisaraujo-miguel
wants to merge
25
commits into
MakovWait:main
Choose a base branch
from
reisaraujo-miguel:feat/desktop-integration
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
25 commits
Select commit
Hold shift + click to select a range
a720bdb
feat: add desktop integration
reisaraujo-miguel be959cc
chore: fix several erros and warnings
reisaraujo-miguel 05698c0
chore: don't create desktop entry when launching from editor
reisaraujo-miguel 41f28a6
Fix: handle debug builds and fix some vriable naming and comments
reisaraujo-miguel f602296
Revert "chore: fix several erros and warnings"
reisaraujo-miguel ab9ce8c
Reverting non feature related changes
reisaraujo-miguel 1c6656e
Revert "Fix: handle debug builds and fix some vriable naming and comm…
reisaraujo-miguel b834d98
Revert "chore: don't create desktop entry when launching from editor"
reisaraujo-miguel 215195e
Revert "chore: fix several erros and warnings"
reisaraujo-miguel 84e746d
Revert "feat: add desktop integration"
reisaraujo-miguel 2b0445e
Fix: Reverting everything and addig an installation script
reisaraujo-miguel b0d0e84
Revert "Reverting non feature related changes"
reisaraujo-miguel fcdd5f0
Revert "Reverting all the desktop integration code"
reisaraujo-miguel 435a59b
Revert "Fix: handle debug builds and fix some vriable naming and comm…
reisaraujo-miguel 59c9efb
Revert "chore: don't create desktop entry when launching from editor"
reisaraujo-miguel 1fd8807
Revert "chore: fix several erros and warnings"
reisaraujo-miguel 1354ede
Revert "feat: add desktop integration"
reisaraujo-miguel 8d02b15
Merge branch 'main' into feat/desktop-integration
reisaraujo-miguel 4ddf93b
add exit conditions and fix desktop exec and icon paths
reisaraujo-miguel 3cae8d9
Handle edge cases and update desktop database after install
reisaraujo-miguel 3768d76
fix typo
reisaraujo-miguel 380cf5f
Merge remote-tracking branch 'upstream/main' into feat/desktop-integr…
reisaraujo-miguel e56337e
chore: add install script instruction on README
reisaraujo-miguel e7b21f9
fix: fix gtk-update-icon-cache command
reisaraujo-miguel 3f89b0f
feat: verifies checksum and adds some error handleling
reisaraujo-miguel 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
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,177 @@ | ||
| #!/bin/env bash | ||
|
|
||
| GODOTS_DOWNLOAD_URL="https://github.com/MakovWait/godots/releases/latest/download/LinuxX11.zip" | ||
| GODOTS_TMP_DIR="/tmp/godots" | ||
|
|
||
| GODOTS_CHECKSUM_URL="https://github.com/MakovWait/godots/releases/latest/download/SHA512-SUMS.txt" | ||
|
|
||
| if [[ -z "$XDG_DATA_HOME" ]]; then | ||
| GODOTS_INSTALL_DIR="$XDG_DATA_HOME/godots" | ||
| else | ||
| GODOTS_INSTALL_DIR="$HOME/.local/share/godots" | ||
| fi | ||
|
|
||
| GODOTS_BIN_PATH="$GODOTS_INSTALL_DIR/Godots.x86_64" | ||
|
|
||
| ICON_DOWNLOAD_URL="https://raw.githubusercontent.com/MakovWait/godots/refs/heads/main/icon.svg" | ||
|
|
||
| try_download() { | ||
| download_url=$1 | ||
| path=$2 | ||
| if command -v wget &>/dev/null; then | ||
| wget --show-progress --tries=3 -q -P "$path" "$download_url" || { | ||
| printf "Error: Download failed.\n" | ||
| exit 1 | ||
| } | ||
| elif command -v curl &>/dev/null; then | ||
| curl -fSL --progress-bar -O --output-dir "$path" "$download_url" || { | ||
| printf "Error: Download failed.\n" | ||
| exit 1 | ||
| } | ||
| else | ||
| printf "Error: Neither wget nor curl is available to download files, please install one of them and try again.\n" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| rm -rf "$GODOTS_TMP_DIR" || { | ||
| printf "Error: Failed to clean up temporary directory.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| mkdir -p "$GODOTS_TMP_DIR" || { | ||
| printf "Error: Failed to create temporary directory.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| cd "$GODOTS_TMP_DIR" || { | ||
| printf "Error: Failed to access temporary directory.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| printf "Downloading Godots...\n" | ||
| try_download "$GODOTS_DOWNLOAD_URL" "$GODOTS_TMP_DIR" | ||
|
|
||
| prompt_continue=0 | ||
|
|
||
| if command -v sha512sum &>/dev/null; then | ||
| printf "\nDownloading checksum...\n" | ||
| try_download "$GODOTS_CHECKSUM_URL" "$GODOTS_TMP_DIR" | ||
|
|
||
| printf "\nVerifying checksum...\n" | ||
| sha512sum --check --ignore-missing "$GODOTS_TMP_DIR/SHA512-SUMS.txt" || prompt_continue=1 | ||
|
|
||
| else | ||
| # I think it is part of coreutils, so it should be available on most systems. But just in case. | ||
| printf "Error: sha512sum is not available to verify the checksum. Skipping.\n" | ||
| prompt_continue=1 | ||
| fi | ||
|
|
||
| if [[ $prompt_continue -eq 1 ]]; then | ||
| read -r -p "Checksum verification failed or was skipped. Do you want to continue the installation? (y/N): " choice | ||
| case "$choice" in | ||
| y | Y) | ||
| printf "Continuing installation...\n" | ||
| ;; | ||
| *) | ||
| printf "Installation aborted.\n" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| fi | ||
|
|
||
| # Create installation directory | ||
| mkdir -p "$GODOTS_INSTALL_DIR" || { | ||
| printf "Error: Failed to create installation directory.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| printf "\nExtracting Godots...\n" | ||
| if command -v python3 &>/dev/null; then | ||
| python3 -c " | ||
| import zipfile | ||
| import os | ||
| import sys | ||
|
|
||
| zip_path = '$GODOTS_TMP_DIR/LinuxX11.zip' | ||
| extract_dir = os.path.expanduser('$GODOTS_INSTALL_DIR') | ||
|
|
||
| # Create target directory if it doesn't exist | ||
| os.makedirs(extract_dir, exist_ok=True) | ||
|
|
||
| # Extract the zip file | ||
| with zipfile.ZipFile(zip_path, 'r') as zip_ref: | ||
| zip_ref.extractall(extract_dir) | ||
|
|
||
| print('Extraction completed successfully!') | ||
| " || { | ||
| printf "Error: Extraction failed.\n" | ||
| exit 1 | ||
| } | ||
| elif command -v unzip &>/dev/null; then | ||
| unzip -o "$GODOTS_TMP_DIR/LinuxX11.zip" -d "$GODOTS_INSTALL_DIR" || { | ||
| printf "Error: Extraction failed.\n" | ||
| exit 1 | ||
| } | ||
| printf "Extraction completed successfully!\n" | ||
| else | ||
| printf "Error: Neither python3 nor unzip is available to extract the zip file, please install one of them and try again.\n" | ||
| exit 1 | ||
| fi | ||
|
|
||
| chmod +x "$GODOTS_INSTALL_DIR/"* || { | ||
| printf "Error: Failed to set executable permissions.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| mkdir -p "$HOME/.local/bin" || { | ||
| printf "Error: Failed to create ~/.local/bin directory.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| ln -sf "$GODOTS_BIN_PATH" "$HOME/.local/bin/godots" || { | ||
| printf "Error: Failed to create symlink in ~/.local/bin.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| printf "\nDownloading icon...\n" | ||
| try_download "$ICON_DOWNLOAD_URL" "$GODOTS_INSTALL_DIR" | ||
|
|
||
| printf "\nCreating desktop entry..." | ||
| mkdir -p ~/.local/share/applications || { | ||
| printf "Error: Failed to create applications directory.\n" | ||
| exit 1 | ||
| } | ||
|
|
||
| cat <<EOF >~/.local/share/applications/godots.desktop | ||
| [Desktop Entry] | ||
| Name=Godots | ||
| GenericName=Libre game engine version manager | ||
| Comment=Ultimate go-to hub for managing your Godot versions and projects! | ||
| Exec=$GODOTS_BIN_PATH %U | ||
| Icon=$GODOTS_INSTALL_DIR/icon.svg | ||
| PrefersNonDefaultGPU=true | ||
| Terminal=false | ||
| Type=Application | ||
| Categories=Development;IDE; | ||
| StartupWMClass=Godot | ||
| EOF | ||
|
|
||
| if [[ ! -f ~/.local/share/applications/godots.desktop ]]; then | ||
| printf "Error: Failed to create desktop entry.\n" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if command -v update-desktop-database &>/dev/null; then | ||
| update-desktop-database -q | ||
| fi | ||
|
|
||
| if command -v gtk-update-icon-cache &>/dev/null; then | ||
| gtk-update-icon-cache | ||
| fi | ||
|
|
||
| if command -v kbuildsycoca5 &>/dev/null; then | ||
| kbuildsycoca5 --noincremental &>/dev/null | ||
| fi | ||
|
|
||
| printf "\nInstallation completed successfully!\n" | ||
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.
shasum check should be added
sha256 may be fetched from
digest property at https://api.github.com/repos/{owner}/{repo}/releasessourcealso I added
SHA512-SUMS.txtto the latest workflow example