diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c742426..c4bd8af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: cache: true - name: Install system dependencies - run: sudo apt-get update && sudo apt-get install -y dpkg-dev + run: sudo apt-get update && sudo apt-get install -y dpkg-dev rpm - name: Derive release version shell: bash @@ -61,6 +61,10 @@ jobs: shell: bash run: ./scripts/build-deb.sh "${VERSION}" + - name: Build rpm package + shell: bash + run: ./scripts/build-rpm.sh "${VERSION}" + - name: Bundle tarball shell: bash run: | @@ -74,6 +78,7 @@ jobs: sha256sum \ "${BIN_NAME}-${GITHUB_REF_NAME}-x86_64-unknown-linux-gnu.tar.gz" \ "target/debian/${BIN_NAME}_${VERSION}_amd64.deb" \ + "target/rpm/${BIN_NAME}-${VERSION}-1.x86_64.rpm" \ > "${BIN_NAME}-${GITHUB_REF_NAME}-checksums.txt" - name: Publish release assets @@ -84,3 +89,4 @@ jobs: vcom-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz vcom-${{ github.ref_name }}-checksums.txt target/debian/vcom_${{ env.VERSION }}_amd64.deb + target/rpm/vcom-${{ env.VERSION }}-1.x86_64.rpm diff --git a/PKGBUILD b/PKGBUILD index 6f7b0b4..b3cdac0 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,5 +1,5 @@ pkgname=vcom -pkgver=0.2.5 +pkgver=0.2.6 pkgrel=1 pkgdesc="Terminal file manager inspired by Midnight Commander" arch=("x86_64" "aarch64") diff --git a/README.md b/README.md index 1b519f7..aa3e642 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,14 @@ ![vcom screenshot 2](docs/screen2.png) ![vcom screenshot 3](docs/screen3.png) +## Quick install + +```bash +curl -fsSL https://raw.githubusercontent.com/vrubelroman/vcom/main/scripts/install.sh | bash +``` + +This single command installs vcom with Nerd Font and image preview support on any Linux distribution. + ## Build and run Run directly: @@ -36,13 +44,13 @@ go build -o vcom ./cmd/vcom Run directly from the flake: ```bash -nix run github:vrubelroman/vcom?ref=v0.2.5 +nix run github:vrubelroman/vcom?ref=v0.2.6 ``` Install into user profile: ```bash -nix profile add github:vrubelroman/vcom?ref=v0.2.5 +nix profile add github:vrubelroman/vcom?ref=v0.2.6 ``` The Nix package wraps `vcom` with `ueberzugpp` in `PATH`, so image preview works in non-`kitty` terminals out of the box. @@ -52,8 +60,8 @@ The Nix package wraps `vcom` with `ueberzugpp` in `PATH`, so image preview works Download and install the latest release: ```bash -curl -sL https://github.com/vrubelroman/vcom/releases/download/v0.2.5/vcom_0.2.5_amd64.deb -o /tmp/vcom_0.2.5_amd64.deb -sudo apt install /tmp/vcom_0.2.5_amd64.deb +curl -sL https://github.com/vrubelroman/vcom/releases/download/v0.2.6/vcom_0.2.6_amd64.deb -o /tmp/vcom_0.2.6_amd64.deb +sudo apt install /tmp/vcom_0.2.6_amd64.deb ``` The Debian package recommends `ueberzugpp` for image preview outside `kitty` (optional). To install it: @@ -72,6 +80,27 @@ makepkg -si The Arch package depends on `ueberzugpp`, so non-`kitty` image preview is installed together with `vcom`. +### Fedora / RHEL + +Download and install the latest RPM: + +```bash +curl -sL https://github.com/vrubelroman/vcom/releases/download/v0.2.6/vcom-0.2.6-1.x86_64.rpm -o /tmp/vcom.rpm +sudo dnf install /tmp/vcom.rpm +``` + +Or on RHEL/CentOS: + +```bash +sudo rpm -ivh /tmp/vcom.rpm +``` + +The RPM package recommends `ueberzugpp` for image preview outside `kitty` (optional): + +```bash +sudo dnf install ueberzugpp +``` + ## Font requirement (icons) For file icons, `vcom` expects a Nerd Font in your terminal profile. @@ -187,19 +216,21 @@ Built-in themes (press `t` to open theme selector or set `ui.theme` in config): ## Releases -Pushing a tag like `v0.2.5` triggers GitHub Actions release workflow (`.github/workflows/release.yml`) which: +Pushing a tag like `v0.2.6` triggers GitHub Actions release workflow (`.github/workflows/release.yml`) which: - runs tests - vendors Go modules - builds release binary - builds Debian package +- builds RPM package - publishes release assets Release artifacts: -- `vcom-v0.2.5-x86_64-unknown-linux-gnu.tar.gz` -- `vcom_0.2.5_amd64.deb` -- `vcom-v0.2.5-checksums.txt` +- `vcom-v0.2.6-x86_64-unknown-linux-gnu.tar.gz` +- `vcom_0.2.6_amd64.deb` +- `vcom-0.2.6-1.x86_64.rpm` +- `vcom-v0.2.6-checksums.txt` ## Notes diff --git a/flake.nix b/flake.nix index e72c3df..669311e 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,7 @@ lib = pkgs.lib; packageBase = pkgs.buildGoModule { pname = "vcom"; - version = "0.2.5"; + version = "0.2.6"; src = ./.; vendorHash = null; diff --git a/internal/ui/model.go b/internal/ui/model.go index c8c415d..ce7fd12 100644 --- a/internal/ui/model.go +++ b/internal/ui/model.go @@ -27,7 +27,7 @@ import ( "vcom/internal/theme" ) -const version = "v0.2.5" +const version = "v0.2.6" type modalKind int diff --git a/scripts/build-rpm.sh b/scripts/build-rpm.sh new file mode 100755 index 0000000..231fb3f --- /dev/null +++ b/scripts/build-rpm.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [[ $# -ne 1 ]]; then + echo "usage: $0 " >&2 + exit 1 +fi + +version="$1" +pkgname="vcom" +outdir="target/rpm" +buildroot="${outdir}/BUILDROOT" +rpmbuild_dir="${outdir}/rpmbuild" + +rm -rf "$outdir" +mkdir -p \ + "${buildroot}/usr/bin" \ + "${buildroot}/usr/share/doc/vcom" \ + "${buildroot}/usr/share/licenses/vcom" \ + "${rpmbuild_dir}"/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + +install -Dm755 "target/release/vcom" "${buildroot}/usr/bin/vcom" +install -Dm644 "README.md" "${buildroot}/usr/share/doc/vcom/README.md" +install -Dm644 "vcom.toml" "${buildroot}/usr/share/doc/vcom/vcom.toml" +install -Dm644 "LICENSE" "${buildroot}/usr/share/licenses/vcom/LICENSE" + +cat > "${rpmbuild_dir}/SPECS/vcom.spec" </dev/null 2>&1; then + echo "nixos" + else + echo "unknown" + fi +} + +# ---------- latest release tag ---------- +latest_tag() { + curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" 2>/dev/null \ + | grep '"tag_name":' | sed -E 's/.*"tag_name": *"([^"]+)".*/\1/' +} + +# ---------- nerd font ---------- +install_nerd_font() { + header "Nerd Font" + if fc-list 2>/dev/null | grep -qi "JetBrainsMono.*Nerd"; then + info "JetBrainsMono Nerd Font already installed" + return + fi + DISTRO=$(detect_distro) + case "$DISTRO" in + arch|manjaro|endeavouros) + info "Installing via pacman..." + sudo pacman -S --noconfirm ttf-jetbrains-mono-nerd 2>/dev/null || true + ;; + nixos|nix) + if command -v nix >/dev/null 2>&1; then + info "Installing via nix profile..." + nix profile install nixpkgs#nerd-fonts.jetbrains-mono 2>/dev/null || true + fi + ;; + esac + if fc-list 2>/dev/null | grep -qi "JetBrainsMono.*Nerd"; then + info "JetBrainsMono Nerd Font installed via package manager" + return + fi + info "Downloading JetBrainsMono Nerd Font..." + mkdir -p "$FONT_DIR" + curl -fsSL "$FONT_URL" -o /tmp/JetBrainsMono.zip + unzip -oq /tmp/JetBrainsMono.zip -d "$FONT_DIR" + rm -f /tmp/JetBrainsMono.zip + if command -v fc-cache >/dev/null 2>&1; then + fc-cache -fv "$FONT_DIR" 2>/dev/null || true + fi + info "Nerd Font installed to $FONT_DIR" +} + +# ---------- ueberzugpp ---------- +install_ueberzugpp() { + header "ueberzugpp (image preview)" + if command -v ueberzugpp >/dev/null 2>&1; then + info "ueberzugpp already installed" + return + fi + DISTRO=$(detect_distro) + case "$DISTRO" in + arch|manjaro|endeavouros) + sudo pacman -S --noconfirm ueberzugpp 2>/dev/null && return || true + ;; + fedora|rhel|centos|almalinux|rocky) + sudo dnf install -y ueberzugpp 2>/dev/null && return || true + ;; + nixos|nix) + info "ueberzugpp is bundled with vcom on Nix — skipping" + return + ;; + esac + if ! command -v pipx >/dev/null 2>&1; then + info "Installing pipx..." + sudo apt-get update -qq && sudo apt-get install -y -qq pipx 2>/dev/null || \ + sudo dnf install -y pipx 2>/dev/null || \ + sudo zypper install -y pipx 2>/dev/null || true + pipx ensurepath 2>/dev/null || true + fi + if command -v pipx >/dev/null 2>&1; then + pipx install ueberzugpp 2>/dev/null && return || true + fi + warn "Could not install ueberzugpp — image preview may not work outside Kitty" +} + +# ---------- vcom ---------- +install_vcom() { + header "vcom" + TAG=$(latest_tag) + if [ -z "$TAG" ]; then + warn "Could not determine latest version from GitHub" + return 1 + fi + VER="${TAG#v}" + DISTRO=$(detect_distro) + + case "$DISTRO" in + debian|ubuntu|linuxmint|pop|elementary|zorin|kali|raspbian) + DEB="vcom_${VER}_amd64.deb" + URL="https://github.com/${REPO}/releases/download/${TAG}/${DEB}" + info "Downloading $DEB for $DISTRO..." + curl -fsSL "$URL" -o "/tmp/${DEB}" + sudo apt install -y "/tmp/${DEB}" + rm -f "/tmp/${DEB}" + ;; + fedora|rhel|centos|almalinux|rocky) + RPM="vcom-${VER}-1.x86_64.rpm" + URL="https://github.com/${REPO}/releases/download/${TAG}/${RPM}" + info "Downloading $RPM for $DISTRO..." + curl -fsSL "$URL" -o "/tmp/${RPM}" + sudo dnf install -y "/tmp/${RPM}" 2>/dev/null || \ + sudo rpm -ivh "/tmp/${RPM}" + rm -f "/tmp/${RPM}" + ;; + opensuse*|sles) + RPM="vcom-${VER}-1.x86_64.rpm" + URL="https://github.com/${REPO}/releases/download/${TAG}/${RPM}" + info "Downloading $RPM for $DISTRO..." + curl -fsSL "$URL" -o "/tmp/${RPM}" + sudo zypper install -y "/tmp/${RPM}" + rm -f "/tmp/${RPM}" + ;; + arch|manjaro|endeavouros) + TAR="vcom-${TAG}-x86_64-unknown-linux-gnu.tar.gz" + URL="https://github.com/${REPO}/releases/download/${TAG}/${TAR}" + info "Downloading $TAR for $DISTRO..." + curl -fsSL "$URL" -o "/tmp/${TAR}" + mkdir -p "$HOME/.local/bin" + tar -xzf "/tmp/${TAR}" -C "$HOME/.local/bin" + rm -f "/tmp/${TAR}" + if ! echo "$PATH" | grep -q "$HOME/.local/bin"; then + warn "Add ~/.local/bin to your PATH:" + echo ' export PATH="$HOME/.local/bin:$PATH"' + fi + ;; + nixos|nix) + info "Installing via nix profile..." + nix profile add "github:${REPO}?ref=${TAG}" + return + ;; + *) + TAR="vcom-${TAG}-x86_64-unknown-linux-gnu.tar.gz" + URL="https://github.com/${REPO}/releases/download/${TAG}/${TAR}" + info "Unknown distro ($DISTRO) — installing binary tarball" + curl -fsSL "$URL" -o "/tmp/${TAR}" + mkdir -p "$HOME/.local/bin" + tar -xzf "/tmp/${TAR}" -C "$HOME/.local/bin" + rm -f "/tmp/${TAR}" + warn "Add ~/.local/bin to your PATH if not already:" + echo ' export PATH="$HOME/.local/bin:$PATH"' + ;; + esac + info "vcom ${TAG} installed successfully" +} + +# ---------- main ---------- +echo "" +echo -e "${BOLD}vcom installer${RESET}" +echo "" + +if ! command -v curl >/dev/null 2>&1; then + echo "error: curl is required" >&2 + exit 1 +fi +if ! command -v unzip >/dev/null 2>&1; then + echo "error: unzip is required" >&2 + exit 1 +fi + +install_nerd_font +install_ueberzugpp +install_vcom + +echo "" +info "Done! Run: vcom"