openlens.sh 891 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. REPO="MuhammedKalkan/OpenLens"
  3. BINARY_NAME="openlens"
  4. TARGET_DIR="$HOME/.local/bin"
  5. BINARY_PATH="$TARGET_DIR/$BINARY_NAME"
  6. if [ ! -x "$BINARY_PATH" ]; then
  7. notify-send "📦 Installing $BINARY_NAME" "Downloading from GitHub repository $REPO..."
  8. mkdir -p "$TARGET_DIR"
  9. arch=$(uname -m)
  10. filename=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | jq -r '.assets[].name' | grep "${arch}.AppImage$")
  11. fileurl=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | jq -r --arg filename "$filename" '.assets[] | select(.name == $filename) | .browser_download_url')
  12. wget -q -O "$BINARY_PATH" "$fileurl" || {
  13. notify-send -u critical "Installation Failed" "Failed to download $BINARY_NAME from $REPO"
  14. exit 1
  15. }
  16. chmod +x "$BINARY_PATH"
  17. notify-send "Installation Complete" "$BINARY_NAME has been installed successfully"
  18. fi
  19. exec "$BINARY_PATH" "$@"