Print version in all scripts; add Updating section to README
This commit is contained in:
+2
-1
@@ -18,6 +18,7 @@
|
||||
# Derive PATCH_DIR from this script's location (parent of the patch/ directory).
|
||||
PATCH_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG="$PATCH_DIR/apply.log"
|
||||
VERSION="0.0.2"
|
||||
|
||||
# Rotate log at 512 KB to avoid unbounded growth on a system volume.
|
||||
# Keep two prior generations (.1 and .2) so the last three boots are always available.
|
||||
@@ -27,7 +28,7 @@ if [ -f "$LOG" ] && [ "$(wc -c < "$LOG")" -gt 524288 ]; then
|
||||
fi
|
||||
|
||||
exec >> "$LOG" 2>&1
|
||||
echo "=== $(date -Iseconds) ==="
|
||||
echo "=== $(date -Iseconds) [v${VERSION}] ==="
|
||||
|
||||
# Kill switch: if this file exists, skip all patching and exit cleanly.
|
||||
# Recovery: touch "$PATCH_DIR/disabled" (then reboot or restart middlewared).
|
||||
|
||||
@@ -48,6 +48,8 @@ import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
__version__ = "0.0.2"
|
||||
|
||||
_PATCH_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
_STATUS_FILE = os.path.join(_PATCH_DIR, "hook_status.json")
|
||||
|
||||
@@ -194,6 +196,7 @@ def main():
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog=__doc__.split("Examples")[1] if __doc__ and "Examples" in __doc__ else "",
|
||||
)
|
||||
p.add_argument("--version", "-V", action="version", version=f"truecloud-patch {__version__}")
|
||||
p.add_argument("--host", default=None, metavar="HOST",
|
||||
help="TrueNAS hostname or IP address (required except for verify)")
|
||||
p.add_argument("--api-key", default=None, metavar="KEY",
|
||||
|
||||
Reference in New Issue
Block a user