feat: add bsnotify
This commit is contained in:
parent
0ee3650142
commit
e7b286fd1e
10 changed files with 116 additions and 0 deletions
|
@ -34,6 +34,7 @@ jobs:
|
|||
--upload-file "${file}" \
|
||||
"${API_REPOSITORY_DEB}"
|
||||
done
|
||||
bsnotify: *job
|
||||
daliserver: *job
|
||||
forgejo: *job
|
||||
forgejo-runner: *job
|
||||
|
|
|
@ -10,6 +10,7 @@ information, please see [https://repo.s3lph.me/](https://repo.s3lph.me/).
|
|||
## Packages
|
||||
|
||||
- [ansible-semaphore](https://github.com/ansible-semaphore/semaphore)
|
||||
- [bsnotify](https://github.com/jonans/bsnotify)
|
||||
- [daliserver](https://github.com/onitake/daliserver)
|
||||
- [forgejo](https://codeberg.org/forgejo/forgejo)
|
||||
- [forgejo-runner](https://code.forgejo.org/forgejo/runner)
|
||||
|
|
6
bsnotify/bsnotify.defaults
Normal file
6
bsnotify/bsnotify.defaults
Normal file
|
@ -0,0 +1,6 @@
|
|||
#
|
||||
# This MUST be populated for bsnotify to run:
|
||||
# BSNOTIFY_ARGS="<printer ip> <printer serial number> [<local bind ip 1>[,...]]"
|
||||
#
|
||||
|
||||
BSNOTIFY_ARGS=
|
14
bsnotify/bsnotify.service
Normal file
14
bsnotify/bsnotify.service
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Use Bambu Studio or Orca Slicer with printers outside your LAN
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/default/bsnotify
|
||||
ExecStart=/usr/bin/python3 /usr/bin/bsnotify $BSNOTIFY_ARGS
|
||||
DynamicUser=true
|
||||
CapabilityBoundingSet=
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
49
bsnotify/build.sh
Executable file
49
bsnotify/build.sh
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -exo pipefail
|
||||
|
||||
|
||||
ROOT=$(pwd)
|
||||
function fetch() {
|
||||
cd "${SRCDIR}"
|
||||
git clone https://github.com/jonans/bsnotify
|
||||
cd bsnotify
|
||||
export VERSION=0.$(git rev-list --count HEAD)
|
||||
}
|
||||
|
||||
function prepare() {
|
||||
chmod +x "${SRCDIR}/bsnotify/bsnotify"
|
||||
mkdir -p \
|
||||
"${PKGDIR}/DEBIAN" \
|
||||
"${PKGDIR}/usr/bin" \
|
||||
"${PKGDIR}/etc/default" \
|
||||
"${PKGDIR}/lib/systemd/system"
|
||||
cp "${SRCDIR}/bsnotify" "${PKGDIR}/usr/bin/bsnotify"
|
||||
cp "${ROOT}/bsnotify.defaults" "${PKGDIR}/etc/default/bsnotify"
|
||||
cp "${ROOT}/bsnotify.service" "${PKGDIR}/lib/systemd/system/bsnotify.service"
|
||||
cp "${ROOT}/debian.control" "${PKGDIR}/DEBIAN/control"
|
||||
cp "${ROOT}/debian.conffiles" "${PKGDIR}/DEBIAN/conffiles"
|
||||
cp "${ROOT}/debian.postinst" "${PKGDIR}/DEBIAN/postinst"
|
||||
cp "${ROOT}/debian.prerm" "${PKGDIR}/DEBIAN/prerm"
|
||||
cp "${ROOT}/debian.postrm" "${PKGDIR}/DEBIAN/postrm"
|
||||
sed -re "s/__VERSION__/${VERSION}/g" -i "${PKGDIR}/DEBIAN/control"
|
||||
sed -re "s/__MAINTAINER__/${MAINTAINER}/g" -i "${PKGDIR}/DEBIAN/control"
|
||||
find "${PKGDIR}" -exec touch -m -d "${ISODATE}" {} \;
|
||||
}
|
||||
|
||||
function package() {
|
||||
cd "${BUILDDIR}"
|
||||
dpkg-deb --build "${PKGDIR}" "${BUILDDIR}"
|
||||
}
|
||||
|
||||
function build() {
|
||||
export BUILDDIR=${ROOT}/build
|
||||
export SRCDIR=${ROOT}/build/srcdir
|
||||
export PKGDIR=${ROOT}/build/pkgdir
|
||||
mkdir -p ${SRCDIR} ${PKGDIR}
|
||||
fetch
|
||||
prepare
|
||||
package
|
||||
}
|
||||
|
||||
build
|
1
bsnotify/debian.conffiles
Normal file
1
bsnotify/debian.conffiles
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/default/bsnotify
|
15
bsnotify/debian.control
Normal file
15
bsnotify/debian.control
Normal file
|
@ -0,0 +1,15 @@
|
|||
Package: bsnotify
|
||||
Version: __VERSION__
|
||||
Maintainer: __MAINTAINER__
|
||||
Section: web
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: python3
|
||||
Description: Use Bambu Studio or Orca Slicer with printers outside your LAN
|
||||
Bambu Lab printers have a LAN only mode to avoid relying on cloud
|
||||
services for general tasks. One limitation is that Bambu Studio can
|
||||
only find your printer when both are on the same LAN. Discovery
|
||||
happens using SSDP but due non-standard/broken implementation it does
|
||||
not work when they are on different LANs. Since BS lacks the simple
|
||||
ability to add printer via IP, SSDP is the only way. Thats where
|
||||
bsnotify comes in, it will notify BS of printers outside your LAN.
|
11
bsnotify/debian.postinst
Executable file
11
bsnotify/debian.postinst
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "$1" == "configure" ]]; then
|
||||
|
||||
deb-systemd-helper enable bsnotify.service
|
||||
deb-systemd-invoke restart bsnotify.service
|
||||
|
||||
fi
|
||||
|
9
bsnotify/debian.postrm
Executable file
9
bsnotify/debian.postrm
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "$1" == "remove" ]]; then
|
||||
|
||||
systemctl daemon-reload || true
|
||||
|
||||
fi
|
9
bsnotify/debian.prerm
Executable file
9
bsnotify/debian.prerm
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "$1" == "remove" ]]; then
|
||||
|
||||
deb-systemd-invoke stop bsnotify.service
|
||||
|
||||
fi
|
Loading…
Add table
Reference in a new issue