add spec file and systemd unit

This commit is contained in:
tux 2022-11-18 14:09:38 +01:00
parent 4e1345c431
commit 778d7558d1
2 changed files with 111 additions and 0 deletions

99
fahclient.spec Normal file
View File

@ -0,0 +1,99 @@
Name: fahclient
Version: 7.6.21
Release: 2
Summary: Folding@home Console Client
Group: Applications/Internet
ExclusiveArch: aarch64
License: Restricted
URL: https://foldingathome.org/
Vendor: Folding@home
Packager: Joseph Coffland <joseph@cauldrondevelopment.com>
Provides: config(fahclient) = 7.6.21-2
Provides: fahclient = 7.6.21-2
Provides: fahclient(aarch-64) = 7.6.21-2
Requires: /bin/bash
Requires(pre): /bin/sh
Requires(post): /bin/sh
Requires(postun): /bin/sh
Requires: config(fahclient) = 7.6.21-2
Requires: ld-linux-aarch64.so.1()(64bit)
Requires: ld-linux-aarch64.so.1(GLIBC_2.17)(64bit)
Requires: libc.so.6()(64bit)
Requires: libc.so.6(GLIBC_2.17)(64bit)
Requires: libdl.so.2()(64bit)
Requires: libdl.so.2(GLIBC_2.17)(64bit)
Requires: libm.so.6()(64bit)
Requires: libm.so.6(GLIBC_2.17)(64bit)
Requires: libpthread.so.0()(64bit)
Requires: libpthread.so.0(GLIBC_2.17)(64bit)
#Requires: rpmlib(CompressedFileNames) <= 3.0.4-1
#Requires: rpmlib(FileDigests) <= 4.6.0-1
#Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1
#Requires: rpmlib(PayloadIsXz) <= 5.2-1
Requires: rtld(GNU_HASH)
%description
Folding@home is a distributed computing project using volunteered
computer resources.
This package contains the console client which is used to download
and run Folding@home work units. To monitor and control the console
client it is best to use either Web Control via your browser, or the
Graphical User Interface called FAHControl, provided in a separate package.
%files
%config %attr(0775, root, root) "/etc/init.d/FAHClient"
%attr(0775, root, root) "/usr/bin/FAHClient"
%attr(0775, root, root) "/usr/bin/FAHCoreWrapper"
%attr(0644, root, root) "/usr/share/applications/FAHWebControl.desktop"
%attr(0644, root, root) "/lib/systemd/system/FAHClient.service"
%doc %attr(0644, root, root) "/usr/share/doc/fahclient/CHANGELOG.md"
%doc %attr(0644, root, root) "/usr/share/doc/fahclient/README.md"
%doc %attr(0644, root, root) "/usr/share/doc/fahclient/copyright"
%doc %attr(0644, root, root) "/usr/share/doc/fahclient/sample-config.xml"
%attr(0644, root, root) "/usr/share/pixmaps/FAHClient.icns"
%attr(0644, root, root) "/usr/share/pixmaps/FAHClient.png"
%post -p /bin/sh
CLIENT_USER=fahclient
CLIENT_HOME=/var/lib/fahclient
CLIENT_ETC=/etc/fahclient
CLIENT_NAME="Folding@home Client"
SERVICE_SCRIPT=/etc/init.d/FAHClient
CONFIG=/etc/fahclient/config.xml
SAMPLE=/usr/share/doc/fahclient/sample-config.xml
# Stop the service if it's started
test -f $SERVICE_SCRIPT || $SERVICE_SCRIPT stop || true
# Create directories
test -d $CLIENT_HOME || mkdir $CLIENT_HOME
test -d $CLIENT_ETC || mkdir $CLIENT_ETC
# Add user if it does not exist
getent passwd $CLIENT_USER >/dev/null || \
useradd -r -d $CLIENT_HOME -s /sbin/nologin -c "$CLIENT_NAME" $CLIENT_USER
# Make sure there is a config.xml
test -f $CONFIG || cp $SAMPLE $CONFIG
# Adjust file and directory permissions
for dir in "$CLIENT_HOME" "$CLIENT_ETC"; do
chown -R $CLIENT_USER "$dir"
find "$dir" -exec chmod ug+rw,o+r '{}' \;
done
%preun -p /bin/sh
SERVICE_SCRIPT=/etc/init.d/FAHClient
# Stop the service
$SERVICE_SCRIPT stop || true
%changelog

View File

@ -0,0 +1,12 @@
[Unit]
Description=Folding@home distributed computing client
After=network.target
[Service]
User=fahclient
Type=simple
WorkingDirectory=/var/lib/fahclient
ExecStart=/usr/bin/FAHClient --config /etc/fahclient/config.xml
[Install]
WantedBy=multi-user.target