ttyd: initial package

This commit is contained in:
CvH 2019-04-26 21:16:34 +02:00
parent 22bf53e384
commit 8ad1a51484
9 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,2 @@
100
- initial LibreELEC version

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,28 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="ttyd"
PKG_VERSION="1.4.4"
PKG_SHA256="b910a33ddaa474c369991ba345187a8a2f4aa420389083671ba3a6c305a491d6"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="MIT"
PKG_SITE="https://github.com/tsl0922/ttyd"
PKG_URL="https://github.com/tsl0922/ttyd/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain libwebsockets"
PKG_SECTION="service"
PKG_SHORTDESC="ttyd: a tool for accessing the terminal over a browser"
PKG_LONGDESC="ttyd ($PKG_VERSION): is a simple command-line tool for sharing terminal over the web"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Web SSH Terminal"
PKG_ADDON_TYPE="xbmc.service"
addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -P $PKG_BUILD/.install_pkg/usr/bin/ttyd $ADDON_BUILD/$PKG_ADDON_ID/bin
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -p $(get_build_dir json-c)/.install_pkg/usr/lib/libjson-c.so $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -p $(get_build_dir libwebsockets)/.install_pkg/usr/lib/libwebsockets.so.14 $ADDON_BUILD/$PKG_ADDON_ID/lib
}

View File

@ -0,0 +1,18 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
. /etc/profile
oe_setup_addon service.ttyd
chmod a+x $ADDON_DIR/bin/*
if [ "$TTYD_NOLOGIN" = "true" ]; then
TTYD_NOLOGIN="bash"
elif [ "$TTYD_NOLOGIN" = "false" ]; then
TTYD_NOLOGIN="login root"
fi
exec $ADDON_DIR/bin/ttyd -O -T xterm -p ${TTYD_WEBPORT} ${TTYD_NOLOGIN} &>$ADDON_HOME/service.log

View File

@ -0,0 +1,20 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
import subprocess
import xbmc
import xbmcaddon
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
self.id = xbmcaddon.Addon().getAddonInfo('id')
def onSettingsChanged(self):
subprocess.call(['systemctl', 'restart', self.id])
if __name__ == "__main__":
Monitor().waitForAbort()

View File

@ -0,0 +1,19 @@
# Kodi Media Center language file
# Addon Name: ttyd
# Addon id: service.ttyd
# Addon Provider: Team LibreELEC
msgid ""
msgstr ""
msgctxt "#30000"
msgid "Settings"
msgstr ""
msgctxt "#30001"
msgid "Webui Port"
msgstr ""
msgctxt "#30002"
msgid "[COLOR FFFF0000][SECURITY RISK][/COLOR] Allow usage without password"
msgstr ""

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30000">
<setting id="TTYD_WEBPORT" type="text" label="30001" default="11111" />
<setting id="TTYD_NOLOGIN" type="bool" label="30002" default="false" />
</category>
</settings>

View File

@ -0,0 +1,4 @@
<settings version="2">
<setting id="TTYD_NOLOGIN" default="true">false</setting>
<setting id="TTYD_WEBPORT" default="true">11111</setting>
</settings>

View File

@ -0,0 +1,14 @@
[Unit]
Description=ttyd
After=graphical.target
[Service]
ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.ttyd/bin/ttyd.start"
TimeoutStopSec=1
Restart=always
RestartSec=2
StartLimitInterval=0
Type=forking
[Install]
WantedBy=kodi.target