mihomo-kit/tools/push.sh
2026-10-12 18:53:39 +03:00

15 lines
880 B
Bash
Executable File

#!/bin/sh
# Copy the kit to the router's /etc/nikki/kit, then run the installer there:
# tools/push.sh root@192.168.32.1
# ssh root@192.168.32.1 sh /etc/nikki/kit/install.sh
set -eu
host=${1:?usage: tools/push.sh root@<router>}
cd "$(dirname "$0")/.."
# ustar without macOS metadata: busybox tar on OpenWrt chokes on pax/xattr headers
# templates/ is replaced whole: renamed fragments must not linger
COPYFILE_DISABLE=1 tar --no-xattrs --format ustar -czf - install.sh templates presets router luci |
ssh "$host" 'mkdir -p /etc/nikki/kit && rm -rf /etc/nikki/kit/templates && tar xzf - -C /etc/nikki/kit && chmod +x /etc/nikki/kit/router/*.sh'
ver="$(git describe --always --dirty 2>/dev/null || echo '?') push $(date '+%Y-%m-%d %H:%M')"
ssh "$host" "echo '$ver' > /etc/nikki/kit/VERSION"
echo "pushed to $host:/etc/nikki/kit — now: ssh $host sh /etc/nikki/kit/install.sh"