Skip to content

Commit 6154bc5

Browse files
rminnichorangecms
authored andcommitted
Add cpud script for OpenWRT-23
Tested and working on bpi-f3. Signed-off-by: Ronald G. Minnich <[email protected]>
1 parent 269020e commit 6154bc5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh /etc/rc.common
2+
3+
# copy this file to /etc/init.d/cpud
4+
# You need to put a public key in /etc/cpud.pub
5+
# you need to put a cpud in /usr/sbin
6+
# Build the cpud as follows:
7+
# CGO_ENABLED=0 GOARCH=riscv64 GOOS=linux go build .
8+
# OR CGO_ENABLED=0 GOPATH=a/go/path GOOS=linux GOARCH=riscv64 go install github.com/u-root/cpu/cmds/cpud@latest
9+
10+
# Enable at boot: /etc/init.d/cpud enable
11+
# Disable at boot: /etc/init.d/cpud disable
12+
# Start now: /etc/init.d/cpud start
13+
# Stop now: /etc/init.d/cpud stop
14+
15+
START=99 # Start priority (higher numbers start later)
16+
STOP=10 # Stop priority (lower numbers stop earlier)
17+
USE_PROCD=1 # Use procd to manage the service
18+
19+
start_service() {
20+
procd_open_instance
21+
procd_set_param command /usr/sbin/cpud
22+
procd_append_param command -pk /etc/cpud.pub
23+
24+
# Respawn service if it crashes
25+
procd_set_param respawn
26+
27+
# Redirect stdout and stderr to the system log
28+
procd_set_param stdout 1
29+
procd_set_param stderr 1
30+
31+
procd_close_instance
32+
}

0 commit comments

Comments
 (0)