Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Created May 11, 2024 21:12
Show Gist options
  • Save MohamedElashri/5a37c0a13921818dae105665c2e79c12 to your computer and use it in GitHub Desktop.
Save MohamedElashri/5a37c0a13921818dae105665c2e79c12 to your computer and use it in GitHub Desktop.
Script to install 1Password and create a desktop shortcut on Fedora/RHEL ARM64 (KDE/wayland)
#!/bin/bash
# Define variables
DOWNLOAD_URL="https://downloads.1password.com/linux/tar/stable/aarch64/1password-latest.tar.gz"
INSTALL_DIR="/opt/1Password"
DESKTOP_FILE="~/.local/share/applications/1password.desktop"
ICON_PATH="$INSTALL_DIR/resources/icons/1password.png"
# Function to print status messages
print_status() {
echo -e "\n\e[1;32m$1\e[0m\n"
}
# Step 1: Download the 1Password archive
print_status "Downloading 1Password..."
curl -sSO $DOWNLOAD_URL
# Step 2: Extract the archive
print_status "Extracting 1Password..."
tar -xf 1password-latest.tar.gz
# Step 3: Create the installation directory
print_status "Creating installation directory..."
sudo mkdir -p $INSTALL_DIR
# Step 4: Move extracted files to the installation directory
print_status "Moving files to installation directory..."
sudo mv 1password-*/* $INSTALL_DIR
# Step 5: Run the after-install script
print_status "Running after-install script..."
sudo $INSTALL_DIR/after-install.sh
# Step 6: Clean up downloaded files
print_status "Cleaning up downloaded files..."
rm -f 1password-latest.tar.gz
rm -rf 1password-*
# Step 7: Create a desktop entry file
print_status "Creating desktop entry..."
mkdir -p ~/.local/share/applications
cat <<EOL > $DESKTOP_FILE
[Desktop Entry]
Name=1Password
Comment=1Password Password Manager
Exec=$INSTALL_DIR/1password
Icon=$ICON_PATH
Terminal=false
Type=Application
Categories=Utility;Security;
StartupNotify=true
EOL
# Step 8: Make the desktop entry executable
print_status "Making desktop entry executable..."
chmod +x ~/.local/share/applications/1password.desktop
# Step 9: Update desktop database (optional but recommended)
print_status "Updating desktop database..."
update-desktop-database ~/.local/share/applications/
# Completion message
print_status "Installation complete! You can now find 1Password in your application menu."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment