2015-10-01 15:34:13 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2015 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=cgi-io
|
2019-10-11 13:07:17 +00:00
|
|
|
PKG_RELEASE:=14
|
2015-10-01 15:34:13 +00:00
|
|
|
|
2019-09-02 13:15:08 +00:00
|
|
|
PKG_LICENSE:=GPL-2.0-or-later
|
2015-10-01 15:34:13 +00:00
|
|
|
|
|
|
|
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
include $(INCLUDE_DIR)/cmake.mk
|
|
|
|
|
|
|
|
define Package/cgi-io
|
|
|
|
SECTION:=net
|
|
|
|
CATEGORY:=Network
|
|
|
|
SUBMENU:=Web Servers/Proxies
|
|
|
|
DEPENDS:=+libubox +libubus
|
|
|
|
TITLE:=CGI utility for handling up/downloading of files
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/cgi-io/description
|
|
|
|
This package contains an cgi utility that is useful for up/downloading files
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Prepare
|
|
|
|
mkdir -p $(PKG_BUILD_DIR)
|
|
|
|
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/cgi-io/install
|
|
|
|
$(INSTALL_DIR) $(1)/usr/libexec $(1)/www/cgi-bin/
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cgi-io $(1)/usr/libexec
|
2019-09-02 13:15:08 +00:00
|
|
|
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-upload
|
cgi-io: add download operation
Add a new `cgi-download` applet which allows to retrieve the contents
of regular files or block devices.
In order to initiate a transfer, a POST request in x-www-form-urlencoded
format must be sent to the applet, with one field "sessionid" holding
the login session and another field "path" containing the file path to
download.
Further optional fields are "filename" which - if present - will cause
the download applet to set a Content-Dispostition header and "mimetype"
which allows to let the applet respond with a specific type instead of
the default "application/octet-stream".
Below is an example for the required acl rules to grant download access
to files or block devices:
ubus call session grant '{
"ubus_rpc_session": "...",
"scope": "cgi-io",
"objects": [
[ "download", "read" ]
]
}'
ubus call session grant '{
"ubus_rpc_session": "...",
"scope": "file",
"objects": [
[ "/etc/config/*", "read" ],
[ "/dev/mtdblock*", "read" ]
]
}'
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ab2a2b080d4143bfbbd8584a39999ef998905dd2)
2019-09-13 05:23:25 +00:00
|
|
|
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-download
|
2019-05-30 02:03:29 +00:00
|
|
|
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-backup
|
2015-10-01 15:34:13 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,cgi-io))
|