Skip to content

Commit

Permalink
chore(slot-ctrl): move back to /usr/local/bin (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah authored Dec 9, 2024
1 parent 20bbcb3 commit 1aab4d8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions slot-ctrl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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.
"""
Expand All @@ -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
Expand All @@ -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 = []
Expand Down
15 changes: 15 additions & 0 deletions slot-ctrl/warn_renamed.sh
Original file line number Diff line number Diff line change
@@ -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} $@

0 comments on commit 1aab4d8

Please sign in to comment.