From 565047a2171ec4211c4445a7f2a611d1909857b3 Mon Sep 17 00:00:00 2001 From: GDWR Date: Sat, 3 Feb 2024 05:09:49 +0000 Subject: [PATCH] Rename to jetson-exporter as package and jetson_exporter in go --- Makefile | 16 ++++++++-------- README.md | 6 +++--- cmd/{jetsonexporter.go => jetson_exporter.go} | 2 +- deploy/debian/control | 2 +- deploy/debian/postinst | 10 +++++----- deploy/debian/postrm | 6 +++--- deploy/debian/prerm | 2 +- ...nexporter.service => jetson-exporter.service} | 2 +- go.mod | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) rename cmd/{jetsonexporter.go => jetson_exporter.go} (99%) rename deploy/{jetsonexporter.service => jetson-exporter.service} (77%) diff --git a/Makefile b/Makefile index 6af9c9d..00496d8 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ .PHONY: clean -dist/jetsonexporter_0.0.1_arm64.deb: - mkdir -p dist/jetsonexporter/DEBIAN - mkdir -p dist/jetsonexporter/usr/bin - mkdir -p dist/jetsonexporter/lib/systemd/system +dist/jetson-exporter_0.0.1_arm64.deb: + mkdir -p dist/jetson-exporter/DEBIAN + mkdir -p dist/jetson-exporter/usr/bin + mkdir -p dist/jetson-exporter/lib/systemd/system - cp deploy/debian/* dist/jetsonexporter/DEBIAN/ - cp deploy/jetsonexporter.service dist/jetsonexporter/lib/systemd/system - GOARCH=arm64 go build -o dist/jetsonexporter/usr/bin/jetsonexporter cmd/jetsonexporter.go + cp deploy/debian/* dist/jetson-exporter/DEBIAN/ + cp deploy/jetson-exporter.service dist/jetson-exporter/lib/systemd/system + GOARCH=arm64 go build -o dist/jetson-exporter/usr/bin/jetson-exporter cmd/jetson_exporter.go - dpkg-deb --build dist/jetsonexporter dist/jetsonexporter_0.0.1_arm64.deb + dpkg-deb --build dist/jetson-exporter dist/jetson-exporter.0.1_arm64.deb clean: rm -rf dist diff --git a/README.md b/README.md index 89bac18..1d2bf6c 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ Supported devices: ```shell # Download the latest release -wget https://github.com/GDWR/jetson-exporter/releases/download/v0.0.1/jetsonexporter_0.0.1_arm64.deb +wget https://github.com/GDWR/jetson-exporter/releases/download/v0.0.1/jetson-exporter_0.0.1_arm64.deb # Install the package -sudo dpkg -i jetsonexporter_0.0.1_arm64.deb +sudo dpkg -i jetson-exporter_0.0.1_arm64.deb # Clean up -rm jetsonexporter_0.0.1_arm64.deb +rm jetson-exporter_0.0.1_arm64.deb ``` diff --git a/cmd/jetsonexporter.go b/cmd/jetson_exporter.go similarity index 99% rename from cmd/jetsonexporter.go rename to cmd/jetson_exporter.go index 07365d3..865ea68 100644 --- a/cmd/jetsonexporter.go +++ b/cmd/jetson_exporter.go @@ -7,7 +7,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/promlog" - "jetsonexporter/pkg/tegrastats" + "jetson_exporter/pkg/tegrastats" "net/http" "os" "os/exec" diff --git a/deploy/debian/control b/deploy/debian/control index c0da143..9740e54 100644 --- a/deploy/debian/control +++ b/deploy/debian/control @@ -1,4 +1,4 @@ -Package: jetsonexporter +Package: jetson-exporter Priority: optional Maintainer: GDWR Version: 0.1.0 diff --git a/deploy/debian/postinst b/deploy/debian/postinst index c65ba55..63d70b5 100755 --- a/deploy/debian/postinst +++ b/deploy/debian/postinst @@ -3,17 +3,17 @@ set -e # Automatically added by dh_installsystemd/13.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # This will only remove masks created by d-s-h on package removal. - deb-systemd-helper unmask 'jetsonexporter.service' >/dev/null || true + deb-systemd-helper unmask 'jetson-exporter.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. - if deb-systemd-helper --quiet was-enabled 'jetsonexporter.service'; then + if deb-systemd-helper --quiet was-enabled 'jetson-exporter.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable 'jetsonexporter.service' >/dev/null || true + deb-systemd-helper enable 'jetson-exporter.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state 'jetsonexporter.service' >/dev/null || true + deb-systemd-helper update-state 'jetson-exporter.service' >/dev/null || true fi fi # End automatically added section @@ -26,7 +26,7 @@ if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-decon else _dh_action=start fi - deb-systemd-invoke $_dh_action 'jetsonexporter.service' >/dev/null || true + deb-systemd-invoke $_dh_action 'jetson-exporter.service' >/dev/null || true fi fi # End automatically added section \ No newline at end of file diff --git a/deploy/debian/postrm b/deploy/debian/postrm index f306758..0714bcd 100755 --- a/deploy/debian/postrm +++ b/deploy/debian/postrm @@ -8,14 +8,14 @@ fi # Automatically added by dh_installsystemd/13.2 if [ "$1" = "remove" ]; then if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper mask 'jetsonexporter.service' >/dev/null || true + deb-systemd-helper mask 'jetson-exporter.service' >/dev/null || true fi fi if [ "$1" = "purge" ]; then if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper purge 'jetsonexporter.service' >/dev/null || true - deb-systemd-helper unmask 'jetsonexporter.service' >/dev/null || true + deb-systemd-helper purge 'jetson-exporter.service' >/dev/null || true + deb-systemd-helper unmask 'jetson-exporter.service' >/dev/null || true fi fi # End automatically added section \ No newline at end of file diff --git a/deploy/debian/prerm b/deploy/debian/prerm index 141b261..93a95e5 100755 --- a/deploy/debian/prerm +++ b/deploy/debian/prerm @@ -2,6 +2,6 @@ set -e # Automatically added by dh_installsystemd/13.2 if [ -d /run/systemd/system ] && [ "$1" = remove ]; then - deb-systemd-invoke stop 'jetsonexporter.service' >/dev/null || true + deb-systemd-invoke stop 'jetson-exporter.service' >/dev/null || true fi # End automatically added section \ No newline at end of file diff --git a/deploy/jetsonexporter.service b/deploy/jetson-exporter.service similarity index 77% rename from deploy/jetsonexporter.service rename to deploy/jetson-exporter.service index f8898d6..a0f2da9 100644 --- a/deploy/jetsonexporter.service +++ b/deploy/jetson-exporter.service @@ -2,7 +2,7 @@ Description=A prometheus exporter for the Nvidia Jetson family [Service] -ExecStart=/usr/bin/env jetsonexporter +ExecStart=/usr/bin/env jetson-exporter Restart=always [Install] diff --git a/go.mod b/go.mod index d11e598..158aa54 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module jetsonexporter +module jetson_exporter go 1.21