File tree Expand file tree Collapse file tree 3 files changed +14
-12
lines changed
FunKey/board/funkey/rootfs-overlay/usr/local/sbin Expand file tree Collapse file tree 3 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -64,13 +64,14 @@ save)
6464 fi
6565 shift
6666
67- # Write quick load file args
68- echo -n " " > " ${INSTANT_PLAY_FILE} "
69- printf " '" >> " ${INSTANT_PLAY_FILE} "
70- # First arg is prog name, forcing real path
67+ # Get curent binary real path
7168 bin=$( printf %s " $1 " | sed " s/'/'\\\\ ''/g" )
7269 bin_name=$( basename " $bin " )
7370 bin_path=" $( cat $PID_PATH ) " /" $bin_name "
71+
72+ # Write quick load file args
73+ echo -n " " > " ${INSTANT_PLAY_FILE} "
74+ printf " '" >> " ${INSTANT_PLAY_FILE} "
7475 echo -n " $bin_path " >> " ${INSTANT_PLAY_FILE} "
7576 printf " ' " >> " ${INSTANT_PLAY_FILE} "
7677 shift
Original file line number Diff line number Diff line change 55
66SELF=" $( basename ${0} ) "
77PID_FILE=" /var/run/funkey.pid"
8+ PID_PATH=" /var/run/pid_path"
89
910usage () {
1011 >&2 echo " Usage: ${SELF} record pid"
@@ -16,10 +17,16 @@ usage() {
1617record_pid () {
1718 local pid=" ${1} "
1819 if ! [ ! " ${pid} " -ne " ${pid} " ]; then
19- >&2 echo " error: ${pid} is not a number"
20- exit 2
20+ >&2 echo " error: ${pid} is not a number"
21+ exit 2
2122 fi
23+
24+ # Save PID
2225 echo " ${1} " > " ${PID_FILE} "
26+
27+ # Save current pid path
28+ pid_path=$( dirname $( readlink /proc/${pid} /exe) )
29+ echo -n " $pid_path " > " $PID_PATH "
2330}
2431
2532erase_pid () {
Original file line number Diff line number Diff line change 55
66SELF=" $( basename ${0} ) "
77PID_FILE=" /var/run/funkey.pid"
8- PID_PATH=" /var/run/pid_path"
98REBOOTING_FILE=" /run/rebooting"
109
1110usage () {
@@ -17,11 +16,6 @@ usage() {
1716
1817schedule_powerdown () {
1918
20- # Save current pid path before closing bin
21- # (won't work if bin is already closed)
22- pid_path=$( dirname $( readlink /proc/$( pid print) /exe) )
23- echo -n " $pid_path " > " $PID_PATH "
24-
2519 # Send USR1 signal to the running FunKey process to warn about
2620 # impending shutdown
2721 pkill -USR1 -F " ${PID_FILE} " > /dev/null 2>&1
You can’t perform that action at this time.
0 commit comments