update 2022-09-15 23:46:55

This commit is contained in:
github-actions[bot] 2022-09-15 23:46:55 +08:00
parent b5cd14b798
commit cf71662d1d
7 changed files with 4 additions and 208 deletions

View File

@ -54,7 +54,7 @@ function to_check()
elseif board_name:match("nanopi%-r4se$") then
model = "rockchip_armv8/friendlyarm_nanopi-r4se"
check_update()
download_url = "https://op.supes.top/firmware/" ..model.. "/" ..remote_version.. "-openwrt-rockchip-armv8-friendlyarm_nanopi-r4se_sd.img.gz"
download_url = "https://op.supes.top/firmware/" ..model.. "/" ..remote_version.. "-openwrt-rockchip-armv8-friendlyarm_nanopi-r4se-squashfs-sysupgrade.img.gz"
elseif board_name:match("fastrhino,r68s$") then
model = "rockchip_armv8/fastrhino_r68s"
check_update()

View File

@ -11,7 +11,7 @@ PKG_ARCH_quickstart:=$(ARCH)
PKG_NAME:=quickstart
PKG_VERSION:=0.5.7
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://fw.koolcenter.com/binary/quickstart/
PKG_HASH:=87e3f9217b750e112ff13576300fc72f7b86940a74207a2c8a976d1e397d5fa2
@ -55,11 +55,8 @@ define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/libexec $(1)/etc/init.d $(1)/etc/uci-defaults $(1)/etc/hotplug.d/block $(1)/etc/config
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/uci-defaults $(1)/etc/hotplug.d/block $(1)/etc/config
$(INSTALL_BIN) $(PKG_BUILD_DIR)/quickstart.$(PKG_ARCH_quickstart) $(1)/usr/sbin/quickstart
$(INSTALL_BIN) ./files/blockphy.sh $(1)/usr/sbin/blockphy.sh
$(INSTALL_BIN) ./files/blockmount.sh $(1)/usr/libexec/blockmount.sh
$(INSTALL_BIN) ./files/blockmount.init $(1)/etc/init.d/blockmount
$(INSTALL_BIN) ./files/quickstart.init $(1)/etc/init.d/quickstart
$(INSTALL_BIN) ./files/quickstart.uci-default $(1)/etc/uci-defaults/09-quickstart
$(INSTALL_BIN) ./files/quickstart.hotplug $(1)/etc/hotplug.d/block/09-quickstart

View File

@ -1,27 +0,0 @@
#!/bin/sh /etc/rc.common
START=39
USE_PROCD=1
auto_mount() {
[ "`uci -q get fstab.@global[0].anon_mount`" = "1" ] && /usr/libexec/blockmount.sh
return 0
}
boot() {
auto_mount
start "$@"
}
service_triggers() {
procd_add_reload_trigger "fstab"
}
reload_service() {
auto_mount
}
start_service() {
return 0
}

View File

@ -1,112 +0,0 @@
#!/bin/sh
DETECT=0
if [ -z "$ACTION" ]; then
log() {
echo "$*" >&2
}
else
log() {
logger -t "blockmount" "$*"
}
fi
# uci_section UUID LABEL DEVICE MOUNTPOINT
check_mount() {
local uuid
local label
local device
local target
config_get uuid $1 uuid
config_get label $1 label
config_get device $1 device
config_get target $1 target
if [ "$DEVICE_CONFIGURED" = "0" -a \( "$uuid" = "$2" -o "$device" = "$4" -o "$target" = "$5" -o \( -n "$3" -a "$3" = "$label" \) \) ]; then
export -n DEVICE_CONFIGURED=1
[ -z "$ACTION" ] && log "found $1 ($uuid, $label, $device, $target) matches ($2, $3, $4, $5)"
fi
}
# UUID LABEL DEVICE MOUNTPOINT
check_configured() {
local DEVICE_CONFIGURED=0
config_foreach check_mount mount "$1" "$2" "$3" "$4"
return $DEVICE_CONFIGURED
}
handle_part() {
[ -z "$ACTION" ] && log "$1 UUID=$UUID TYPE=$TYPE LABEL=$LABEL MOUNT=$MOUNT"
[ -n "$1" ] || return 1
# ignore mounted device, unknown fs type, swap or raid member
[ -z "$UUID" -o -z "$TYPE" \
-o "$TYPE" = "swap" \
-o "$TYPE" = "linux_raid_member" \
] && return 0
if [ "$DETECT" = "1" ]; then
[ -z "$MOUNT" ] && return 0
# in this case, only add mounted device: boot,root,overlayfs, and disable them
log "add mount $UUID => $MOUNT"
uci -q batch <<-EOF >/dev/null
add fstab mount
set fstab.@mount[-1].uuid=$UUID
set fstab.@mount[-1].target=$MOUNT
set fstab.@mount[-1].enabled=0
EOF
elif [ -z "$MOUNT" ]; then
local DEVICENAME="${1#/dev/}"
local candidate="`/usr/sbin/blockphy.sh "$DEVICENAME"`"
[ -z "$candidate" ] && return 0
candidate="/mnt/$candidate"
# check if candidate mount point is busy
mountpoint -q "$candidate" && return 0
# check if configured
check_configured "$UUID" "$LABEL" "$1" "$candidate" || return 0
# log "add mount $UUID => $candidate"
mkdir -p "$candidate" && mount "$1" "$candidate"
fi
}
scan_all() {
local line
block info | while read; do
line="$REPLY"
eval "${line##*: } handle_part ${line%%: *}"
done
}
if [ "$1" = "detect" ]; then
DETECT=1
cat <<-EOF >/etc/config/fstab
config global
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '5'
option check_fs '0'
EOF
fi
. /lib/functions.sh
config_load fstab
scan_all
if [ "$DETECT" = "1" ]; then
uci commit fstab
sleep 2
uci -q batch <<-EOF >/dev/null
set fstab.@global[0].anon_mount=1
commit fstab
EOF
fi

View File

@ -1,55 +0,0 @@
#!/bin/sh
DEVNAME=${1#/dev/}
[ -z "$DEVNAME" ] && exit 1
getusb() {
if [ "$2" = "1" ]; then
echo "/$1/"
return 0
fi
echo "/$1_$2/"
}
getdisk() {
local DISK=$1
local path=`readlink /sys/block/$DISK`
local usb=`echo "$path" | grep -oE '/usb[0-9]+/'`
if [ -n "$usb" ]; then
usb=${usb#/}
usb=${usb%/}
getusb `echo "$path" | grep -oE "/$usb/${usb#usb}-[0-9]+/" | sed -r "s#^/($usb)/${usb#usb}-([0-9]+)/\\\$#\\1 \\2#g"`
return 0
fi
case "$DISK" in
sd*)
echo "$path" | grep -oE '/ata[0-9]+/' | sed 's/ata/sata/g' ;;
mmcblk*)
echo "$path" | grep -oE '/mmc[0-9]+/' ;;
nvme*)
echo "/$DISK/" ;;
esac
return 0
}
getphy() {
[ -e /sys/block/$1 ] || return 1
local disk=`getdisk $1`
disk=${disk#/}
echo "${disk%/}-${2:-0}"
}
# sd[a-z]+([0-9]+)?
# mmcblk[0-9]+(p[0-9]+)?
# nvme[0-9]+n[0-9]+(p[0-9]+)?
case "$DEVNAME" in
sd*)
getphy `echo "$DEVNAME" | sed -r 's/^(sd[a-z]+)([0-9]+)?$/\1 \2/g'` ;;
mmcblk*)
getphy `echo "$DEVNAME" | sed -r 's/^(mmcblk[0-9]+)(p([0-9]+))?$/\1 \3/g'` ;;
nvme*)
getphy `echo "$DEVNAME" | sed -r 's/^(nvme[0-9]+n[0-9]+)(p([0-9]+))?$/\1 \3/g'` ;;
*)
exit 1;
esac

View File

@ -1,4 +1,3 @@
if [ "$ACTION" = "add" -o "$ACTION" = "remove" ]; then
[ "$ACTION" = "add" ] && [ "`uci -q get fstab.@global[0].anon_mount`" = "1" ] && /usr/libexec/blockmount.sh
quickstart blockChange
fi

View File

@ -1,12 +1,6 @@
#!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then
if [ ! -f /etc/config/fstab ]; then
/usr/libexec/blockmount.sh detect 2>/dev/null
fi
else
/etc/init.d/blockmount enable
/etc/init.d/blockmount start
if [ "$PKG_UPGRADE" = 1 ]; then
/etc/init.d/quickstart enable
/etc/init.d/quickstart start
fi