From: RISCi_ATOM Date: Thu, 29 Mar 2018 16:16:06 +0000 (-0400) Subject: Add Shell-in-a-box support to libreCMC X-Git-Tag: v1.4.3~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1e1a7bf9fa13f3eeb1a2bb22369e8ac237156b75;p=librecmc%2Flibrecmc.git Add Shell-in-a-box support to libreCMC --- diff --git a/package/luci/applications/luci-app-shellinabox/Makefile b/package/luci/applications/luci-app-shellinabox/Makefile new file mode 100644 index 0000000000..7de7407175 --- /dev/null +++ b/package/luci/applications/luci-app-shellinabox/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2017 Robert Call +# +# You may redistribute this program and/or modify it under the terms of +# the GNU General Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# This program 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 General Public License +# along with this program. If not, see . +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-shellinabox +PKG_VERSION:=0.1 +PKG_RELEASE:=4 + +PKG_LICENSE:=GPL-3.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-shellinabox + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=Shell in a box integration + URL:= + MAINTAINER:=Robert Call + DEPENDS:=+shellinabox +endef + +define Package/luci-app-shellinabox/description + This package adds terminal integration into luci to make + router maintanance easier for those new to GNU/Linux or + don't have access to a GNU/Linux box. + +endef + +define Build/Compile +endef + +define Package/luci-app-shellinabox/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + $(INSTALL_DIR) $(1)/www/static + $(CP) ./luasrc/* $(1)/usr/lib/lua/luci + $(CP) ./files/terminal.png $(1)/www/static/terminal.png +endef + +$(eval $(call BuildPackage,luci-app-shellinabox)) diff --git a/package/luci/applications/luci-app-shellinabox/files/terminal.png b/package/luci/applications/luci-app-shellinabox/files/terminal.png new file mode 100644 index 0000000000..db5a4ff295 Binary files /dev/null and b/package/luci/applications/luci-app-shellinabox/files/terminal.png differ diff --git a/package/luci/applications/luci-app-shellinabox/luasrc/controller/shellinabox.lua b/package/luci/applications/luci-app-shellinabox/luasrc/controller/shellinabox.lua new file mode 100644 index 0000000000..9e3a4a0dd7 --- /dev/null +++ b/package/luci/applications/luci-app-shellinabox/luasrc/controller/shellinabox.lua @@ -0,0 +1,4 @@ +module("luci.controller.shellinabox", package.seeall) --notice that new_tab is the name of the file new_tab.lua + function index() + entry({"admin", "system", "tab_from_view"}, template("shellinabox/view_tab"), "Terminal", 2) --this adds the second sub-tab that is located in /luci-myapplication/view/myapp-mymodule and the file is called view_tab.htm, also set to the second position +end diff --git a/package/luci/applications/luci-app-shellinabox/luasrc/model/cbi/shellinabox/cbi_tab.lua b/package/luci/applications/luci-app-shellinabox/luasrc/model/cbi/shellinabox/cbi_tab.lua new file mode 100644 index 0000000000..a8d9649fd0 --- /dev/null +++ b/package/luci/applications/luci-app-shellinabox/luasrc/model/cbi/shellinabox/cbi_tab.lua @@ -0,0 +1,4 @@ +m = Map("cbi_file", translate("First Tab Form"), translate("Please fill out the form below")) -- cbi_file is the config file in /etc/config +d = m:section(TypedSection, "info", "Part A of the form") -- info is the section called info in cbi_file +a = d:option(Value, "name", "Name"); a.optional=false; a.rmempty = false; -- name is the option in the cbi_file +return m diff --git a/package/luci/applications/luci-app-shellinabox/luasrc/view/shellinabox/view_tab.htm b/package/luci/applications/luci-app-shellinabox/luasrc/view/shellinabox/view_tab.htm new file mode 100644 index 0000000000..2f4d26cf31 --- /dev/null +++ b/package/luci/applications/luci-app-shellinabox/luasrc/view/shellinabox/view_tab.htm @@ -0,0 +1,3 @@ +<%+header%> + +<%+footer%> diff --git a/package/network/services/shellinabox/Makefile b/package/network/services/shellinabox/Makefile new file mode 100644 index 0000000000..0d2fcdf8d4 --- /dev/null +++ b/package/network/services/shellinabox/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2006-2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# Initial port of shellinabox to OpenWrt - Jan Jaeger 25-MAR-2010 + +include $(TOPDIR)/rules.mk + +PKG_NAME:=shellinabox +PKG_VERSION:=2.10 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=HEAD +PKG_SOURCE_URL:=https://github.com/OnionIoT/shellinabox.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_SOURCE:=$(PKG_NAME).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +#PKG_SOURCE_URL:=http://shellinabox.googlecode.com/files +#PKG_MD5SUM:=0e144910d85d92edc54702ab9c46f032 + +include $(INCLUDE_DIR)/package.mk + +define Package/shellinabox + SECTION:=net + CATEGORY:=Network + TITLE:=Shell In A Box + DEPENDS:= zlib + URL:=http://shellinabox.googlecode.com +endef + +define Package/shellinabox/description +Web based AJAX terminal emulator +endef + +define Build/Configure + $(call Build/Configure/Default) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + BINDIR="/usr/sbin" \ + all +endef + +define Package/shellinabox/install + # install the binary + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/shellinaboxd $(1)/usr/sbin/ + # install the init.d file + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + # install the css file + $(INSTALL_DIR) $(1)/usr/lib/shellinabox + $(INSTALL_BIN) ./files/style.css $(1)/usr/lib/shellinabox/style.css +endef + +$(eval $(call BuildPackage,shellinabox)) diff --git a/package/network/services/shellinabox/files/shellinabox.init b/package/network/services/shellinabox/files/shellinabox.init new file mode 100644 index 0000000000..64da5423e3 --- /dev/null +++ b/package/network/services/shellinabox/files/shellinabox.init @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010 OpenWrt.org + +# enable auto start of this daemon +START=99 + +USE_PROCD=1 +PROG=/usr/sbin/shellinaboxd + +start_service() { + procd_open_instance + procd_set_param command $PROG -t --service=/:LOGIN --css /usr/lib/shellinabox/style.css + # disable automatic respawn - allow daemon to be turned off + #procd_set_param respawn + procd_close_instance +} + diff --git a/package/network/services/shellinabox/files/style.css b/package/network/services/shellinabox/files/style.css new file mode 100644 index 0000000000..f5aa24a353 --- /dev/null +++ b/package/network/services/shellinabox/files/style.css @@ -0,0 +1,24 @@ +#vt100 #cursor.bright { + background-color: white; + color: black; +} + +#vt100 #scrollable { + color: #ffffff; + background-color: #000000; +} + +#vt100 #scrollable.inverted { + color: #000000; + background-color: #ffffff; +} + +#vt100 .ansi15 { + color: #000000; +} + +#vt100 .bgAnsi0 { + background-color: #ffffff; +} + + diff --git a/package/network/services/shellinabox/old/000-makefile-arch.patch b/package/network/services/shellinabox/old/000-makefile-arch.patch new file mode 100644 index 0000000000..cef7ec65f8 --- /dev/null +++ b/package/network/services/shellinabox/old/000-makefile-arch.patch @@ -0,0 +1,22 @@ +diff -Naur shellinabox-2.10.orig/Makefile.am shellinabox-2.10/Makefile.am +--- shellinabox-2.10.orig/Makefile.am 2009-11-18 17:55:52.000000000 +0100 ++++ shellinabox-2.10/Makefile.am 2010-03-25 14:16:03.000000000 +0100 +@@ -107,6 +107,7 @@ + objcopyflags = case "$(host_cpu)" in \ + i[0-9]86) echo '-O elf32-i386 -B i386';; \ + x86_64) echo '-O elf64-x86-64 -B i386:x86-64';; \ ++ mips*) echo '-O elf32-tradbigmips -B mips:isa32';; \ + arm*) echo '-O elf32-littlearm -B arm';; \ + esac + +diff -Naur shellinabox-2.10.orig/Makefile.in shellinabox-2.10/Makefile.in +--- shellinabox-2.10.orig/Makefile.in 2009-11-21 23:47:39.000000000 +0100 ++++ shellinabox-2.10/Makefile.in 2010-03-25 14:16:28.000000000 +0100 +@@ -371,6 +371,7 @@ + objcopyflags = case "$(host_cpu)" in \ + i[0-9]86) echo '-O elf32-i386 -B i386';; \ + x86_64) echo '-O elf64-x86-64 -B i386:x86-64';; \ ++ mips*) echo '-O elf32-tradbigmips -B mips:isa32';; \ + arm*) echo '-O elf32-littlearm -B arm';; \ + esac + diff --git a/package/network/services/shellinabox/old/001-makefile-objcopy.patch b/package/network/services/shellinabox/old/001-makefile-objcopy.patch new file mode 100644 index 0000000000..21c4b41573 --- /dev/null +++ b/package/network/services/shellinabox/old/001-makefile-objcopy.patch @@ -0,0 +1,105 @@ +diff -Naur shellinabox-2.10.orig/Makefile.am shellinabox-2.10/Makefile.am +--- shellinabox-2.10.orig/Makefile.am 2010-03-25 19:30:55.000000000 +0100 ++++ shellinabox-2.10/Makefile.am 2010-03-25 19:53:49.000000000 +0100 +@@ -218,23 +218,23 @@ + debian/tmp + + .css.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .gif.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .html.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .ico.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h +@@ -249,12 +249,12 @@ + "$<" >"$@" + + .js.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .wav.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + +diff -Naur shellinabox-2.10.orig/Makefile.in shellinabox-2.10/Makefile.in +--- shellinabox-2.10.orig/Makefile.in 2010-03-25 19:30:55.000000000 +0100 ++++ shellinabox-2.10/Makefile.in 2010-03-25 19:54:21.000000000 +0100 +@@ -1231,23 +1231,23 @@ + debian/tmp + + .css.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .gif.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .html.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .ico.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h +@@ -1262,13 +1262,13 @@ + "$<" >"$@" + + .js.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + .wav.o: +- @echo objcopy "$<" "$@" +- @objcopy -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ ++ @echo $(OBJCOPY) "$<" "$@" ++ @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)` \ + "$<" "$@" + + # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/package/network/services/shellinabox/old/002-httpconn-isnan.patch b/package/network/services/shellinabox/old/002-httpconn-isnan.patch new file mode 100644 index 0000000000..85484afc50 --- /dev/null +++ b/package/network/services/shellinabox/old/002-httpconn-isnan.patch @@ -0,0 +1,20 @@ +--- shellinabox-2.10.orig/libhttp/httpconnection.c 2015-09-25 10:55:38.350974827 +0000 ++++ shellinabox-2.10/libhttp/httpconnection.c 2015-09-25 10:56:23.462944723 +0000 +@@ -69,6 +69,17 @@ + #define max(a, b) ({ typeof(a) _a = (a); typeof(b) _b = (b); \ + _a > _b ? _a : _b; }) + ++#undef isnan ++#ifndef isnan ++# define isnan(x) \ ++ (sizeof (x) == sizeof (long double) ? isnan_ld (x) \ ++ : sizeof (x) == sizeof (double) ? isnan_d (x) \ ++ : isnan_f (x)) ++static inline int isnan_f (float x) { return x != x; } ++static inline int isnan_d (double x) { return x != x; } ++static inline int isnan_ld (long double x) { return x != x; } ++#endif ++ + #include "libhttp/httpconnection.h" + #include "logging/logging.h" + diff --git a/package/network/services/shellinabox/old/readme b/package/network/services/shellinabox/old/readme new file mode 100644 index 0000000000..77f4bf8cea --- /dev/null +++ b/package/network/services/shellinabox/old/readme @@ -0,0 +1,5 @@ +Files here are patches required to get shellinabox-2.10 from Google Code to compile in OpenWRT buildroot + +These fixes have been integrated into the code in the Onion shellinabox repo + +