Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
filesharing
mldonkey-service
mldonkey-service.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mldonkey-service.spec of Package mldonkey-service
# # spec file for package mldonkey-service # # Copyright (c) 2015 Harland R. Coles # # 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. # Name: mldonkey-service Version: 0.2.0 Release: 0 Summary: Provide mldonkey as a service License: GPL-3.0 Group: Productivity/Networking/File-Sharing Url: http://mldonkey.sourceforge.net/ Source: mlnet_sendcommand Source1: file_completed_command.sh Source10: mldonkey_susefirewall2_service.conf Source11: mldonkey_firewalld_service.xml Source99: README.txt %if 0%{?suse_version} >= 1210 BuildRequires: systemd-rpm-macros BuildRequires: firewall-macros %endif BuildArch: noarch PreReq: %fillup_prereq PreReq: shadow Requires: mldonkey %{?systemd_requires} # Server as service setup %define _service mldonkey %define _service_user %{_service} %define _service_home /var/lib/%{_service} %define _service_descript MLDonkey Peer2Peer Server %description MLDonkey - Multi-protocol Peer to Peer Network File Sharing Service The p2p core can run on a resource limited headless computer, with remote GUI clients accessing it over the network. This package provides the files and directories to run MLDonkey as a service. %prep %build %install # Docs cp -a %{SOURCE99} ./ # Service Home install -dm 750 %{buildroot}%{_service_home} install -dm 750 %{buildroot}%{_service_home}/tmp install -dm 750 %{buildroot}%{_service_home}/incoming install -dm 750 %{buildroot}%{_service_home}/exports install -dm 750 %{buildroot}%{_service_home}/bin install -dm 700 %{buildroot}%{_service_home}/.keys/ # == Command Interface == mkdir command-ui pushd command-ui # Server as service # for /etc/sysconfig/ # ---------------------- cat >> %{_service}.conf <<EOF # %{_service_descript} - Environment Config # Home location, defaults to \${HOME}/.mldonkey if not set # MLDonkey will use environmet variable MLDONKEY_DIR as home MLNET_HOME=%{_service_home} MLDONKEY_DIR=%{_service_home} # Run as User MLNET_USER=%{_service_user} # Log to syslog (true|false) MLNET_SYSLOG=false # Logging directory MLNET_LOGDIR=/var/log/%{_service} # Log to file (regardless of syslog setting) MLNET_LOGFILE=/var/log/%{_service}/mlnet.log # Verbosity some terms:{verb net mc file unk connect loc act unexp} # check --help for complete list #MLNET_VERBOSITY="verb net mc file unk connect loc act unexp" MLNET_VERBOSITY="verb unk unexp" # PID Directory MLNET_PIDDIR=/var/run/%{_service} # Send Command Key File SENDCOMMAND_KEYFILE="%{_service_home}/.keys/mlnet.service.key" # File Completed Configs SHUTDOWN_AFTER_LAST_DNLD=1 SHUTDOWN_DELAY="5m" EOF # ---------------------- install -Dm 644 \ %{_service}.conf %{buildroot}%{?_fillupdir:%{_fillupdir}}%{!?_fillupdir:/var/adm/fillup-templates}/sysconfig.%{_service} # Systemd service file # ---------------------- cat >> %{_service}.service <<EOF [Unit] Description=%{_service_descript} After=network.target [Service] EnvironmentFile=/etc/sysconfig/%{_service} User=%{_service_user} Group=%{_service_user} ExecStart=/usr/bin/mlnet -log_to_syslog \$MLNET_SYSLOG -log_file \$MLNET_LOGFILE -pid \$MLNET_PIDDIR -verbosity \$MLNET_VERBOSITY -run_as_user \$MLNET_USER ExecStop=%{_service_home}/bin/mlnet_sendcommand --auth-keyfile "\${SENDCOMMAND_KEYFILE}" kill [Install] Alias=mlnet WantedBy=multi-user.target EOF # ---------------------- install -Dm 644 %{_service}.service %{buildroot}%{_unitdir}/%{_service}.service # key file # ---------------------- cat >> mlnet.service.key <<EOF admin ShareTheBits1010 EOF # ---------------------- install -Dm 0600 mlnet.service.key %{buildroot}%{_service_home}/.keys/mlnet.service.key # PID directory # ---------------------- cat >> %{_service}-tmp.conf <<EOF # create a directory with permissions 0770 d /var/run/%{_service} 0770 %{_service_user} %{_service_user} EOF # ---------------------- install -Dm 0644 %{_service}-tmp.conf %{buildroot}%{_tmpfilesdir}/%{_service}.conf # popd # command-ui # === === # More Helpers install -m 750 %{SOURCE0} %{buildroot}%{_service_home}/bin/mlnet_sendcommand install -m 750 %{SOURCE1} %{buildroot}%{_service_home}/bin/file_completed_command.sh # mkdir -p %{buildroot}/var/run/%{_service}/ mkdir -p %{buildroot}/var/log/%{_service}/ touch %{buildroot}/var/log/%{_service}/mlnet.log # Firewall Service config # SuSEfirewall2 -- May need a fillin thingy for this(?) (deprecated after Leap 15.x?) install -Dm 644 %{SOURCE10} %{buildroot}/etc/sysconfig/SuSEfirewall2.d/services/%{_service} # Firewalld --(copy to /etc/... also, because your peer ports are a 'personal' thing) install -D -m 644 %{SOURCE11} %{buildroot}%{_prefix}/lib/firewalld/services/%{_service}.xml install -D -m 644 %{SOURCE11} %{buildroot}/etc/firewalld/services/%{_service}.xml %pre # Server Setup of User / Group getent group %{_service_user} >/dev/null || groupadd -r %{_service_user} getent passwd %{_service_user} >/dev/null || useradd -r -g %{_service_user} \ -d "%{_service_home}" -s /bin/false -c "%{_service_descript}" %{_service_user} %service_add_pre %{_service}.service %post %{fillup_only -n %{_service}} %service_add_post %{_service}.service # Not working (why?) #/usr/bin/systemd-tmpfiles --create %{_tmpfilesdir}/%{_service}.conf %firewalld_reload %preun %service_del_preun %{_service}.service %postun %service_del_postun %{_service}.service %files %defattr(-,root,root,-) %doc README.txt %config %{?_fillupdir:%{_fillupdir}}%{!?_fillupdir:/var/adm/fillup-templates}/sysconfig.%{_service} %{_unitdir}/%{_service}.service %{_tmpfilesdir} %{_tmpfilesdir}/%{_service}.conf %dir /etc/sysconfig/SuSEfirewall2.d %dir /etc/sysconfig/SuSEfirewall2.d/services %config(noreplace) /etc/sysconfig/SuSEfirewall2.d/services/%{_service} %dir /etc/firewalld %dir /etc/firewalld/services %config(noreplace) /etc/firewalld/services/%{_service}.xml %dir %{_prefix}/lib/firewalld %dir %{_prefix}/lib/firewalld/services %{_prefix}/lib/firewalld/services/%{_service}.xml %attr(-,%{_service_user},%{_service_user}) %{_service_home} %config(noreplace) %{_service_home}/.keys/mlnet.service.key %attr(750,%{_service_user},%{_service_user}) %dir /var/log/%{_service} %config(noreplace) %attr(0640,%{_service_user},%{_service_user}) /var/log/%{_service}/mlnet.log %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor