diff --git a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs b/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs index d6238aa7d4..32fdcfed44 100755 --- a/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs +++ b/package/cnsztl/luci-app-baidupcs-mipsle/files/etc/init.d/baidupcs @@ -1,24 +1,24 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2015 By Wind - -START=90 -STOP=90 - -start() { - config_load baidupcs - enabled=$(uci get baidupcs.config.enabled) - port=$(uci get baidupcs.config.port) - path=$(uci get baidupcs.config.path) - - [ "$enabled" == "1" ] || return - - if [ ! -f "$path/baidupcs" ];then - wget -O $path/baidupcs https://openwrt-cdn.netlify.com/download/bin/mipsle/baidupcs-go && cd $path && ./baidupcs web --port $port --access >/dev/null 2>/dev/null & - else - $path/baidupcs web --port $port --access >/dev/null 2>/dev/null & - fi -} - -stop() { - killall baidupcs >/dev/null 2>/dev/null & -} \ No newline at end of file +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 By Wind + +START=90 +STOP=90 + +start() { + config_load baidupcs + enabled=$(uci get baidupcs.config.enabled) + port=$(uci get baidupcs.config.port) + path=$(uci get baidupcs.config.path) + + [ "$enabled" == "1" ] || return + + if [ ! -f "$path/baidupcs" ];then + wget -O $path/baidupcs https://openwrt-cdn.netlify.com/download/bin/mipsle/baidupcs-go && cd $path && ./baidupcs web --port $port --access >/dev/null 2>/dev/null & + else + $path/baidupcs web --port $port --access >/dev/null 2>/dev/null & + fi +} + +stop() { + killall baidupcs >/dev/null 2>/dev/null & +} diff --git a/package/cnsztl/luci-app-filebrowser-mipsle/Makefile b/package/cnsztl/luci-app-filebrowser-mipsle/Makefile new file mode 100755 index 0000000000..bc0a496b61 --- /dev/null +++ b/package/cnsztl/luci-app-filebrowser-mipsle/Makefile @@ -0,0 +1,72 @@ +# +# Copyright (C) 2016-2017 WindTech +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-filebrowser +PKG_VERSION:=1.0.0 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPLv3 +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=WindTech + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=LuCI Support for FileBrowser FOR MIPSLE ONLY + PKGARCH:=all +# DEPENDS:=+filebrowser + DEPENDS:=+wget +openssl-util +endef + +define Package/$(PKG_NAME)/description + LuCI Support for FileBrowser FOR MIPSLE ONLY. +endef + +define Build/Prepare + $(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \ + po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/uci-defaults/luci-filebrowser ) && rm -f /etc/uci-defaults/luci-filebrowser +fi +exit 0 +endef + +define Package/$(PKG_NAME)/conffiles + /etc/config/filebrowser +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n + $(INSTALL_DATA) ./files/luci/i18n/filebrowser.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n/filebrowser.zh-cn.lmo + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller + $(INSTALL_DATA) ./files/luci/controller/filebrowser.lua $(1)/usr/lib/lua/luci/controller/filebrowser.lua + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/filebrowser + $(INSTALL_DATA) ./files/luci/model/cbi/filebrowser.lua $(1)/usr/lib/lua/luci/model/cbi/filebrowser.lua + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/etc/config/filebrowser $(1)/etc/config/filebrowser + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/etc/init.d/filebrowser $(1)/etc/init.d/filebrowser + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/etc/uci-defaults/luci-filebrowser $(1)/etc/uci-defaults/luci-filebrowser +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) \ No newline at end of file diff --git a/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/config/filebrowser b/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/config/filebrowser new file mode 100755 index 0000000000..d1f48bdb94 --- /dev/null +++ b/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/config/filebrowser @@ -0,0 +1,7 @@ + +config filebrowser 'config' + option enabled '0' + option port '8989' + option scope '/' + option path '/mnt/sda1/filebrowser' + diff --git a/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/init.d/filebrowser b/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/init.d/filebrowser new file mode 100755 index 0000000000..09ec4b6266 --- /dev/null +++ b/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/init.d/filebrowser @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 By Wind + +START=91 +STOP=91 + +start() { + config_load filebrowser + enabled=$(uci get filebrowser.config.enabled) + port=$(uci get filebrowser.config.port) + path=$(uci get filebrowser.config.path) + scope=$(uci get filebrowser.config.scope) + + [ "$enabled" == "1" ] || return + + if [ ! -f "$path/filebrowser" ];then + wget -O $path/filebrowser https://openwrt-cdn.netlify.com/download/bin/mipsle/filebrowser && cd $path && ./filebrowser --port $port --scope $scope >/dev/null 2>/dev/null & + else + cd $path && ./filebrowser --port $port --scope $scope >/dev/null 2>/dev/null & + fi +} + +stop() { + killall filebrowser >/dev/null 2>/dev/null & +} diff --git a/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/uci-defaults/luci-filebrowser b/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/uci-defaults/luci-filebrowser new file mode 100755 index 0000000000..8fece8810e --- /dev/null +++ b/package/cnsztl/luci-app-filebrowser-mipsle/files/etc/uci-defaults/luci-filebrowser @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@filebrowser[-1] + add ucitrack filebrowser + set ucitrack.@filebrowser[-1].init=filebrowser + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 \ No newline at end of file diff --git a/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/controller/filebrowser.lua b/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/controller/filebrowser.lua new file mode 100755 index 0000000000..df8384bfb3 --- /dev/null +++ b/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/controller/filebrowser.lua @@ -0,0 +1,11 @@ +module("luci.controller.filebrowser", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/filebrowser") then + return + end + local page + page = entry({"admin", "services", "filebrowser"}, cbi("filebrowser"), _("FileBrowser"), 100) + page.i18n = "filebrowser" + page.dependent = true +end diff --git a/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/i18n/filebrowser.zh-cn.lmo b/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/i18n/filebrowser.zh-cn.lmo new file mode 100755 index 0000000000..1f329cdee6 Binary files /dev/null and b/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/i18n/filebrowser.zh-cn.lmo differ diff --git a/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/model/cbi/filebrowser.lua b/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/model/cbi/filebrowser.lua new file mode 100755 index 0000000000..3ee1f0971d --- /dev/null +++ b/package/cnsztl/luci-app-filebrowser-mipsle/files/luci/model/cbi/filebrowser.lua @@ -0,0 +1,38 @@ +require("luci.sys") +require("luci.util") +require("luci.model.ipkg") +local fs = require "nixio.fs" + +local uci = require "luci.model.uci".cursor() + +local m, s + +local running=(luci.sys.call("pidof filebrowser > /dev/null") == 0) + +local button = "" +local state_msg = "" +local trport = uci:get_first("filebrowser", "config", "port") or 8989 +if running then + button = "      " +end + +if running then + state_msg = "" .. translate("FileBrowser running") .. "" +else + state_msg = "" .. translate("FileBrowser not running") .. "" +end + +m = Map("filebrowser", translate("FileBrowser"), translate("FileBrowser is a simple web base file browser, here you can configure the settings.") .. button + .. "

" .. translate("FileBrowser Run Status").. " : " .. state_msg .. "
") + +s = m:section(TypedSection, "filebrowser", "") +s.addremove = false +s.anonymous = true + +enable = s:option(Flag, "enabled", translate("Enable")) +enable.rmempty = false + +port=s:option(Value, "port", translate("listen port")) +path=s:option(Value, "path", translate("path")) +scope_dir=s:option(Value, "scope", translate("scope dir")) +return m