diff --git a/CHANGELOG.md b/CHANGELOG.md index 965de1d086530aa18ca9e65e91780601c6a51478..e9725ee970da740c5e6fa6e2d60eee6d4383f656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to this project will be documented in this file. +## [NEXT] +- Add IPFS on Pi3, Pi4, XU4 and PC (disabled by default) + ## [8.0-Electron] - Remove non-working shaders - Fix rotation on pifba for Rpizero2 (#2032) diff --git a/Config.in b/Config.in index 2cf68263057dd866fdd188ef8bdc060a35fc3703..b88e765ea20a1afc44418d658ead36c7984412cc 100644 --- a/Config.in +++ b/Config.in @@ -284,6 +284,7 @@ menu "Utils" source "$BR2_EXTERNAL_RECALBOX_PATH/package/xxd/Config.in" source "$BR2_EXTERNAL_RECALBOX_PATH/package/kmsgrab/Config.in" source "$BR2_EXTERNAL_RECALBOX_PATH/package/eepromutils/Config.in" + source "$BR2_EXTERNAL_RECALBOX_PATH/package/go-ipfs/Config.in" endmenu menu "Small TFT Screen" source "$BR2_EXTERNAL_RECALBOX_PATH/package/rpi-fbcp/Config.in" diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9b6789684191805ee23329e4e884fa6fa2825525..e72e9d3a9d8cc17521346aa301fa9755ec7509ba 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -5,6 +5,11 @@ The text, located between the first `## Version XXX` and the second one, will ap as release notes for end user on a Recalbox upgrade. +## Version NEXT + +### News +- Add IPFS on Pi3, Pi4, XU4 and PC (disabled by default) + ## Version 8.0-Electron ### News diff --git a/configs/recalbox-odroidxu4_defconfig b/configs/recalbox-odroidxu4_defconfig index 31b7e0f4851ba4a3a638b92fe7e3e53a9c92b90e..4276b4544982baee5887f5112e1aee7af0ebf534 100644 --- a/configs/recalbox-odroidxu4_defconfig +++ b/configs/recalbox-odroidxu4_defconfig @@ -352,4 +352,5 @@ BR2_PACKAGE_FLUIDSYNTH_PULSEAUDIO=y BR2_PACKAGE_KODI_PULSEAUDIO=y BR2_PACKAGE_PAMIX=y BR2_PACKAGE_XOW=y -BR2_PACKAGE_KMSGRAB=y \ No newline at end of file +BR2_PACKAGE_KMSGRAB=y +BR2_PACKAGE_GO_IPFS=y diff --git a/configs/recalbox-rpi3_defconfig b/configs/recalbox-rpi3_defconfig index 8ee9c797e2c8c9a0870d2c02e8dbf15236a4ab54..67f1c47e626b5165e7e42788972c73c295cad26f 100644 --- a/configs/recalbox-rpi3_defconfig +++ b/configs/recalbox-rpi3_defconfig @@ -366,3 +366,4 @@ BR2_PACKAGE_RECALBOX_VOLUMED=y BR2_PACKAGE_KMSGRAB=y BR2_PACKAGE_RECALBOX_CRT=y BR2_PACKAGE_SWITCHRES=y +BR2_PACKAGE_GO_IPFS=y diff --git a/configs/recalbox-rpi4_defconfig b/configs/recalbox-rpi4_defconfig index 79a6439a6e3729aa8dff0438f878df4f57dd5f11..d976a3ca03b8ca1e70fe5799d7dd97b8bf986281 100644 --- a/configs/recalbox-rpi4_defconfig +++ b/configs/recalbox-rpi4_defconfig @@ -358,3 +358,4 @@ BR2_PACKAGE_RECALBOX_VOLUMED=y BR2_PACKAGE_KMSGRAB=y BR2_PACKAGE_RECALBOX_CRT=y BR2_PACKAGE_SWITCHRES=y +BR2_PACKAGE_GO_IPFS=y diff --git a/configs/recalbox-x86_64_defconfig b/configs/recalbox-x86_64_defconfig index 51a62b9564cf0c9cd9491816277a8c974ce15db8..9e76081329ab2b63ac50a60fef738e44d26d78a0 100644 --- a/configs/recalbox-x86_64_defconfig +++ b/configs/recalbox-x86_64_defconfig @@ -440,3 +440,4 @@ BR2_PACKAGE_FLUIDSYNTH_PULSEAUDIO=y BR2_PACKAGE_KODI_PULSEAUDIO=y BR2_PACKAGE_PAMIX=y BR2_PACKAGE_XOW=y +BR2_PACKAGE_GO_IPFS=y diff --git a/package/go-ipfs/Config.in b/package/go-ipfs/Config.in new file mode 100644 index 0000000000000000000000000000000000000000..3d7e89c399fc82d1156ae19065ed25cf7aab0cb1 --- /dev/null +++ b/package/go-ipfs/Config.in @@ -0,0 +1,19 @@ +config BR2_PACKAGE_GO_IPFS + bool "go-ipfs" + depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS + depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS + depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_PACKAGE_OPENSSL + + help + IPFS is a global, versioned, peer-to-peer filesystem. + IPFS provides an interface as simple as the HTTP web, + but with permanence built-in. + You can also mount the world at /ipfs. + + https://ipfs.io + +comment "go-ipfs needs a toolchain w/ threads" + depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS + depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS + depends on !BR2_TOOLCHAIN_HAS_THREADS diff --git a/package/go-ipfs/S10ipfs b/package/go-ipfs/S10ipfs new file mode 100644 index 0000000000000000000000000000000000000000..dcadcae2b9498586f461fcc3a17331aebcc90432 --- /dev/null +++ b/package/go-ipfs/S10ipfs @@ -0,0 +1,55 @@ +#!/bin/ash + +if [ "$(recalbox_settings -command load -key system.ipfs.enabled)" != "1" ]; then + exit 0 +fi + +PIDFILE=/var/run/ipfs.pid + +do_init() { + if ipfs config show &> /dev/null; then + return 0 + fi + + recallog "Initializing IPFS" + + hostname="$(recalbox_settings -command load -key system.hostname)" + hostname=${hostname:-RECALBOX} + storageMax="$(recalbox_settings -command load -key system.ipfs.storage-max)" + storageMax=${storageMax:-8GB} + + ipfs init --empty-repo + ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/9001 # default is 8080 but it's used by + ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001 + ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://${hostname}:5001\", \"http://${hostname}.local:5001\", \"http://localhost:5001\", \"http://127.0.0.1:5001\"]" + ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]' + ipfs config Datastore.StorageMax "${storageMax}" +} + +do_start() { + recallog "Starting IPFS" + start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --exec ipfs -- daemon +} + +do_stop() { + recallog "Stopping IPFS" + start-stop-daemon --stop --quiet --pidfile $PIDFILE +} + +case "$1" in + start) + do_init + do_start + ;; + stop) + do_stop + ;; + restart) + do_stop + sleep 1 + do_start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/package/go-ipfs/go-ipfs.hash b/package/go-ipfs/go-ipfs.hash new file mode 100644 index 0000000000000000000000000000000000000000..8a1829ca0786116beb6f5e013133ccdf86616eb0 --- /dev/null +++ b/package/go-ipfs/go-ipfs.hash @@ -0,0 +1 @@ +md5 711b7e9e117d0d4a4c77ba6c8bb235fd go-ipfs-source.tar.gz diff --git a/package/go-ipfs/go-ipfs.mk b/package/go-ipfs/go-ipfs.mk new file mode 100644 index 0000000000000000000000000000000000000000..2f8b9ae6e5eb7bf18d8951ecb51a583782eef0b0 --- /dev/null +++ b/package/go-ipfs/go-ipfs.mk @@ -0,0 +1,29 @@ +################################################################################ +# +# go-ipfs +# +################################################################################ + +GO_IPFS_VERSION = 0.7.0 +GO_IPFS_SITE = https://github.com/ipfs/go-ipfs/releases/download/v$(GO_IPFS_VERSION) +GO_IPFS_SOURCE = go-ipfs-source.tar.gz + +GO_IPFS_LICENSE = MIT or Apache-2.0 +GO_IPFS_LICENSE_FILES = LICENSE LICENSE-MIT LICENSE-APACHE + +GO_IPFS_BUILD_TARGETS = cmd/ipfs + +GO_IPFS_DEPENDENCIES = openssl +GO_IPFS_TAGS = openssl +GO_IPFS_LDFLAGS = \ + -X $(GO_IPFS_GOMOD)/cli/version.GitCommit=$(GO_IPFS_VERSION) \ + -X $(GO_IPFS_GOMOD)/cli/version.Version=$(GO_IPFS_VERSION) \ + -linkmode internal + +GO_IPFS_INSTALL_BINS = $(notdir $(GO_IPFS_BUILD_TARGETS)) + +define GO_IPFS_INSTALL_INIT_SYSV + $(INSTALL) -D -m 0755 $(GO_IPFS_PKGDIR)/S10ipfs $(TARGET_DIR)/etc/init.d/S10ipfs +endef + +$(eval $(golang-package)) diff --git a/package/recalbox-system/odroidgo2/recalbox.conf b/package/recalbox-system/odroidgo2/recalbox.conf index 78c1b01a7f5743f23939db631dea0fdb0463cfba..b4b1e6a9f65adcd7fa676e1a2df713f48b831a15 100644 --- a/package/recalbox-system/odroidgo2/recalbox.conf +++ b/package/recalbox-system/odroidgo2/recalbox.conf @@ -178,6 +178,11 @@ wifi.region=JP ## Samba share system.samba.enabled=1 + +## IPFS share +;system.ipfs.enabled=0 +;system.ipfs.storage-max=8GB + ### Virtual Gamepads system.virtual-gamepads.enabled=1 ### SSH diff --git a/package/recalbox-system/odroidxu4/recalbox.conf b/package/recalbox-system/odroidxu4/recalbox.conf index 7a711803a85651ebd2a95688324cfef34c93dcfd..1c2fa4625539d64930a2376f3e9cc22498381ee3 100644 --- a/package/recalbox-system/odroidxu4/recalbox.conf +++ b/package/recalbox-system/odroidxu4/recalbox.conf @@ -180,6 +180,11 @@ wifi.region=JP ## Samba share system.samba.enabled=1 + +## IPFS share +;system.ipfs.enabled=0 +;system.ipfs.storage-max=8GB + ### Virtual Gamepads system.virtual-gamepads.enabled=1 ### SSH diff --git a/package/recalbox-system/rpi3/recalbox.conf b/package/recalbox-system/rpi3/recalbox.conf index 658a21c53c5e83f57e76ac1beedada976dc9078a..8a318214fd7841e413a3680549898836465b2785 100644 --- a/package/recalbox-system/rpi3/recalbox.conf +++ b/package/recalbox-system/rpi3/recalbox.conf @@ -198,6 +198,11 @@ wifi.region=JP ## Samba share system.samba.enabled=1 + +## IPFS share +;system.ipfs.enabled=0 +;system.ipfs.storage-max=8GB + ### Virtual Gamepads system.virtual-gamepads.enabled=1 ### SSH diff --git a/package/recalbox-system/rpi4/recalbox.conf b/package/recalbox-system/rpi4/recalbox.conf index f8d807d978d3979d141c8672a39ecf625c4d7bed..9e9dc3655b4e21eae0f6b6c715f8056328885178 100644 --- a/package/recalbox-system/rpi4/recalbox.conf +++ b/package/recalbox-system/rpi4/recalbox.conf @@ -190,6 +190,11 @@ wifi.region=JP ## Samba share system.samba.enabled=1 + +## IPFS share +;system.ipfs.enabled=0 +;system.ipfs.storage-max=8GB + ### Virtual Gamepads system.virtual-gamepads.enabled=1 ### SSH diff --git a/package/recalbox-system/x86_64/recalbox.conf b/package/recalbox-system/x86_64/recalbox.conf index f5eab96a296d2e89468d5492e15db36fdfb7805e..f81e9cf5f7a9998a1934077625e24c42aecdc668 100644 --- a/package/recalbox-system/x86_64/recalbox.conf +++ b/package/recalbox-system/x86_64/recalbox.conf @@ -175,6 +175,11 @@ wifi.region=JP ## Samba share system.samba.enabled=1 + +## IPFS share +;system.ipfs.enabled=0 +;system.ipfs.storage-max=8GB + ### Virtual Gamepads system.virtual-gamepads.enabled=1 ### SSH