From 1aab4d82487d6d9cb454de5352bfc6bd7d8e1c7f Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Mon, 9 Dec 2024 17:36:56 -0600 Subject: [PATCH] chore(slot-ctrl): move back to /usr/local/bin (#314) --- Cargo.lock | 18 +++++++++--------- slot-ctrl/Cargo.toml | 12 ++++++++---- slot-ctrl/warn_renamed.sh | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 slot-ctrl/warn_renamed.sh diff --git a/Cargo.lock b/Cargo.lock index 37c2489e..d66fd0b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4602,25 +4602,25 @@ dependencies = [ [[package]] name = "orb-slot-ctrl" version = "0.3.0" +source = "git+https://github.com/worldcoin/orb-software?rev=832962ad8220bcbe175e5e6644f57d8d98026e4f#832962ad8220bcbe175e5e6644f57d8d98026e4f" dependencies = [ "clap", "eyre", "libc", - "orb-build-info 0.0.0", - "rustix", - "tempfile", + "orb-build-info 0.0.0 (git+https://github.com/worldcoin/orb-software?rev=832962ad8220bcbe175e5e6644f57d8d98026e4f)", "thiserror", ] [[package]] name = "orb-slot-ctrl" -version = "0.3.0" -source = "git+https://github.com/worldcoin/orb-software?rev=832962ad8220bcbe175e5e6644f57d8d98026e4f#832962ad8220bcbe175e5e6644f57d8d98026e4f" +version = "0.3.1" dependencies = [ "clap", "eyre", "libc", - "orb-build-info 0.0.0 (git+https://github.com/worldcoin/orb-software?rev=832962ad8220bcbe175e5e6644f57d8d98026e4f)", + "orb-build-info 0.0.0", + "rustix", + "tempfile", "thiserror", ] @@ -4745,7 +4745,7 @@ dependencies = [ "once_cell", "orb-build-info 0.0.0", "orb-messages 0.0.0 (git+https://github.com/worldcoin/orb-messages?rev=c439077c7c1bc3a8eb6f224c32b5b4d60d094809)", - "orb-slot-ctrl 0.3.0 (git+https://github.com/worldcoin/orb-software?rev=832962ad8220bcbe175e5e6644f57d8d98026e4f)", + "orb-slot-ctrl 0.3.0", "orb-update-agent-core", "orb-zbus-proxies", "polling 2.5.2", @@ -4778,7 +4778,7 @@ dependencies = [ "hex-literal", "jose-jwk", "once_cell", - "orb-slot-ctrl 0.3.0 (git+https://github.com/worldcoin/orb-software?rev=832962ad8220bcbe175e5e6644f57d8d98026e4f)", + "orb-slot-ctrl 0.3.0", "serde", "serde_json", "sha2", @@ -4802,7 +4802,7 @@ dependencies = [ "log", "orb-build-info 0.0.0", "orb-messages 0.0.0 (git+https://github.com/worldcoin/orb-messages?rev=787ab78581b705af0946bcfe3a0453b64af2193f)", - "orb-slot-ctrl 0.3.0", + "orb-slot-ctrl 0.3.1", "polling 2.5.2", "prost 0.12.6", "prost-build", diff --git a/slot-ctrl/Cargo.toml b/slot-ctrl/Cargo.toml index e7026976..33a8f362 100644 --- a/slot-ctrl/Cargo.toml +++ b/slot-ctrl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "orb-slot-ctrl" -version = "0.3.0" +version = "0.3.1" description = """ The Slot Control is a tool to read and write the slot and rootfs state of the Orb. """ @@ -16,9 +16,9 @@ rust-version.workspace = true clap = { workspace = true, features = ["derive"] } eyre.workspace = true libc.workspace = true -orb-build-info.path = "../build-info" -thiserror.workspace = true +orb-build-info.workspace = true tempfile = "3.12.0" +thiserror.workspace = true [dependencies.rustix] workspace = true @@ -28,9 +28,13 @@ features = [ ] [build-dependencies] -orb-build-info = { path = "../build-info", features = ["build-script"] } +orb-build-info = { workspace = true, features = ["build-script"] } [package.metadata.deb] +assets = [ + ["warn_renamed.sh", "/usr/bin/orb-slot-ctrl", "755"], + ["target/release/orb-slot-ctrl", "/usr/local/bin/", "755"] +] [features] test = [] diff --git a/slot-ctrl/warn_renamed.sh b/slot-ctrl/warn_renamed.sh new file mode 100644 index 00000000..90982cb2 --- /dev/null +++ b/slot-ctrl/warn_renamed.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +PROGRAM="orb-slot-ctrl" + +if [ -t 0 ] ; then + # Interactive terminal, print a warning + echo "$(tput setaf 1)WARNING: this program has been moved to /usr/local/bin/${PROGRAM}, this wrapper will be removed in the next release$(tput sgr0)" >&2 +else + PARENT=$(cat /proc/$PPID/cmdline | tr \\0 \ ) + echo "moved to /usr/local/bin/${PROGRAM}" | systemd-cat -t ${PROGRAM} -p warning + echo "${PROGRAM} is called by ${PARENT}" | systemd-cat -t ${PROGRAM} -p warning +fi +exec ${PROGRAM} $@