meshtastic #4129

Open
opened 2025-01-29 17:29:45 +01:00 by necrose99 · 3 comments
EAPI=7

DESCRIPTION="Meshtastic device firmware"
HOMEPAGE="https://github.com/meshtastic/firmware"

if [[ ${PV} == "9999" ]]; then
    inherit git-r3
    EGIT_REPO_URI="https://github.com/meshtastic/firmware.git"
else
    SRC_URI="https://github.com/meshtastic/firmware/archive/refs/tags/v${PV}.tar.gz"
fi

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~arm ~riscv"
IUSE="+binary"

DEPEND="dev-embedded/platformio dev-python/virtualenv dev-python/protobuf[${PYTHON_USEDEP}] app-misc/mosquitto"
RDEPEND="${DEPEND}"

src_unpack() {
    if [[ ${PV} == "9999" ]]; then
        git-r3_src_unpack
    else
        unpack ${A}
        cd "${S}"
        git submodule update --init
    fi
}

src_configure() {
    echo "Configuring sources..."
    # Ensure the systemd service file is executable and copied to the correct location
    chmod +x "${S}/bin/meshtasticd.service"
    cp "${S}/bin/meshtasticd.service" "${S}/usr/lib/systemd/system/meshtasticd.service"
}

src_compile() {
    if use binary; then
        # Download pre-built binaries
        case $(uname -m) in
            x86_64)
                wget https://github.com/meshtastic/firmware/releases/download/v${PV}/meshtasticd_${PV}_amd64.deb
                ;;
            aarch64)
                wget https://github.com/meshtastic/firmware/releases/download/v${PV}/meshtasticd_${PV}_arm64.deb
                ;;
            armv7l)
                wget https://github.com/meshtastic/firmware/releases/download/v${PV}/meshtasticd_${PV}_armhf.deb
                ;;
        esac
    else
        virtualenv venv
        source venv/bin/activate
        pip install platformio
        platformio run
    fi
}

src_install() {
    if use binary; then
        case $(uname -m) in
            x86_64)
                7z x meshtasticd_${PV}_amd64.deb -o"${D}"
                ;;
            aarch64)
                7z x meshtasticd_${PV}_arm64.deb -o"${D}"
                ;;
            armv7l)
                7z x meshtasticd_${PV}_armhf.deb -o"${D}"
                ;;
        esac
    else
        # Move the built binary to /usr/sbin
        dobin .pio/build/native/program

        # Move the web files to /usr/share/meshtasticd/web
        insinto /usr/share/meshtasticd/web
        doins -r web/*
    fi

    # Install configuration files
    insinto /etc/meshtasticd
    doins configs/*

    # Move the binary to /usr/sbin
    dobin "${D}/usr/sbin/meshtasticd"

    # Move the web files to /usr/share/meshtasticd/web
    insinto /usr/share/meshtasticd/web
    doins -r "${D}/usr/share/meshtasticd/web/*"
}

pkg_postinst() {
    if use openrc; then
        # Install OpenRC init script
        newinitd "${FILESDIR}/meshtasticd.openrc" meshtasticd
    elif use systemd; then
        # Install systemd service file
        systemd_dounit "/usr/lib/systemd/system/meshtasticd.service"
    fi
}
``` EAPI=7 DESCRIPTION="Meshtastic device firmware" HOMEPAGE="https://github.com/meshtastic/firmware" if [[ ${PV} == "9999" ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/meshtastic/firmware.git" else SRC_URI="https://github.com/meshtastic/firmware/archive/refs/tags/v${PV}.tar.gz" fi LICENSE="GPL-3" SLOT="0" KEYWORDS="~amd64 ~arm64 ~arm ~riscv" IUSE="+binary" DEPEND="dev-embedded/platformio dev-python/virtualenv dev-python/protobuf[${PYTHON_USEDEP}] app-misc/mosquitto" RDEPEND="${DEPEND}" src_unpack() { if [[ ${PV} == "9999" ]]; then git-r3_src_unpack else unpack ${A} cd "${S}" git submodule update --init fi } src_configure() { echo "Configuring sources..." # Ensure the systemd service file is executable and copied to the correct location chmod +x "${S}/bin/meshtasticd.service" cp "${S}/bin/meshtasticd.service" "${S}/usr/lib/systemd/system/meshtasticd.service" } src_compile() { if use binary; then # Download pre-built binaries case $(uname -m) in x86_64) wget https://github.com/meshtastic/firmware/releases/download/v${PV}/meshtasticd_${PV}_amd64.deb ;; aarch64) wget https://github.com/meshtastic/firmware/releases/download/v${PV}/meshtasticd_${PV}_arm64.deb ;; armv7l) wget https://github.com/meshtastic/firmware/releases/download/v${PV}/meshtasticd_${PV}_armhf.deb ;; esac else virtualenv venv source venv/bin/activate pip install platformio platformio run fi } src_install() { if use binary; then case $(uname -m) in x86_64) 7z x meshtasticd_${PV}_amd64.deb -o"${D}" ;; aarch64) 7z x meshtasticd_${PV}_arm64.deb -o"${D}" ;; armv7l) 7z x meshtasticd_${PV}_armhf.deb -o"${D}" ;; esac else # Move the built binary to /usr/sbin dobin .pio/build/native/program # Move the web files to /usr/share/meshtasticd/web insinto /usr/share/meshtasticd/web doins -r web/* fi # Install configuration files insinto /etc/meshtasticd doins configs/* # Move the binary to /usr/sbin dobin "${D}/usr/sbin/meshtasticd" # Move the web files to /usr/share/meshtasticd/web insinto /usr/share/meshtasticd/web doins -r "${D}/usr/share/meshtasticd/web/*" } pkg_postinst() { if use openrc; then # Install OpenRC init script newinitd "${FILESDIR}/meshtasticd.openrc" meshtasticd elif use systemd; then # Install systemd service file systemd_dounit "/usr/lib/systemd/system/meshtasticd.service" fi } ```
Author
#!/sbin/openrc-run

description="Meshtastic Native Daemon"

command="/usr/sbin/meshtasticd"
command_user="root:root"
pidfile="/var/run/meshtasticd.pid"

depend() {
    need net
    after network-online
}

start_pre() {
    checkpath --directory --owner root:root --mode 0755 /var/run/meshtasticd
}

start() {
    ebegin "Starting Meshtastic Native Daemon"
    start-stop-daemon --start --exec ${command} --pidfile ${pidfile} --make-pidfile --background
    eend $?
}

stop() {
    ebegin "Stopping Meshtastic Native Daemon"
    start-stop-daemon --stop --exec ${command} --pidfile ${pidfile}
    eend $?
}
``` #!/sbin/openrc-run description="Meshtastic Native Daemon" command="/usr/sbin/meshtasticd" command_user="root:root" pidfile="/var/run/meshtasticd.pid" depend() { need net after network-online } start_pre() { checkpath --directory --owner root:root --mode 0755 /var/run/meshtasticd } start() { ebegin "Starting Meshtastic Native Daemon" start-stop-daemon --start --exec ${command} --pidfile ${pidfile} --make-pidfile --background eend $? } stop() { ebegin "Stopping Meshtastic Native Daemon" start-stop-daemon --stop --exec ${command} --pidfile ${pidfile} eend $? } ```
Author
# Copyright 2009-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
#dev-python/meshtastic-python
inherit distutils-r1 pypi

DESCRIPTION="The Python CLI and API for talking to Meshtastic devices"
HOMEPAGE="https://github.com/meshtastic/python/"
LICENSE="GPL-3.0"
SLOT="0"
KEYWORDS="amd64 ~arm64 ~ppc64 ~x86"
PYTHON_COMPAT=( python3_{11..13} )

if [[ ${PV} == *9999* ]]; then
    inherit git-r3
    EGIT_REPO_URI="https://github.com/meshtastic/python.git"
    SRC_URI=""
else
    SRC_URI="$(pypi_sdist_url "${PN^}" "${PV}")"
    if [[ -n "${CODE_COMMIT_ID}" ]]; then
        SRC_URI+=" ${REPO}/archive/${CODE_COMMIT_ID}.tar.gz -> ${PN}-${CODE_COMMIT_ID}.tar.gz"
        S="${WORKDIR}/${PN}-${CODE_COMMIT_ID}"
    else
        SRC_URI+=" ${REPO}/archive/${PV}.tar.gz -> ${P}.tar.gz"
    fi
fi

distutils_enable_tests pytest
``` # Copyright 2009-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 #dev-python/meshtastic-python inherit distutils-r1 pypi DESCRIPTION="The Python CLI and API for talking to Meshtastic devices" HOMEPAGE="https://github.com/meshtastic/python/" LICENSE="GPL-3.0" SLOT="0" KEYWORDS="amd64 ~arm64 ~ppc64 ~x86" PYTHON_COMPAT=( python3_{11..13} ) if [[ ${PV} == *9999* ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/meshtastic/python.git" SRC_URI="" else SRC_URI="$(pypi_sdist_url "${PN^}" "${PV}")" if [[ -n "${CODE_COMMIT_ID}" ]]; then SRC_URI+=" ${REPO}/archive/${CODE_COMMIT_ID}.tar.gz -> ${PN}-${CODE_COMMIT_ID}.tar.gz" S="${WORKDIR}/${PN}-${CODE_COMMIT_ID}" else SRC_URI+=" ${REPO}/archive/${PV}.tar.gz -> ${P}.tar.gz" fi fi distutils_enable_tests pytest ```
Author

ebuilds are rough but hopefully soon serviceable , chat gpt can be of use to my dyslexic hide.

for now I have stock home assistant , however SSH lack thier of etc I find irritating , docker/podman ok its whatever ...
ie boot.txt or overlays etc to enable it..

and Lora-wan (helium/Meshtastic/Beartooth etc..)
would be a plus for some of the weather over lora in area or manin to say
Ardino units n spigots n plant sensors
I want Land/Garden/Greenhouse so bad of late lol.

soon as I gen another RPI5-16 I'll likely nab genpi64-gentoo etc , and rebuild and Migrate

ebuilds are rough but hopefully soon serviceable , chat gpt can be of use to my dyslexic hide. for now I have stock home assistant , **however SSH lack thier of etc I find irritating** , docker/podman ok its whatever ... ie boot.txt or overlays etc to enable it.. and Lora-wan (helium/Meshtastic/Beartooth etc..) would be a plus for some of the weather over lora in area or manin to say Ardino units n spigots n plant sensors I want Land/Garden/Greenhouse so bad of late lol. soon as I gen another RPI5-16 I'll likely nab genpi64-gentoo etc , and rebuild and Migrate
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: onkelbeh/HomeAssistantRepository#4129
No description provided.