Skip to content

install.sh: support RPM-based Linux distributions (Fedora, RHEL, openSUSE) - #153

Open
proxy-turkey wants to merge 1 commit into
CommandCodeAI:mainfrom
proxy-turkey:linux-rpm-distro-support
Open

proxy-turkey wants to merge 1 commit into
CommandCodeAI:mainfrom
proxy-turkey:linux-rpm-distro-support

Conversation

@proxy-turkey

Copy link
Copy Markdown

Problem

Linux releases ship a .deb only, and install.sh hard-requires apt-get, so the one-command installer stops with "This preview currently supports Debian and Ubuntu through a .deb package" on Fedora, RHEL, and openSUSE. The README platform table reflects the same gap.

What this changes

install.sh now detects the Linux package-manager family (apt-get → apt, dnf/zypper/yum → rpm) and on rpm-based systems:

  1. Prefers a native .rpm — the asset search first tries CommandCode-<version>-x86_64.rpm and falls back to the .deb. The moment a release publishes a native rpm, the installer picks it up with no further changes.
  2. Repacks the verified .deb locally when no rpm exists: download → SHA-256 verification (unchanged, happens before anything touches the system) → unpack with ar (or bsdtar) → payload sanity checks mirroring the macOS installer (executable, desktop entry, compiled engine) → build a local RPM with rpmbuild → install via dnf/zypper (with a reinstall fallback so re-running the installer on the same version stays idempotent, matching the "run again to update" promise).
  3. Falls back to a direct payload install when rpmbuild is not installed — same file layout, /usr/bin/command-code launcher, desktop entry, icons — and prints the exact paths to remove.
  4. Mirrors the deb postinst behavior: SUID on chrome-sandbox, desktop/icon cache refresh, plus SELinux relabel via restorecon where available.

The generated RPM disables the automatic dependency generator because the payload bundles optional native modules for other platforms (arm64/musl/win32/darwin) that would produce unresolvable requires; runtime dependencies are declared explicitly (gtk3, nss, libnotify, libsecret, alsa-lib, …).

Docs: README install sentence and platform table note, plus a new "RPM-based Linux" section in INSTALL.md describing the flow and uninstall (sudo dnf remove command-code).

The apt and macOS paths are unchanged (apt detection now happens before download instead of at install time, with an equivalent failure message).

Testing

On Fedora 43 x86_64 against v0.1.60:

  • COMMANDCODE_INSTALL_DRY_RUN=1 resolves CommandCode-0.1.60-amd64.deb on a dnf system (no rpm asset exists yet).
  • Clean install through the repack path: app launches, dnf tracks the package, chrome-sandbox is SUID, desktop entry and icons installed.
  • Re-running the installer on the same installed version completes successfully.
  • With rpmbuild removed from PATH: direct-install fallback works and prints removal paths.
  • bash -n clean; zypper path follows the same code shape as dnf but could only be reviewed, not run.

Notes for maintainers

  • A native rpm from electron-builder would make the local repack unnecessary on every rpm distro — the installer here already prefers CommandCode-<version>-x86_64.rpm, so publishing that asset is the only remaining step.
  • I noticed releases also attach an unsigned .AppImage that is not listed in the README table; this PR deliberately does not touch it, but it might deserve a docs mention (or the repack path here, which avoids the libfuse2 dependency, may be preferable anyway). Happy to adjust or split commits.

Fedora, RHEL, and openSUSE users currently get a hard stop because the
installer only knows apt-get. The Linux release is a .deb, so the installer
now detects the package-manager family and, on rpm-based systems:

- prefers a native CommandCode-<version>-x86_64.rpm as soon as a release
  publishes one (no further changes needed when that happens),
- otherwise downloads the .deb and verifies its SHA-256 digest exactly as
  on Debian/Ubuntu, then repacks the verified payload into a local RPM
  with rpmbuild and installs it through dnf or zypper, keeping the package
  tracked and removable by the package manager,
- falls back to installing the payload directly with the same file layout,
  launcher, and desktop entry when rpmbuild is not available, printing the
  exact paths to remove on uninstall,
- sets the SUID bit on chrome-sandbox (same as the deb postinst fallback),
  refreshes desktop/icon caches, and relabels files on SELinux systems.

Payload sanity checks mirror the macOS installer (executable, desktop
entry, compiled engine) and everything runs only after SHA-256
verification. The apt and macOS paths are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant