1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 02:14:26 +01:00

Added systemd scripts and install scripts

This commit is contained in:
Ralf Ramsauer 2015-05-11 19:18:30 +00:00
parent 9b140a31cb
commit 3216294134
6 changed files with 45 additions and 2 deletions

View File

@ -26,5 +26,11 @@ epaper/bsp.c
)
add_executable(doorlockd ${SRCS})
target_link_libraries(doorlockd wiringPi jsoncpp ldap)
install(TARGETS doorlockd DESTINATION sbin)
install(FILES img/template.png DESTINATION share/doorlockd)
install(DIRECTORY scripts/ DESTINATION share/doorlockd
FILES_MATCHING PATTERN "scripts/doorlockd-*"
PERMISSIONS WORLD_EXECUTE WORLD_READ OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE OWNER_WRITE)
install(FILES scripts/doorlockd.service DESTINATION /etc/systemd/system)

View File

@ -38,7 +38,7 @@ void Epaper::draw(const string &uri)
snprintf((char*)buffer, ARRAY_SIZE, "qrencode -l M -d 100 -s 5 \"%s\" -o /tmp/qr.png", uri.c_str());
system((char*)buffer);
FILE* f = popen("composite -geometry +90+0 /tmp/qr.png /tmp/template.png -colorspace gray -depth 1 gray:-", "r");
FILE* f = popen("composite -geometry +90+0 /tmp/qr.png /usr/local/share/doorlockd/template.png -colorspace gray -depth 1 gray:-", "r");
int i = fread(buffer, ARRAY_SIZE, 1, f);
if (i != 1)
{

BIN
img/template.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

12
scripts/doorlockd-start Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
PIDFILE=/tmp/doorlockd-pid
gpio load spi
gpio load i2c
/home/ralf/doorlockd-build/doorlockd &
PID=$!
echo $PID > $PIDFILE
wait $PID

12
scripts/doorlockd-stop Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
PIDFILE=/tmp/doorlockd-pid
if [ -f $PIDFILE ]
then
kill `cat $PIDFILE`
rm $PIDFILE
else
echo "PID file not existent"
fi

13
scripts/doorlockd.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Binary Kitchen doorlockd service
After=network.target
[Service]
User=root
Group=root
ExecStart=/usr/local/share/doorlockd/doorlockd-start
ExecStop=/usr/local/share/doorlockd/doorlockd-stop
[Install]
WantedBy=multi-user.target