This commit is contained in:
+1
-1
@@ -54,7 +54,7 @@ This folder has small helpers for build, CI, and router install. Keep it simple;
|
||||
## Local build/install (manual path)
|
||||
|
||||
```powershell
|
||||
# Build
|
||||
# Build
|
||||
cargo build --release --target armv7-unknown-linux-musleabihf
|
||||
|
||||
# Package rootfs
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
# Default-Stop:
|
||||
# Short-Description: Pre-flight Tailscale update
|
||||
|
||||
START=50 # Run before Tailscale (typically START~80)
|
||||
START=50 # Run before Tailscale (typically START~80)
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command /bin/sh -c \
|
||||
'while ! /etc/ldlda_help/update_tailscale.sh; do sleep 5; done'
|
||||
# procd_set_param respawn 0 0 0
|
||||
'while ! /etc/ldlda_help/update_tailscale.sh; do sleep 5; done'
|
||||
procd_set_param respawn 9999 15 1
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
|
||||
@@ -2,24 +2,16 @@
|
||||
START=66
|
||||
USE_PROCD=1
|
||||
|
||||
# reboot == new file.
|
||||
FLAG=/var/wakey_updated.flag
|
||||
|
||||
start_service() {
|
||||
[ -f "$FLAG" ] && return
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /bin/sh -c \
|
||||
'while ! /etc/ldlda_help/update_wakey.sh; do sleep 5; done'
|
||||
'while ! /etc/ldlda_help/update_wakey.sh; do sleep 5; done'
|
||||
procd_set_param respawn 9999 15 1
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
: # no-op
|
||||
}
|
||||
|
||||
post_service() {
|
||||
touch "$FLAG"
|
||||
: # no-op
|
||||
}
|
||||
|
||||
@@ -22,4 +22,4 @@ for p in $pids; do
|
||||
done
|
||||
[ -z "$remain" ] || kill -KILL "$remain" 2>/dev/null || true
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
|
||||
@@ -8,6 +8,11 @@ elif [ -f /rom/etc/resolv.conf ]; then
|
||||
cp -af /rom/etc/resolv.conf /etc/resolv.conf
|
||||
fi
|
||||
|
||||
if [ -x "$(which tailscale)" ]; then
|
||||
tailscale update
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 1. Fetch the latest version number from Tailscale's site
|
||||
LATEST=$(curl -s https://pkgs.tailscale.com/stable/ | grep -Eo 'tailscale_[0-9\.]+_arm.tgz' | head -n1)
|
||||
|
||||
@@ -20,7 +25,6 @@ URL="https://pkgs.tailscale.com/stable/${LATEST}"
|
||||
|
||||
cd /var/tmp
|
||||
|
||||
|
||||
if [ -f "$LATEST" ]; then
|
||||
echo "file exists"
|
||||
rm "$LATEST"
|
||||
|
||||
@@ -15,13 +15,18 @@
|
||||
|
||||
set -eu
|
||||
|
||||
# reboot == new file.
|
||||
FLAG=/var/wakey_updated.flag
|
||||
ARCH=${WAKEY_ARCH:-armv7-unknown-linux-musleabihf}
|
||||
TMPDIR="/var/tmp"
|
||||
TMPFILE="$TMPDIR/wakey-rootfs.$$.$ARCH.tgz"
|
||||
STAGING="$TMPDIR/wakey-rootfs.$$.$ARCH"
|
||||
|
||||
log() { echo "[update_wakey] $*"; }
|
||||
fail() { echo "[update_wakey] ERROR: $*" >&2; exit 1; }
|
||||
fail() {
|
||||
echo "[update_wakey] ERROR: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
http_get() {
|
||||
# http_get <url>
|
||||
@@ -65,13 +70,14 @@ latest_asset_url() {
|
||||
API="https://$HOST/api/v1/repos/$OWNER/$REPO/releases/latest"
|
||||
RESP=$(http_get "$API") || return 1
|
||||
# Extract the first browser_download_url ending with our ARCH .tgz (BusyBox-friendly)
|
||||
echo "$RESP" \
|
||||
| grep -o '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]*'"$ARCH"'\.tgz"' \
|
||||
| head -n1 \
|
||||
| cut -d '"' -f 4
|
||||
echo "$RESP" |
|
||||
grep -o '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]*'"$ARCH"'\.tgz"' |
|
||||
head -n1 |
|
||||
cut -d '"' -f 4
|
||||
}
|
||||
|
||||
main() {
|
||||
[ -f "$FLAG" ] && return
|
||||
URL="${WAKEY_TGZ_URL:-}"
|
||||
if [ -z "$URL" ]; then
|
||||
HOST=${WAKEY_HOST:-git.ldlda.com}
|
||||
@@ -109,7 +115,7 @@ main() {
|
||||
for f in \
|
||||
"$STAGING/etc/init.d/"* \
|
||||
"$STAGING/etc/ldlda_help/"*.sh \
|
||||
"$STAGING/root/.bin/"*.sh ; do
|
||||
"$STAGING/root/.bin/"*.sh; do
|
||||
[ -f "$f" ] && sed -i 's/\r$//' "$f" 2>/dev/null || true
|
||||
done
|
||||
|
||||
@@ -123,6 +129,7 @@ main() {
|
||||
/etc/init.d/wakey enable || true
|
||||
/etc/init.d/wakey restart || /etc/init.d/wakey start || true
|
||||
fi
|
||||
touch "$FLAG"
|
||||
log "done"
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,10 @@ if [ -z "$BIN_TMP" ] || [ -z "$DEST" ]; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
[ -f "$BIN_TMP" ] || { echo "tmp binary not found: $BIN_TMP" >&2; exit 1; }
|
||||
[ -f "$BIN_TMP" ] || {
|
||||
echo "tmp binary not found: $BIN_TMP" >&2
|
||||
exit 1
|
||||
}
|
||||
chmod +x "$BIN_TMP" || true
|
||||
|
||||
if [ "$RESTART" = "1" ]; then
|
||||
|
||||
Reference in New Issue
Block a user