This repository has been archived by the owner on Jun 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-1.1.2' into develop
- Loading branch information
Showing
31 changed files
with
387 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import sys | ||
import json | ||
j = open(sys.argv[1]).read() | ||
vars = json.loads(j) | ||
print(vars['DISTRO_VERSION']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 17 additions & 5 deletions
22
meta-titania/recipes-connectivity/networkmanager/files/generate-issue.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
#!/bin/bash | ||
|
||
OLD_ISSUE_HASH= | ||
if [[ -f /etc/issue ]] | ||
then | ||
OLD_ISSUE_HASH="$(sha256sum /etc/issue)" | ||
fi | ||
|
||
cat /etc/titania.ascii > /etc/issue | ||
|
||
IPS=$(ip -4 addr show | grep -w inet | grep -vw lo | grep -wv docker0 | awk '{print $2}' | cut -d/ -f1) | ||
if [[ $? = 0 ]] | ||
then | ||
for IP in $IPS | ||
do | ||
echo -e "\t\t\tTitania Web Interface: http://$IP/" >> /etc/issue | ||
done | ||
for IP in $IPS | ||
do | ||
echo -e "\t\t\tTitania Web Interface: http://$IP/" >> /etc/issue | ||
done | ||
fi | ||
|
||
echo >> /etc/issue | ||
cat /etc/issue.titania >> /etc/issue | ||
|
||
killall -HUP agetty | ||
NEW_ISSUE_HASH="$(sha256sum /etc/issue)" | ||
if [[ $NEW_ISSUE_HASH != $OLD_ISSUE_HASH ]] | ||
then | ||
# agetty will show the changed /etc/issue if killed with HUP signal. | ||
# If /etc/issue didn't change, no need to kill agetty. | ||
killall -HUP agetty | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
meta-titania/recipes-kernel/linux/linux-raspberrypi_%.bbappend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require titania-logos.inc | ||
require titania-tty-console.inc | ||
require titania-no-default-root.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,14 @@ RDEPENDS_${PN} = " \ | |
python3-fusepy \ | ||
python3-modules \ | ||
python3-misc \ | ||
jq \ | ||
" | ||
|
||
# TODO: move dapp_prepare.sh logic inside systemd | ||
SRC_URI += "file://apps.json \ | ||
file://dapp_prepare.sh \ | ||
file://dapp_register.sh \ | ||
file://dapp_forward_ports.sh \ | ||
file://dapp_pull.sh \ | ||
file://dapp_load.sh \ | ||
file://dapp_version.sh \ | ||
|
@@ -24,15 +26,12 @@ SRC_URI += "file://apps.json \ | |
|
||
inherit systemd | ||
|
||
# TODO: how exactly do we ship nginx? | ||
# Drop-in directory for JSON maybe | ||
FILES_${PN} = "${systemd_unitdir}/system/[email protected] /opt/titania/* ${sysconfdir}/systemd/* /opt/titania/" | ||
|
||
# Systemd recipe doesn't know how to parse things with multiple dots | ||
# openembedded-core `master` branch has the correct code. | ||
# They get replaced in a ROOTFS_POSTPROCESS command (see rpi-titania-image) | ||
# TODO: Either backport or upgrade branch (painful!), remove this hack | ||
# TODO: make latter a .target, use ExecStartPost etc. | ||
SYSTEMD_SERVICE_${PN} = "dapp@world,libertaria,nginx.service \ | ||
dapp-systemd-bridge.service \ | ||
dapp-json-merge.service" | ||
|
56 changes: 56 additions & 0 deletions
56
meta-titania/recipes-titania/dapp/files/dapp_forward_ports.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
# Open up ports on the router via natpmp for the public ports | ||
|
||
if [[ $1 != "start" && $1 != "stop" ]] | ||
then | ||
echo "Usage: $0 [start|stop] <dapp_name>" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z $2 ]] | ||
then | ||
echo "dapp name must be specified" | ||
exit 1 | ||
fi | ||
|
||
ACTION=$1 | ||
DAPP_ID=$2 | ||
|
||
function public_ports() | ||
{ | ||
local DAPP_ID_=$1 | ||
local PROTOCOL=$2 | ||
|
||
jq ".[] | select(.id == \"$DAPP_ID_\") | .ports | .[] | select(.type == \"public\") | select(.protocol == \"$PROTOCOL\") | .port" /run/apps.json | ||
} | ||
|
||
case $ACTION in | ||
start) | ||
echo "Setting up portforwarding via natpmp for public ports." | ||
for typ in tcp udp | ||
do | ||
for port in $(public_ports $DAPP_ID $typ) | ||
do | ||
echo Setting up $typ portforward on port $port | ||
systemctl start forward-port@${port}-${typ}.service || true # service fails if natpmp is not enabled on router | ||
done | ||
done | ||
;; | ||
|
||
stop) | ||
echo "Removing natpmp portforwards" | ||
for typ in tcp udp | ||
do | ||
for port in $(public_ports $DAPP_ID $typ) | ||
do | ||
echo Removing $typ portforward from port $port | ||
systemctl stop forward-port@${port}-${typ}.service || true # service fails if natpmp is not enabled on router | ||
done | ||
done | ||
;; | ||
|
||
*) | ||
echo "start/stop command must be specified" | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/bin/bash | ||
# Utility to create per-dapp http(s) forwards | ||
# TODO: make configurable | ||
# TODO: /dapp directory is hardcoded | ||
DAPP_CONF_PATH="/run/dapp.conf.d/" | ||
DAPP_CONF_PATH="/run/dapp.conf.d" | ||
NGINX_SERVICE="[email protected]" | ||
|
||
if test -z "$2"; then | ||
|
@@ -28,14 +26,14 @@ case $1 in | |
exit -1 | ||
fi | ||
|
||
# TODO: currently only http, add https when we have it | ||
# TODO: no slash at the end removes automatic redirect feature (e.g. /user to /user/) | ||
# NOTE: No slash at the end removes automatic redirect feature (e.g. /user to /user/) | ||
# refer to nginx docu how to fix it if needed | ||
# NOTE: implicit directory indexes are hardcoded to index.html and index.htm outside of | ||
# usual nginx way to configure it to prevent try_files from matching directories and | ||
# failing with 403 due to prohibited directory listing | ||
# NOTE: X-Titania-Content-Source header is always added, even to error responces. | ||
# NOTE: X-Titania-Content-Source header is always added, even to error responses. | ||
# Remove the `always` part to prevent that | ||
mkdir -p $DAPP_CONF_PATH | ||
cat > $DAPP_CONF_PATH/$DAPP_ID.conf <<EOF | ||
location /dapp/$DAPP_ID { | ||
rewrite ^/dapp/$DAPP_ID/?(.*)\$ /\$1 break; | ||
|
@@ -57,7 +55,7 @@ EOF | |
PID=$(docker inspect --format {{.State.Pid}} $DAPP_ID) | ||
# No need to retry, should be up by now | ||
if test -z "$PID"; then | ||
# TODO: WARNING: a malicious app developer can mount system devices | ||
# WARNING: a malicious app developer can mount system devices | ||
# Prevent this by checking that $3 is a valid path (in next commit) | ||
nsenter --target $PID --mount --uts --ipc --net --pid -- \ | ||
mount -o bind,ro $3 /dapp | ||
|
@@ -68,8 +66,6 @@ EOF | |
stop) | ||
echo "Removing nginx drop-in config" | ||
rm -f $DAPP_CONF_PATH/$DAPP_ID.conf | ||
|
||
# TODO: study if we should unmount the static directory | ||
;; | ||
|
||
*) | ||
|
Oops, something went wrong.