[Dev] First commit

This commit is contained in:
samuel 2023-04-27 14:44:46 +02:00
parent fee55a0ca3
commit ad86ad658e
3 changed files with 91 additions and 1 deletions

52
Makefile Normal file
View File

@ -0,0 +1,52 @@
NAME = shfmt
VERSION = $(shell [ -d ".git" ] && git describe | sed "s/-/./g")
BRANCH = $(shell [ -d ".git" ] && git branch --show-current)
RPM_SOURCEDIR = $(shell rpm --eval "%{_sourcedir}")
VARDIR = $(shell rpm --eval "%{_var}")
NOTHING = "Nothing to do"
.PHONY: build
build:
@echo "$(NOTHING)"
.PHONY: clean
clean:
@echo "$(NOTHING)"
.PHONY: name
name:
@echo "$(NAME)"
.PHONY: version
version:
@echo "$(VERSION)"
$(RPM_SOURCEDIR)/$(NAME)-%.tar.gz: *
git archive --format=tar.gz \
--output="$@" \
--prefix="$(NAME)-$(VERSION)/" \
--worktree-attributes \
--verbose \
"$(BRANCH)"
.PHONY: tarball
tarball: $(RPM_SOURCEDIR)/$(NAME)-$(VERSION).tar.gz
.PHONY: install
install:
install -D --target-directory="$(DESTDIR)$(VARDIR)/$(NAME)" README.md LICENSE
.PHONY: check_format
check_format:
@echo "$(NOTHING)"
.PHONY: check_linting
check_linting:
@echo "$(NOTHING)"
.PHONY: unit_test
unit_test:
@echo "$(NOTHING)"

View File

@ -1,3 +1,4 @@
# netoik-shfmt
Install shfmt package when it is only available via Snap.
Install shfmt package when it is only available via Snap.
This is needed because non-shell users do not have access to Snap tools in their PATH.

37
netoik-shfmt.spec Normal file
View File

@ -0,0 +1,37 @@
%define debug_package %{nil}
Name: %(make name)
Version: %(make version)
Release: 1%{?dist}
Summary: Netoik Shfmt package when it is only available via Snap
License: GPLv3
Source0: %{name}-%{version}.tar.gz
BuildArch: x86_64
BuildRequires: make
Requires: snapd
%description
Netoik Shfmt package when it is only available via Snap
%prep
%autosetup -v
%build
%make_build
%install
%make_install
%post
ln --symbolic --force /var/lib/snapd/snap/bin/shfmt %{_bindir}/%{name}
%preun
if [ $1 -eq 0 ]; then
rm --force %{_bindir}/%{name}
fi
%files
%attr(644, root, root) %{_var}/%{name}/README.md
%attr(644, root, root) %{_var}/%{name}/LICENSE