Compare commits
2 Commits
66c165e379
...
c4cd7c80cd
Author | SHA1 | Date | |
---|---|---|---|
c4cd7c80cd | |||
5cc31862d2 |
5
UpdateController.conf
Normal file
5
UpdateController.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"fifo_dir" : "/tmp",
|
||||||
|
"fifo" : "update_controller_fifo",
|
||||||
|
"GIT_SSL_NO_VERIFY" : true
|
||||||
|
}
|
@ -1,24 +1,39 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
update_controller_pipe="/tmp/update_controller_pipe"
|
fifo=""
|
||||||
|
|
||||||
init () {
|
GIT_SSL_NO_VERIFY=true
|
||||||
trap "rm -f $update_controller_pipe" EXIT
|
|
||||||
|
|
||||||
if [[ ! -p $update_controller_pipe ]]; then
|
init_fifo () {
|
||||||
mkfifo $update_controller_pipe
|
trap rm -f ${fifo} EXIT
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
# set trap
|
||||||
|
if [[ ! -p ${fifo} ]]; then
|
||||||
|
mkfifo ${fifo}
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
# fifo created
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
read_config() {
|
read_config() {
|
||||||
# name der fifo laesst sich ueberschreiben
|
fifo_dir=$(cat ${1} | jq -r .fifo_dir)
|
||||||
|
fifo="${fifo_dir}/$(cat ${1} | jq -r .fifo)"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if read_config UpdateController.conf; then
|
||||||
|
echo "fifo=$fifo"
|
||||||
|
#init_fifo "$fifo"
|
||||||
|
fi
|
||||||
|
|
||||||
wait_for_trigger() {
|
wait_for_trigger() {
|
||||||
if [[ "$1" -eq -1 ]]; then
|
if [[ "$1" -eq -1 ]]; then
|
||||||
# wait for external impulse
|
# wait for external impulse
|
||||||
if read line <$update_controller_pipe; then
|
if read line <$fifo; then
|
||||||
if [ "$line" == "quit" ] || [ "$line" == "update" ]; then
|
if [ "$line" == "quit" ] || [ "$line" == "update" ]; then
|
||||||
echo "$line"
|
echo "$line"
|
||||||
fi
|
fi
|
||||||
@ -95,7 +110,7 @@ UpdateController() {
|
|||||||
local trigger_timeout=-1
|
local trigger_timeout=-1
|
||||||
|
|
||||||
# read config parameters
|
# read config parameters
|
||||||
read_config
|
# read_config
|
||||||
|
|
||||||
# By default (trigger_timeout==-1), UpdateController can only be triggered
|
# By default (trigger_timeout==-1), UpdateController can only be triggered
|
||||||
# from some external source to perform an update.
|
# from some external source to perform an update.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user