diff --git a/net/boinc/Makefile b/net/boinc/Makefile new file mode 100644 index 000000000..1efe72300 --- /dev/null +++ b/net/boinc/Makefile @@ -0,0 +1,82 @@ +# Copyright 2020 by Christian Dreihsig and Steffen Möller +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=boinc +PKG_VERSION:=7.16.5 +PKG_VERSION_SHORT:=$(shell echo $(PKG_VERSION)| cut -f1,2 -d.) +PKG_RELEASE:=1 + +PKG_SOURCE_DATE:=2020-02-25 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/BOINC/boinc/tar.gz/client_release/$(PKG_VERSION_SHORT)/$(PKG_VERSION)? +PKG_HASH:=33db60991b253e717c6124cce4750ae7729eaab4e54ec718b9e37f87012d668a +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-client_release-$(PKG_VERSION_SHORT)-$(PKG_VERSION) + +PKG_MAINTAINER:=Christian Dreihsig , Steffen Moeller +PKG_LICENSE:=GPL-3.0-or-later +PKG_LICENSE_FILES:=COPYING +PKG_CPE_ID:=cpe:/a:boinc_project:boinc + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=0 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/target.mk + +define Package/boinc + SECTION:=net + CATEGORY:=Network + TITLE:=BOINC client + DEPENDS:=+curl +bzip2 +libstdcpp +libopenssl +zlib + USERID:=boinc:boinc + URL:=https://github.com/BOINC/boinc/ +endef + +define Package/boinc/description + The Berkeley Open Infrastructure for Network Computing (BOINC) is a + software platform for distributed computing: several initiatives of + various scientific disciplines all compete for the idle time of + desktop computers. The developers' web site at the University of + Berkeley serves as a common portal to the otherwise independently run + projects. + + This package provides the BOINC core client program that is + required to participate in any project that uses BOINC to control what + projects to join and to determine constraints for the computation + like the percentage of CPU time. OpenWrt does not + provide the graphical BOINC Manager, but you can connect to this + machine from the BOINC Manager of your desktop computer. +endef + +CONFIGURE_ARGS += \ + --disable-server --disable-manager --enable-client --enable-libraries \ + --disable-boinczip --enable-install-headers --enable-dynamic-client-linkage \ + --with-boinc-platform=$(REAL_GNU_TARGET_NAME) \ + --with-boinc-alt-platform=$(ARCH)-$(BOARD)-$(DEVICE_TYPE)-openwrt-$(TARGET_SUFFIX) + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/boinc + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/boinc/* $(1)/usr/include/boinc/ + $(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/boinc/ # project_specific_defines.h, config.h, version.h, svn_version.h + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/ +endef + +define Package/boinc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/boinc-client.init $(1)/etc/init.d/boinc-client + $(INSTALL_DIR) $(1)/opt/boinc + $(CP) ./files/global_prefs_override.xml $(1)/opt/boinc/global_prefs_override.xml + $(CP) ./files/remote_hosts.cfg $(1)/opt/boinc/remote_hosts.cfg +endef + +$(eval $(call BuildPackage,boinc)) diff --git a/net/boinc/files/boinc-client.init b/net/boinc/files/boinc-client.init new file mode 100755 index 000000000..b225ebdb5 --- /dev/null +++ b/net/boinc/files/boinc-client.init @@ -0,0 +1,44 @@ +#!/bin/sh /etc/rc.common + +USE_PROCD=1 + +BOINCEXE_NAME=boinc_client +BOINCDIR=/opt/boinc/ +BOINCUSR=boinc +BOINCEXE_OPTS="--check_all_logins --redirectio --dir $BOINCDIR" +PID_FILE="var/run/$BOINCEXE_NAME.pid" + +start_service() { + # First Check that BOINCDIR exists... + if ! [ -d "$BOINCDIR" ]; then + if ! mkdir -p $BOINCDIR 2>/dev/null ; then + echo "ERROR: $BOINCDIR doesn't exist and couldn't be created" + return 1 + fi + fi + + # ... and that it is accessible by boinc + BOINCDIR_OWNER="$(ls -ld $BOINCDIR | awk '{print $3}')" + if [ "$BOINCUSR" != "$BOINCDIR_OWNER" ] ; then + chown -R $BOINCUSR:$BOINCUSR $BOINCDIR + BOINCDIR_OWNER="$(ls -ld $BOINCDIR | awk '{print $3}')" + + if [ "$BOINCUSR" != "$BOINCDIR_OWNER" ] ; then + echo "User boinc can't access $BOINC_DIR" + return 3 + fi + fi + + # now use procd to start boinc + procd_open_instance $BOINCEXE_NAME + + procd_set_param command $BOINCEXE_NAME + procd_append_param command $BOINCEXE_OPTS + procd_set_param user $BOINCUSR + procd_set_param limits core="unlimited" + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_set_param pidfile $PID_FILE + + procd_close_instance +} diff --git a/net/boinc/files/global_prefs_override.xml b/net/boinc/files/global_prefs_override.xml new file mode 100644 index 000000000..0554d41b5 --- /dev/null +++ b/net/boinc/files/global_prefs_override.xml @@ -0,0 +1,4 @@ + + 50.000000 + 21600.000000 + diff --git a/net/boinc/files/remote_hosts.cfg b/net/boinc/files/remote_hosts.cfg new file mode 100644 index 000000000..943aa76e4 --- /dev/null +++ b/net/boinc/files/remote_hosts.cfg @@ -0,0 +1,8 @@ +# This file contains a list of hostnames or IP addresses (one per line) +# of remote hosts, that are allowed to connect and to control the local +# BOINC core client via GUI RPCs. +# Lines beginning with a # or a ; are treated like comments and will be +# ignored. +# +#host.example.com +#192.168.0.180