Include eclass for new nodejs ebuilds

New packages (zigbee2mqtt and node-red) from my gentoo overlay (https://github.com/inode64/inode64-overlay)
This commit is contained in:
INODE64
2023-02-20 19:06:55 +01:00
parent 5a35539f54
commit ddb5532108
15 changed files with 767 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
DIST node-red-3.0.2-node_modules.tar.xz 11665624 BLAKE2B 828fe99506d7c0393beac747ca3f1047582fe006a53c1dd8b864ae73709bb9dc767a5fefe40205d6bfd6551fe1cf3b9cf2f565fa5abf01ef4182d5e43864e1f0 SHA512 823d14d07319d1d8cb361dd0dd014444d8e5d8116021981378b33ee9c19d79f9b3ab106c23cd0731d52b23d3ff862e7bb37910858621a84560015794275b12c1
DIST node-red-3.0.2.tar.gz 6515723 BLAKE2B a205de81e26913baf772e588f38b8eaae6dca8b1c67f2f7ee2717833dc94666ab5d8d6e8433e87e81a7caa1b659d57144a46cda86626787cdeb3f5ec010d7309 SHA512 5828ce643a9b119ac95e22947f5fd7db84c6a5e288d1bc4c49504cd7ca478ff950eadce310b87ccabecb54b43c016ba11c2ee31c1a2b411f70ff0f514915a325

View File

@@ -0,0 +1,17 @@
#!/sbin/openrc-run
depend() {
after mosquitto
}
start() {
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --user node-red:node-red --chdir /usr/lib64/node_modules/node-red/packages/node_modules/node-red/ --exec /usr/bin/npm --background --make-pidfile --pidfile /run/${SVCNAME}.pid -- start
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet --retry 10 --pidfile /run/${SVCNAME}.pid
eend $?
}

View File

@@ -0,0 +1 @@
d /var/lib/node-red 0750 node-red node-red

View File

@@ -0,0 +1,42 @@
[Unit]
Description=node-red
After=network.target
After=mosquitto.service
[Service]
ExecStart=npm start
WorkingDirectory=/usr/lib64/node_modules/node-red/packages/node_modules/node-red/
StandardOutput=inherit
StandardError=inherit
Restart=always
User=node-red
CapabilityBoundingSet=
NoNewPrivileges=true
RemoveIPC=true
LockPersonality=true
ProtectControlGroups=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectHostname=true
ProtectProc=noaccess
ProtectClock=yes
DeviceAllow=char-* rw
RestrictRealtime=true
RestrictSUIDSGID=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
ReadWritePaths=/var/lib/node-red
SystemCallArchitectures=native
SystemCallFilter=@system-service @pkey
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person" proxied="yes">
<email>web@inode64.com</email>
<name>Fco. Javier Félix</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<remote-id type="github">node-red/node-red</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,49 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit nodejs nodejs-pack systemd tmpfiles
DESCRIPTION="A visual tool for wiring the Internet of Things."
HOMEPAGE="https://nodered.org"
SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
https://raw.githubusercontent.com/inode64/inode64-overlay/main/dist/${P}-node_modules.tar.xz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="
acct-group/node-red
acct-user/node-red
"
NODEJS_EXTRA_FILES="packages"
src_prepare() {
default
# TODO: remove bcrypt fail to compile
rm -rf node_modules/bcrypt || die
}
src_install() {
# Remove jsdoc-nr-template, prune use git to get the version
rm -rf node_modules/jsdoc-nr-template/ || die
sed -i -e '/jsdoc-nr-template/d' package.json || die
nodejs_docs
enpm_clean
enpm_install
dotmpfiles "${FILESDIR}"/node-red.conf
doinitd "${FILESDIR}"/${PN}
systemd_dounit "${FILESDIR}/${PN}.service"
}
pkg_postinst() {
tmpfiles_process node-red.conf
}

View File

@@ -0,0 +1,2 @@
DIST zigbee2mqtt-1.30.1-node_modules.tar.xz 18782028 BLAKE2B ee85f5de70a6913b164c73420a5ff01761d5ed3e417951e57f391234e66cd5de76dc459fda84452e1615c544f064d89d156bb580137503a45237b4aae4e23a0b SHA512 d4454ef828c66974d1210b7cc1df7526e3e324addc4e420de13314a13070132e3b7958bf2e8fdac50648ed21f06340f5335fc5b947ee1815dea3035f38954876
DIST zigbee2mqtt-1.30.1.tar.gz 483028 BLAKE2B 9c297c85a08ef911ad13b2722adecda6e01f0c5689a5225e3e4b0998c6a6626fe0ded2d64df0479c72971fc5f92f79cb65bdc3f8ecd1583b78d94168de1fcdba SHA512 b38accbaea044c0e5b28a4cef0652d90d7691ca936e82bdd82b39d8f77719ac750c067dcb58b9a9d2251dd821e81ed62eed8bbab3c232f516a7a6247fa575d58

View File

@@ -0,0 +1,24 @@
#!/sbin/openrc-run
depend() {
need mosquitto
}
checkconfig() {
if [ ! -f /var/lib/${SVCNAME}/configuration.yaml ] ; then
eerror "No /var/lib/${SVCNAME}/configuration.yaml file exists!"
fi
}
start() {
checkconfig || return 1
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --user zigbee2mqtt:zigbee2mqtt --env ZIGBEE2MQTT_DATA=/var/lib/${SVCNAME} --chdir /usr/lib64/node_modules/zigbee2mqtt --exec /usr/bin/npm --background --make-pidfile --pidfile /run/${SVCNAME}.pid -- start
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet --retry 10 --pidfile /run/${SVCNAME}.pid
eend $?
}

View File

@@ -0,0 +1,3 @@
d /var/lib/zigbee2mqtt 0750 zigbee2mqtt zigbee2mqtt
f /var/lib/zigbee2mqtt//configuration.yaml 0640 zigbee2mqtt zigbee2mqtt
d /var/log/zigbee2mqtt 0750 zigbee2mqtt zigbee2mqtt

View File

@@ -0,0 +1,43 @@
[Unit]
Description=zigbee2mqtt
After=network.target
Wants=mosquitto.service
[Service]
ExecStart=npm start
WorkingDirectory=/usr/lib64/node_modules/zigbee2mqtt
Environment=ZIGBEE2MQTT_DATA=/var/lib/zigbee2mqtt
StandardOutput=inherit
StandardError=inherit
Restart=always
User=zigbee2mqtt
CapabilityBoundingSet=
NoNewPrivileges=true
RemoveIPC=true
LockPersonality=true
ProtectControlGroups=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectHostname=true
ProtectProc=noaccess
ProtectClock=yes
DeviceAllow=char-* rw
RestrictRealtime=true
RestrictSUIDSGID=true
RestrictNamespaces=true
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
ReadWritePaths=/var/lib/zigbee2mqtt
SystemCallArchitectures=native
SystemCallFilter=@system-service @pkey
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person" proxied="yes">
<email>web@inode64.com</email>
<name>Fco. Javier Félix</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<remote-id type="github">Koenkk/zigbee2mqtt</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,60 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
if [[ ${PV} == *9999* ]]; then
EGIT_REPO_URI="https://github.com/Koenkk/zigbee2mqtt"
EGIT_BRANCH="dev"
inherit git-r3
else
SRC_URI="https://github.com/Koenkk/zigbee2mqtt/archive/${PV}.tar.gz -> ${P}.tar.gz
https://raw.githubusercontent.com/inode64/inode64-overlay/main/dist/${P}-node_modules.tar.xz"
fi
inherit nodejs nodejs-pack systemd tmpfiles
DESCRIPTION="It bridges events and allows you to control your Zigbee devices via MQTT"
HOMEPAGE="https://www.zigbee2mqtt.io/"
COMMIT="eb878d3d8ee47f77e27c771452e2d2c77ca83bb5"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="
acct-group/zigbee2mqtt
acct-user/zigbee2mqtt
app-misc/mosquitto
"
NODEJS_EXTRA_FILES="scripts"
src_install() {
echo "${COMMIT}" > dist/.hash
echo -e "\nadvanced:" >>data/configuration.yaml
echo -e " network_key: GENERATE" >>data/configuration.yaml
echo -e " pan_id: GENERATE" >>data/configuration.yaml
echo -e " log_directory: /var/log/${PN}" >>data/configuration.yaml
enpm_clean
enpm_install
keepdir /var/log/${PN}
insinto /var/lib/${PN}
doins data/configuration.yaml
dotmpfiles "${FILESDIR}"/zigbee2mqtt.conf
doinitd "${FILESDIR}"/${PN}
systemd_dounit "${FILESDIR}/${PN}.service"
dodir /etc/env.d
echo 'CONFIG_PROTECT="/var/lib/${PN}"' >>"${ED}"/etc/env.d/90${PN} || die
}
pkg_postinst() {
tmpfiles_process zigbee2mqtt.conf
}