Skip to content

Commit

Permalink
fstool: mount/umount fs without reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Dec 8, 2019
1 parent 40f51ae commit 7655ad3
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package/base-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
include $(INCLUDE_DIR)/feeds.mk

PKG_NAME:=base-files
PKG_RELEASE:=197
PKG_RELEASE:=198
PKG_FLAGS:=nonshared

PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
Expand Down
4 changes: 2 additions & 2 deletions package/base-files/files/sbin/hotplug-call
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ USER=root
export PATH LOGNAME USER
export DEVICENAME="${DEVPATH##*/}"

[ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && {
if [ \! -z "$1" -a -d /etc/hotplug.d/$1 ]; then
for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
[ -f $script ] && . $script
); done
}
fi
10 changes: 5 additions & 5 deletions package/libs/libubox/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=libubox
PKG_RELEASE=2
PKG_RELEASE=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git
PKG_SOURCE_DATE:=2018-07-25
PKG_SOURCE_VERSION:=c83a84afbef2b24f960ddeda0b5e2ab01fba6981
PKG_MIRROR_HASH:=4a9594d2ae3706174d182a21fe815f1d18c20beca6593707cc757994975dc670
PKG_SOURCE_DATE:=2019-06-16
PKG_SOURCE_VERSION:=ecf56174da9614a0b3107d33def463eefb4d7785
PKG_MIRROR_HASH:=e3dd137d69848b8cf2dbc58d70452586dd4178b55977896ea3a9dedaf62c768c
CMAKE_INSTALL:=1

PKG_LICENSE:=ISC
Expand All @@ -27,7 +27,7 @@ define Package/libubox
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Basic utility library
ABI_VERSION:=$(PKG_VERSION)
ABI_VERSION:=20170601
DEPENDS:=
endef

Expand Down
10 changes: 5 additions & 5 deletions package/network/services/uhttpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=uhttpd
PKG_RELEASE:=3
PKG_RELEASE:=4

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
PKG_SOURCE_DATE:=2018-11-28
PKG_SOURCE_VERSION:=cdfc902a4cb77bc538a729f9e1c8a8578454a0e5
PKG_MIRROR_HASH:=6b21111547a4453355bd6c941a47f0116a652a77d87c1e05a035168b8ab2aa6f
PKG_SOURCE_DATE:=2019-08-17
PKG_SOURCE_VERSION:=6b03f9605323df23d12e3876feb466f53f8d50c4
PKG_MIRROR_HASH:=4df96054a4fce659e6c849feae7850d542b37ad5caffc1485b7a63c7c2764cb1
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=ISC

Expand All @@ -34,7 +34,7 @@ endef

define Package/uhttpd
$(Package/uhttpd/default)
DEPENDS:=+libubox +libblobmsg-json +libjson-script
DEPENDS:=+libubox +libblobmsg-json +libjson-script +libjson-c
endef

define Package/uhttpd/description
Expand Down
12 changes: 6 additions & 6 deletions package/system/fstools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=fstools
PKG_RELEASE:=4
PKG_RELEASE:=3

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
PKG_SOURCE_DATE:=2019-03-28
PKG_SOURCE_VERSION:=ff1ded63c51e84e239fb422ac8b9d15251d1221f
PKG_MIRROR_HASH:=2731bbca42c0eafda557d545ebeca243fa4048c433c3b27d31256aca356886bc
PKG_SOURCE_DATE:=2019-08-28
PKG_SOURCE_VERSION:=6a61b9ac105b8eb28680e728a2723e302a91304d
PKG_MIRROR_HASH:=f617d06ccea732fcbfdc2a2bd70c59726d37f61de100fae895d718884a9624d1
CMAKE_INSTALL:=1

PKG_LICENSE:=GPL-2.0
Expand Down Expand Up @@ -79,14 +79,14 @@ define Package/block-mount
SECTION:=base
CATEGORY:=Base system
TITLE:=Block device mounting and checking
DEPENDS:=+ubox +libubox +libuci
DEPENDS:=+ubox +libubox +libuci +libblobmsg-json +libjson-c
endef

define Package/blockd
SECTION:=base
CATEGORY:=Base system
TITLE:=Block device automounting
DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4
DEPENDS:=+block-mount +fstools +libubus +kmod-fs-autofs4 +libblobmsg-json +libjson-c
endef

define Package/fstools/install
Expand Down
7 changes: 6 additions & 1 deletion package/system/fstools/files/fstab.init
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ boot() {
}

start() {
echo "this file has been obsoleted. please call \"/sbin/block mount\" directly"
/sbin/block mount
}

restart() {
/sbin/block umount
/sbin/block mount
}

stop() {
Expand Down
23 changes: 17 additions & 6 deletions package/system/ubox/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=ubox
PKG_RELEASE:=1
PKG_RELEASE:=3

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubox.git
PKG_SOURCE_DATE:=2018-12-18
PKG_SOURCE_VERSION:=876c7f5bfb9b13d48e6d7960dd114082a0a95a6d
PKG_MIRROR_HASH:=7c51ede116f7b17d8249453b10023398a4b662e78294c6fc269c8ed375cb47ce
PKG_SOURCE_DATE:=2019-06-16
PKG_SOURCE_VERSION:=4df34a4d0d5183135217fc8280faae8e697147bc
PKG_MIRROR_HASH:=a4064a1aa29cf612735b0da180f5bdee62304e907f57730482cad97b04f2b189
CMAKE_INSTALL:=1

PKG_LICENSE:=GPL-2.0
Expand All @@ -27,18 +27,28 @@ define Package/ubox
TITLE:=OpenWrt system helper toolbox
endef

define Package/getrandom
SECTION:=base
CATEGORY:=Base system
TITLE:=OpenWrt getrandom system helper
endef

define Package/logd
SECTION:=base
SECTION:=base
CATEGORY:=Base system
DEPENDS:=+libubox +libubus +libblobmsg-json +USE_GLIBC:librt
TITLE:=OpenWrt system log implementation
endef

define Package/getrandom/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/getrandom $(1)/usr/bin/
endef

define Package/ubox/install
$(INSTALL_DIR) $(1)/sbin $(1)/usr/sbin $(1)/lib $(1)/usr/bin

$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{kmodloader,validate_data} $(1)/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/getrandom $(1)/usr/bin/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libvalidate.so $(1)/lib

$(LN) kmodloader $(1)/sbin/rmmod
Expand All @@ -56,4 +66,5 @@ define Package/logd/install
endef

$(eval $(call BuildPackage,ubox))
$(eval $(call BuildPackage,getrandom))
$(eval $(call BuildPackage,logd))
22 changes: 11 additions & 11 deletions package/system/ubox/files/log.init
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PROG=/sbin/logread

validate_log_section()
{
uci_validate_section system system "${1}" \
uci_load_validate system system "$1" "$2" \
'log_file:string' \
'log_size:uinteger' \
'log_hostname:string' \
Expand All @@ -25,15 +25,13 @@ validate_log_section()

validate_log_daemon()
{
uci_validate_section system system "${1}" \
uci_load_validate system system "$1" "$2" \
'log_size:uinteger:0' \
'log_buffer_size:uinteger:0'
}

start_service_daemon()
{
local log_buffer_size log_size
validate_log_daemon "${1}"
[ $log_buffer_size -eq 0 -a $log_size -gt 0 ] && log_buffer_size=$log_size
[ $log_buffer_size -eq 0 ] && log_buffer_size=64
procd_open_instance
Expand All @@ -47,9 +45,8 @@ start_service_file()
{
PIDCOUNT="$(( ${PIDCOUNT} + 1))"
local pid_file="/var/run/logread.${PIDCOUNT}.pid"
local log_file log_size

validate_log_section "${1}" || {
[ "$2" = 0 ] || {
echo "validation failed"
return 1
}
Expand All @@ -67,9 +64,8 @@ start_service_remote()
{
PIDCOUNT="$(( ${PIDCOUNT} + 1))"
local pid_file="/var/run/logread.${PIDCOUNT}.pid"
local log_ip log_port log_proto log_prefix log_remote log_trailer_null log_hostname

validate_log_section "${1}" || {
[ "$2" = 0 ] || {
echo "validation failed"
return 1
}
Expand All @@ -96,7 +92,11 @@ service_triggers()
start_service()
{
config_load system
config_foreach start_service_daemon system
config_foreach start_service_file system
config_foreach start_service_remote system
config_foreach validate_log_daemon system start_service_daemon
config_foreach validate_log_section system start_service_file
config_foreach validate_log_section system start_service_remote
}

service_running() {
procd_running log
}

0 comments on commit 7655ad3

Please sign in to comment.