Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ease the packaging process for openSUSE #94

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# for debug add -g -O0 to line below
CFLAGS+=-pthread -O2 -Wall -Wextra -Wpedantic -Wstrict-overflow -fno-strict-aliasing -std=gnu11 -g -O0
prefix=/usr/local/bin
DESTDIR?=
PREFIX?=/usr/local/bin

all:
${CC} main.c fiche.c $(CFLAGS) -o fiche

install: fiche
install -m 0755 fiche $(prefix)
install -d $(DESTDIR)$(PREFIX)
install -m 0755 fiche $(DESTDIR)$(PREFIX)
install -d $(DESTDIR)/usr/lib/systemd/system
install -m 644 extras/[email protected] $(DESTDIR)/usr/lib/systemd/system/[email protected]

clean:
rm -f fiche
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ To use fiche you have to have netcat installed. You probably already have it - t
sudo make install
```

Note: Adding `PREFIX=/path/to/directory` can override the default /usr/local/bin installation prefix, adittionally `DESTDIR` can also be set, and will be prepended
### Using Ports on FreeBSD

To install the port: `cd /usr/ports/net/fiche/ && make install clean`. To add the package: `pkg install fiche`.
Expand Down
66 changes: 66 additions & 0 deletions extras/packaging/fiche.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#
# spec file for package fiche
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name: fiche
Version: 0.9.1+git.20181220
Release: 0
Summary: Command line pastebin for sharing terminal output
License: MIT
Group: Productivity/Office/Other
Url: http://termbin.com
Source: %{name}-%{version}.tar.xz
Patch0: 0001-Allow-override-of-the-prefix-variable.patch
Patch1: 0002-Add-systemd-unit-and-fiche-user.patch
Requires: netcat

%description
Fiche it's a command line pastebin service for sharing terminal output,
after setting it up, it becomes quite easy to use as 'command | nc <ip> <port>'
which returns an url that you can easily use in another machine.

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%build
%make_build

%install
%make_install PREFIX=%{_bindir}

%pre
if ! getent passwd fiche > /dev/null; then
%{_sbindir}/useradd -r -g nogroup -c "Fiche user" \
-d %{_localstatedir}/lib/fiche fiche 2>/dev/null || :
fi

%post
if [ ! -e %{_localstatedir}/log/fiche ]; then
install -d 0644 -o %{name} %{_localstatedir}/log/fiche || :
fi


%files
%defattr(-,root,root)
%{_bindir}/%{name}
%license LICENSE
%doc README.md
%{_unitdir}/%{name}@.service

%changelog

11 changes: 11 additions & 0 deletions extras/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Fiche server
Wants=network.target
After=network.target

[Service]
ExecStartPre=/usr/bin/install -d -m 0755 -o fiche /var/lib/fiche/%i
ExecStart=/usr/bin/fiche -d %i -o /var/lib/fiche/%i -l /var/log/fiche/%i.log -u fiche

[Install]
WantedBy=multi-user.target