Created
December 5, 2024 13:58
-
-
Save ahmedsomaa/7f0f243be3834937bb6e2ccefb70344c to your computer and use it in GitHub Desktop.
Install Obsidian on Fedora 41
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
| #!/usr/bin/env bash | |
| # see https://forum.obsidian.md/t/gnome-desktop-installer/499 | |
| set -euo pipefail | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Starting Obsidian installation process..." | |
| # Obsidian icon URL (SVG) | |
| icon_url="https://obsidian.md/images/obsidian-logo-gradient.svg" | |
| # Fetch the latest Obsidian release URL | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Fetching the latest Obsidian AppImage release URL..." | |
| dl_url=$( curl -s https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest \ | |
| | grep "browser_download_url.*AppImage" | tail -n 1 | cut -d '"' -f 4 ) | |
| if [[ -z "$dl_url" ]]; then | |
| echo "[ERROR] $(date +'%Y-%m-%d %H:%M:%S') - Missing download link." | |
| echo "Usage: install-obsidian.sh" | |
| exit 1 | |
| fi | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Obsidian AppImage URL found: $dl_url" | |
| # Download the Obsidian AppImage | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Downloading Obsidian AppImage..." | |
| curl --location --output Obsidian.AppImage "$dl_url" | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Obsidian AppImage downloaded." | |
| # Download the Obsidian icon (SVG) | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Downloading Obsidian icon (SVG)..." | |
| curl --location --output obsidian.svg "$icon_url" | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Obsidian icon (SVG) downloaded." | |
| # Convert the SVG to PNG using 'magick' (ImageMagick 7) | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Converting SVG icon to PNG..." | |
| sudo dnf install -y imagemagick # Ensure ImageMagick is installed | |
| magick obsidian.svg -resize 128x128 obsidian.png | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - SVG icon converted to PNG." | |
| # Clean up the SVG file (optional) | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Cleaning up temporary SVG file..." | |
| rm obsidian.svg | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - SVG file cleaned up." | |
| # Create necessary directories and set permissions | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Creating necessary directories and setting permissions..." | |
| sudo mkdir --parents /opt/obsidian/ | |
| sudo mv Obsidian.AppImage /opt/obsidian | |
| sudo chmod u+x /opt/obsidian/Obsidian.AppImage | |
| sudo mv obsidian.png /opt/obsidian | |
| sudo ln -s /opt/obsidian/obsidian.png /usr/share/pixmaps | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Directories created and permissions set." | |
| # Create the desktop entry in the correct directory for Fedora | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Creating desktop entry for Obsidian..." | |
| echo "[Desktop Entry] | |
| Type=Application | |
| Name=Obsidian | |
| Exec=/opt/obsidian/Obsidian.AppImage | |
| Icon=obsidian | |
| Terminal=false" > ~/.local/share/applications/obsidian.desktop | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Desktop entry created." | |
| # Update the desktop database | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Updating the desktop database..." | |
| update-desktop-database ~/.local/share/applications | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Desktop database updated." | |
| # Final message | |
| echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') - Obsidian successfully installed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment