From ad94be925cc3237390da2597692689ee9a32a1d4 Mon Sep 17 00:00:00 2001 From: sammyette Date: Mon, 19 Dec 2022 23:19:48 -0400 Subject: [PATCH] chore: add rpm spec file (package for copr/fedora) (#220) --- Taskfile.yaml | 3 +- hilbish-git.spec | 59 ++++++++++++++++++++++++++++++++++++++ rpkg.conf | 2 ++ rpkg.macros | 25 ++++++++++++++++ website/content/install.md | 17 +++++++++++ 5 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 hilbish-git.spec create mode 100644 rpkg.conf create mode 100644 rpkg.macros diff --git a/Taskfile.yaml b/Taskfile.yaml index 603633f..6bf17e0 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -8,7 +8,8 @@ vars: BINDIR: '{{default .bindir__ .BINDIR}}' libdir__: '{{.PREFIX}}/share/hilbish' LIBDIR: '{{default .libdir__ .LIBDIR}}' - GOFLAGS: '-ldflags "-s -w -X main.dataDir={{.LIBDIR}}"' + goflags__: '-ldflags "-s -w -X main.dataDir={{.LIBDIR}}"' + GOFLAGS: '{{default .goflags__ .GOFLAGS}}' tasks: default: diff --git a/hilbish-git.spec b/hilbish-git.spec new file mode 100644 index 0000000..77d2e13 --- /dev/null +++ b/hilbish-git.spec @@ -0,0 +1,59 @@ +%global _missing_build_ids_terminate_build 0 +%global debug_package %{nil} + +Name: hilbish-git +Version: {{{ git_tag_version }}}.{{{ git_short_hash }}} +Release: 1%{?dist} +Summary: The flower shell. A comfy and nice little shell for Lua fans! +License: MIT + +Source: {{{ git_dir_pack }}} +BuildRequires: git golang go-task +Requires: inspect succulent lunacolors + +Url: https://github.com/Rosettea/Hilbish +VCS: {{{ git_dir_vcs }}} + +%description +Hilbish is a extensible shell (framework). It was made to be very customizable +via the Lua programming language. It aims to be easy to use for the casual +people but powerful for those who want to tinker more with their shell, +the thing used to interface with most of the system. + +The motivation for choosing Lua was that its simpler and better to use +than old shell script. It's fine for basic interactive shell uses, +but that's the only place Hilbish has shell script; everything else is Lua +and aims to be infinitely configurable. If something isn't, open an issue! + +%prep +{{{ git_dir_setup_macro }}} +sed -i '\|/etc/shells|d' Taskfile.yaml + +%build +go-task + +%install +go-task install PREFIX=%{buildroot}/usr BINDIR=%{buildroot}/%{_bindir} + +%post +if [ "$1" = 1 ]; then + if [ ! -f %{_sysconfdir}/shells ] ; then + echo "%{_bindir}/hilbish" > %{_sysconfdir}/shells + echo "/bin/hilbish" >> %{_sysconfdir}/shells + else + grep -q "^%{_bindir}/hilbish$" %{_sysconfdir}/shells || echo "%{_bindir}/hilbish" >> %{_sysconfdir}/shells + grep -q "^/bin/hilbish$" %{_sysconfdir}/shells || echo "/bin/hilbish" >> %{_sysconfdir}/shells + fi +fi + +%postun +if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then + sed -i '\!^%{_bindir}/hilbish$!d' %{_sysconfdir}/shells + sed -i '\!^/bin/hilbish$!d' %{_sysconfdir}/shells +fi + +%files +%doc README.md +%license LICENSE +%{_bindir}/hilbish +%{_datadir}/hilbish diff --git a/rpkg.conf b/rpkg.conf new file mode 100644 index 0000000..957dc05 --- /dev/null +++ b/rpkg.conf @@ -0,0 +1,2 @@ +[rpkg] +user_macros = "${git_props:root}/rpkg.macros" diff --git a/rpkg.macros b/rpkg.macros new file mode 100644 index 0000000..dbcf187 --- /dev/null +++ b/rpkg.macros @@ -0,0 +1,25 @@ +function git_short_hash { + short_hash="$(cached git_short_hash)" + + if [ -z "$short_hash" ]; then + short_hash="$(git rev-parse --short HEAD)" + fi + + output "$short_hash" +} + +function git_tag_version { + tag="$(cached git_tag_version)" + + if [ -z "$tag" ]; then + tag="$(git describe --tags --abbrev=0)" + fi + + # Remove the potential prefix of `v` + if [[ $tag =~ ^v[0-9].* ]]; then + tag="${tag:1}" + fi + + tag="${tag/"-"/"."}" + output "$tag" +} diff --git a/website/content/install.md b/website/content/install.md index 731b8c0..1ae103f 100644 --- a/website/content/install.md +++ b/website/content/install.md @@ -16,6 +16,23 @@ For the latest **stable release**, check here: https://github.com/Rosettea/Hilbi For a **development build**: https://nightly.link/Rosettea/Hilbish/workflows/build/master ## Package Repositories +### Fedora (COPR) +An official COPR is offered to install Hilbish easily on Fedora. +Enable the repo: +``` +sudo dnf copr enable sammyette/Hilbish +``` + +And install Hilbish: +``` +sudo dnf install hilbish +``` + +Or for the latest development build from master: +``` +sudo dnf install hilbish-git +``` + ### Arch Linux (AUR) Hilbish is on the AUR. Setup an AUR helper, and install. Example with yay: