Commit 3602a458 authored by Marek Belisko's avatar Marek Belisko
Browse files

Inital commit



Taken from iqrf-gateway-os commit:3c37fec58bcb22278a1e2e1cca4ecc1664f3bb7c
Signed-off-by: default avatarMarek Belisko <marek.belisko@open-nandra.com>
parent d26d58fb
# We have a conf and classes directory, append to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have a recipes directory containing .bb and .bbappend files, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb \
${LAYERDIR}/recipes*/*/*.bbappend"
BBFILE_COLLECTIONS += "iqrf"
BBFILE_PATTERN_iqrf := "^${LAYERDIR}/"
BBFILE_PRIORITY_iqrf = "9"
LAYERSERIES_COMPAT_iqrf = "warrior dunfell"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " file://avahi-daemon.conf \
file://iqrf.service \
file://ssh.service \
"
do_install_append() {
install -d ${D}${sysconfdir}/avahi
install -d ${D}${sysconfdir}/avahi/services
install -m 644 ${WORKDIR}/avahi-daemon.conf ${D}${sysconfdir}/avahi
install -m 644 ${WORKDIR}/iqrf.service ${D}${sysconfdir}/avahi/services
install -m 644 ${WORKDIR}/ssh.service ${D}${sysconfdir}/avahi/services
}
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
# See avahi-daemon.conf(5) for more information on this configuration
# file!
[server]
#host-name=foo
domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
#use-ipv6=yes
allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000
[wide-area]
enable-wide-area=yes
[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no
[reflector]
#enable-reflector=no
#reflect-ipv=no
[rlimits]
#rlimit-as=
rlimit-core=0
rlimit-data=4194304
rlimit-fsize=0
rlimit-nofile=768
rlimit-stack=4194304
rlimit-nproc=3
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h IQD-GW-01 IQRF</name>
<service>
<type>_mqtt._tcp</type>
<port>1883</port>
<txt-record>JSON API for operation</txt-record>
</service>
<service>
<type>_ws._tcp</type>
<port>1338 1438</port>
<txt-record>JSON API for operation and monitoring</txt-record>
</service>
<service>
<type>_http._tcp</type>
<port>80</port>
<txt-record>WEB for configuration and service</txt-record>
</service>
<service>
<type>_https._tcp</type>
<port>443</port>
<txt-record>Secure WEB for configuration and service</txt-record>
</service>
</service-group>
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h IQD-GW-01 ssh</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
</service-group>
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
require recipes-iqrf/iqd-gw-01/iqd-gw-01.inc
FILES_${PN} += "${sysconfdir}/*"
do_install_append() {
install -d ${D}${sysconfdir}/NetworkManager
cp -r ${WORKDIR}/iqd-gw-01/conf/NetworkManager ${D}${sysconfdir}
# drop unused configurations (maybe drop from repo)
rm ${D}${sysconfdir}/NetworkManager/system-connections/gsm0
rm ${D}${sysconfdir}/NetworkManager/system-connections/wlan0
}
# enable openssl
EXTRA_OECMAKE = "-DPAHO_WITH_SSL=ON"
From b1b66a29129e5c39ce5c66ac2c3c7b66034daeef Mon Sep 17 00:00:00 2001
From: Marek Belisko <marek.belisko@open-nandra.com>
Date: Thu, 27 Feb 2020 20:32:19 +0100
Subject: [PATCH] Fix compilation for new glibc
crypt is present in external library libxcrypt (while on old glibc was part of it)
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
src/CMakeLists.txt | 2 +-
src/command.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 441f8a9..38753d8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,7 @@ set(RTTY_VERSION_PATCH 1)
find_package(Libev REQUIRED)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/buffer ${LIBEV_INCLUDE_DIR})
-set(EXTRA_LIBS ${LIBEV_LIBRARY} util crypt m)
+set(EXTRA_LIBS ${LIBEV_LIBRARY} m util crypt)
set(RTTY_FILE_UNIX_SOCKET_S "/var/run/rttyfile.sock")
add_definitions(-DRTTY_FILE_UNIX_SOCKET_S="${RTTY_FILE_UNIX_SOCKET_S}")
diff --git a/src/command.c b/src/command.c
index a9503c7..1f3a574 100644
--- a/src/command.c
+++ b/src/command.c
@@ -32,6 +32,7 @@
#include <shadow.h>
#include <sys/stat.h>
#include <math.h>
+#include <crypt.h>
#include "log.h"
#include "list.h"
--
2.7.4
[Unit]
Description=Enable rtty remote terminal program
After=network-online.target network.target setup-hostname.service
[Service]
RestartSec=5
Restart=always
ExecStartPre=/bin/sh -c "/bin/systemctl set-environment hostname=$(hostname)"
ExecStart=/usr/bin/rtty -I ${hostname} -h 109.238.72.26 -p 5912 -t 0c2fe337c83397bde425a9ce07b33dd0 -a -d ${hostname}
[Install]
WantedBy=multi-user.target
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e97ff9f7d5e8e3266f6cb56d23a45b16"
DEPENDS = "libev openssl libxcrypt"
SRCREV = "83fd8442bd9a6fd944c82473d29ecdce1c199e75"
SRC_URI = "gitsm://github.com/zhaojh329/rtty.git;branch=master;protocol=https \
file://0001-Fix-compilation-for-new-glibc.patch \
file://rtty.service \
"
inherit cmake
S = "${WORKDIR}/git"
do_install_append() {
install -d ${D}${systemd_system_unitdir}/
install -m 0644 ${WORKDIR}/rtty.service ${D}${systemd_system_unitdir}
}
FILES_${PN} += "${systemd_system_unitdir}/* ${sbindir}/*"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "rtty.service"
SYSTEMD_AUTO_ENABLE = "enable"
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1
network={
ssid=""
scan_ssid=1
psk=""
}
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += " file://wpa_supplicant-wlan0.conf"
FILES_${PN} += "${sysconfdir}/wpa_supplicant/wpa_supplicant-wlan0.conf"
do_install_append() {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0755 ${WORKDIR}/wpa_supplicant-wlan0.conf ${D}${sysconfdir}/wpa_supplicant/wpa_supplicant-nl80211-wlan0.conf
# Make sure the system directory for systemd exists.
install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants/
# Link the service file for autostart.
ln -s ${systemd_unitdir}/system/wpa_supplicant-nl80211@.service \
${D}${sysconfdir}/systemd/system/multi-user.target.wants/wpa_supplicant-nl80211@wlan0.service
}
#!/bin/sh
# basic FS mount
mount none -t proc /proc
mount none -t sysfs /sys
loop=0
# wait for ethernet a bit (usb enumeration)
while [ ! -f /sys/class/net/eth0/address ] && [ $loop -le 10 ]; do
sleep 1
((loop++))
done
# generate ID form MAC address
MACHINEID=$(cat /sys/class/net/eth0/address | md5sum | cut -d' ' -f1)
# mount data
mount /dev/mmcblk0p4 /data
# mount hostname overlay
/sbin/mount-copybind /data/etc/hostname /etc/hostname
#Run systemd
exec /lib/systemd/systemd "--machine-id=$MACHINEID"
exit 0
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " \
file://init.sh \
"
do_install_append() {
install -d ${D}${sbindir}
install -m 755 ${WORKDIR}/init.sh ${D}${sbindir}
# we use custom script before running of systemd
ln -sf /usr/sbin/init.sh ${D}/sbin/init
}
FILES_${PN} += "${sbindir}/*"
VOLATILE_BINDS_append = "/data/etc/iqrf-gateway.json /etc/iqrf-gateway.json\n\
/data/etc/iqrf-gateway-daemon /etc/iqrf-gateway-daemon\n\
/data/usr/share/iqrf-gateway-daemon/DB /usr/share/iqrf-gateway-daemon/DB/\n\
/data/var/cache/iqrf-gateway-daemon /var/cache/iqrf-gateway-daemon\n\
/data/etc/iqrf-gateway-webapp /etc/iqrf-gateway-webapp\n\
/data/etc/gwman /etc/gwman\n\
/data/usr/share/iqrf-gateway /usr/share/iqrf-gateway\n\
/data/etc/hostname /etc/hostname\n\
/data/etc/NetworkManager /etc/NetworkManager\n\
/data/etc/hosts /etc/hosts\n\
/data/var/lib/iqrf-gateway-webapp/database.db /var/lib/iqrf-gateway-webapp/database.db\n\
/data/etc/iqrf-gateway-translator /etc/iqrf-gateway-translator\n\
"
diff -Naur php-7.3.4_old/sapi/fpm/init.d.php-fpm.in php-7.3.4/sapi/fpm/init.d.php-fpm.in
--- php-7.3.4_old/sapi/fpm/init.d.php-fpm.in 2020-06-15 20:10:33.212252162 +0200
+++ php-7.3.4/sapi/fpm/init.d.php-fpm.in 2020-06-15 20:10:01.564952133 +0200
@@ -18,7 +18,7 @@
php_fpm_PID=@localstatedir@/run/php-fpm.pid
-php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"
+php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID -R"
wait_for_pid () {
; Start a new pool named 'iqrf-gateway-webapp'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('iqrf-gateway-webapp' here)
[iqrf-gateway-webapp]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = root
group = root
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php/iqrf-gateway-webapp-fpm.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 511
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0660
listen.owner = www
listen.group = root
;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool processes will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; process.priority = -19
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
; or group is differrent than the master process user. It allows to create process
; core dump and ptrace the process for the pool user.
; Default Value: no
; process.dumpable = yes
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 5
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
;pm.max_requests = 500
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
; start since - number of seconds since FPM has started;
; accepted conn - the number of request accepted by the pool;
; listen queue - the number of request in the queue of pending
; connections (see backlog in listen(2));
; max listen queue - the maximum number of requests in the queue
; of pending connections since FPM has started;
; listen queue len - the size of the socket queue of pending connections;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes;
; max active processes - the maximum number of active processes since FPM
; has started;
; max children reached - number of times, the process limit has been reached,
; when pm tries to start more children (works only for
; pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
; pool: www
; process manager: static
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 62636
; accepted conn: 190460
; listen queue: 0
; max listen queue: 1
; listen queue len: 42
; idle processes: 4
; active processes: 11
; total processes: 15
; max active processes: 12
; max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; because CPU calculation is done when the request
; processing has terminated;
; last request memory - the max amount of memory the last request consumed
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: /usr/share/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use