mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
integrate exmachina configuration management layer
- add exmachina code and test code - modify plinth.py to listen for shared secret on stdin at start (if appropriate flag is set) and try to connect to exmachina daemon - use exmachina to read and set /etc/hostname as a demo - update plinth init.d script to start exmachina and share keys - update docs with new deps and run instructions
This commit is contained in:
1 parent
337560b0d1
commit
f1e764f2e5
11 files changed
+544
-24
No files matched your search
+41
-4
@@ -12,23 +12,53 @@
|
||||
|
||||
# This file is /etc/init.d/plinth
|
||||
DAEMON=/usr/local/bin/plinth.py
|
||||
EXMACHINA_DAEMON=/usr/local/bin/exmachina.py
|
||||
PID_FILE=/var/run/plinth.pid
|
||||
|
||||
EXMACHINA_PID_FILE=/var/run/exmachina.pid
|
||||
|
||||
PLINTH_USER=www-data
|
||||
PLINTH_GROUP=www-data
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
test -x $EXMACHINA_DAEMON || exit 0
|
||||
|
||||
set -e
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
start_plinth (){
|
||||
if [ -f $PID_FILE ]; then
|
||||
echo Already running with a pid of `cat $PID_FILE`.
|
||||
echo Already running with a pid of `cat $PID_FILE`.
|
||||
else
|
||||
$DAEMON --pidfile=$PID_FILE
|
||||
if [ -f $EXMACHINA_PID_FILE ]; then
|
||||
echo exmachina was already running with a pid of `cat $EXMACHINA_PID_FILE`.
|
||||
kill -15 `cat $EXMACHINA_PID_FILE`
|
||||
rm -rf $EXMACHINA_PID_FILE
|
||||
fi
|
||||
SHAREDKEY=`$EXMACHINA_DAEMON --random-key`
|
||||
touch $PID_FILE
|
||||
chown $PLINTH_USER:$PLINTH_GROUP $PID_FILE
|
||||
echo $SHAREDKEY | $EXMACHINA_DAEMON --pidfile=$EXMACHINA_PID_FILE || rm $PID_FILE
|
||||
sleep 0.5
|
||||
echo $SHAREDKEY | sudo -u $PLINTH_USER -g $PLINTH_GROUP $DAEMON --pidfile=$PID_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
stop_plinth () {
|
||||
if [ -f $PID_FILE ]; then
|
||||
kill -15 `cat $PID_FILE`
|
||||
kill -15 `cat $PID_FILE` || true
|
||||
rm -rf $PID_FILE
|
||||
echo "killed plinth"
|
||||
else
|
||||
echo "No pid file at $PID_FILE suggests plinth is not running."
|
||||
fi
|
||||
if [ -f $EXMACHINA_PID_FILE ]; then
|
||||
kill -15 `cat $EXMACHINA_PID_FILE` || true
|
||||
rm -rf $EXMACHINA_PID_FILE
|
||||
echo "killed exmachina"
|
||||
else
|
||||
echo "No pid file at $EXMACHINA_PID_FILE suggests exmachina is not running."
|
||||
fi
|
||||
}
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
@@ -45,5 +75,12 @@ case "$1" in
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PID_FILE "$DAEMON" plinth && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $NAME {start|stop|restart|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
Reference in new issue
Block a user