update 2025-02-16 22:20:56

This commit is contained in:
actions-user 2025-02-16 22:20:56 +08:00
parent 44bb664b8c
commit 6c79d18ef4
32 changed files with 941 additions and 0 deletions

94
istoreos-files/Makefile Normal file
View File

@ -0,0 +1,94 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=istoreos-files
PKG_VERSION:=1.0
PKG_RELEASE:=$(COMMITCOUNT)
PKG_FLAGS:=hold essential nonshared
PKG_LICENSE:=CC0-1.0
PKG_MAINTAINER:=jjm2473 <jjm2473@gmail.com>
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=base
CATEGORY:=Base system
TITLE:=iStoreOS files
MAINTAINER:=jjm2473 <jjm2473@gmail.com>
DEFAULT:=y
HIDDEN:=y
DEPENDS:=+luci-theme-argon
endef
define Package/$(PKG_NAME)/description
The iStoreOS.
endef
define Package/istoreos-intl
SECTION:=base
CATEGORY:=Base system
TITLE:=iStoreOS intl
MAINTAINER:=jjm2473 <jjm2473@gmail.com>
DEPENDS:=$(PKG_NAME)
endef
define Package/istoreos-intl/description
iStoreOS internationalization.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Compile/Default
endef
Build/Compile = $(Build/Compile/Default)
define Package/$(PKG_NAME)/install
$(CP) ./files/* $(1)/
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
HOST_SED="$(subst ${STAGING_DIR_HOST},$${STAGING_DIR_HOST},$(SED))"
HOST_LN="$(subst ${STAGING_DIR_HOST},$${STAGING_DIR_HOST},$(LN))"
[ -n "$${IPKG_INSTROOT}" ] && {
$${HOST_SED} 's,^src/gz istoreos_,src/gz openwrt_,g' -e '/^src\/gz openwrt_\(core\|base\|kmods\|luci\|packages\|routing\|telephony\) /!d' "$${IPKG_INSTROOT}/etc/opkg/distfeeds.conf"
$${HOST_SED} 's/"192.168.1.1"/"192.168.100.1"/' \
"$${IPKG_INSTROOT}/usr/lib/lua/luci/controller/admin/system.lua" \
"$${IPKG_INSTROOT}/usr/lib/lua/luci/controller/admin/ota.lua" \
"$${IPKG_INSTROOT}/bin/config_generate"
$${HOST_SED} "s/'192\\.168\\.1\\.1'/'192.168.100.1'/; s/'openwrt\\.lan'/window.location.host/" "$${IPKG_INSTROOT}/www/luci-static/resources/view/system/flash.js"
$${HOST_SED} 's/s\.anonymous = true/s\.anonymous = true\ns\.addremove = true/' "$${IPKG_INSTROOT}/usr/lib/lua/luci/model/cbi/hd_idle.lua"
$${HOST_SED} 's#"/opt"#"/overlay/upper/opt/docker"#' "$${IPKG_INSTROOT}/usr/lib/lua/luci/model/cbi/admin_system/fstab/mount.lua"
rm -f "$${IPKG_INSTROOT}/sbin/jffs2reset"
$${HOST_LN} /sbin/firstboot "$${IPKG_INSTROOT}/sbin/jffs2reset"
$${HOST_SED} '/<link rel="shortcut icon" href="<%=media%>\/favicon.ico">/a <link rel="stylesheet" href="<%=resource%>/easepi/easeicon.css?t=1649313193968">' \
"$${IPKG_INSTROOT}/usr/lib/lua/luci/view/themes/argon/header.htm" \
"$${IPKG_INSTROOT}/usr/lib/lua/luci/view/themes/argon_dark/header.htm" \
"$${IPKG_INSTROOT}/usr/lib/lua/luci/view/themes/argon_light/header.htm" \
"$${IPKG_INSTROOT}/usr/lib/lua/luci/view/themes/argon_dark_purple/header.htm" \
"$${IPKG_INSTROOT}/usr/lib/lua/luci/view/themes/argon_light_green/header.htm"
rm -f "$${IPKG_INSTROOT}/etc/uci-defaults/luci-argon-config"
}
true
endef
define Package/istoreos-intl/install
$(CP) ./intl/* $(1)/
endef
$(eval $(call BuildPackage,istoreos-files))
$(eval $(call BuildPackage,istoreos-intl))

View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# Copyright (C) 2018 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
board_config_update
ucidef_set_hostname "iStoreOS"
ucidef_set_timezone "CST-8"
ucidef_set_ntpserver "0.cn.pool.ntp.org" "1.cn.pool.ntp.org" "2.cn.pool.ntp.org" "3.cn.pool.ntp.org"
board_config_flush
exit 0

View File

@ -0,0 +1 @@
# see https://man7.org/linux/man-pages/man5/crontab.5.html

View File

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

View File

@ -0,0 +1,58 @@
#!/bin/sh
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
[ "$ACTION" = ifupdate -a -z "$IFUPDATE_ADDRESSES" -a -z "$IFUPDATE_DATA" ] && exit 0
[ "$INTERFACE" = wan ] || exit 0
uci -q get firewall.allow_wan_input || exit 0
is_private_ipv4() {
local ADDRESS="$1"
local MASK="$2"
local IP NETMASK BROADCAST NETWORK PREFIX
if [ "$MASK" -ge 8 ]; then
NETWORK=
eval $(ipcalc.sh "$ADDRESS/8")
[ "$NETWORK" = "10.0.0.0" ] && return 0
fi
if [ "$MASK" -ge 12 ]; then
NETWORK=
eval $(ipcalc.sh "$ADDRESS/12")
[ "$NETWORK" = "172.16.0.0" ] && return 0
fi
if [ "$MASK" -ge 16 ]; then
NETWORK=
eval $(ipcalc.sh "$ADDRESS/16")
[ "$NETWORK" = "192.168.0.0" ] && return 0
fi
return 1
}
WAN_IS_PRIVATE=false
(
ADDRESS=
MASK=
PROTO=
UP=
eval $(ifstatus wan | jsonfilter \
-e 'ADDRESS=@["ipv4-address"][0].address' \
-e 'MASK=@["ipv4-address"][0].mask' \
-e 'PROTO=@.proto' \
-e 'UP=@.up'
)
logger -t allow_wan_input "WAN up:$UP proto:$PROTO ip:$ADDRESS mask:$MASK"
[ "$PROTO" = dhcp ] || exit 1
[ -n "$ADDRESS" -a -n "$MASK" ] || exit 1
is_private_ipv4 "$ADDRESS" "$MASK"
) && WAN_IS_PRIVATE=true
if $WAN_IS_PRIVATE ; then
logger -t allow_wan_input "Enable allow_wan_input rule for private address"
uci delete firewall.allow_wan_input.enabled
else
logger -t allow_wan_input "Disable allow_wan_input rule for public address"
uci set firewall.allow_wan_input.enabled=0
fi
uci commit firewall

View File

@ -0,0 +1,27 @@
#!/bin/sh /etc/rc.common
START=11
USE_PROCD=1
auto_mount() {
[ "`uci -q get fstab.@global[0].port_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

@ -0,0 +1,23 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
STOP=00
shutdown() {
local message="System Shutting Down"
logger -s -t "DEBUG" "$message"
logger -t "DEBUG" "$message"
local consoles="$(cat /sys/class/tty/console/active)"
[ -n "$consoles" ] || consoles=console
for console in $consoles; do
[ -c "/dev/$console" ] && echo "$message" >"/dev/$console"
done
# blink led
. /etc/diag.sh
[ -n "$running" ] && {
status_led="$running"
status_led_blink_preinit_regular
}
}

View File

@ -0,0 +1,22 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2016 OpenWrt.org
START=49
list_langs() {
cd /usr/lib/lua/luci/i18n
ls | sed -e 's/.*\.\([^\.]*\)\.lmo/\1/g' | sort -u
}
boot() {
local lang
local name
for lang in `list_langs`
do
if ! uci get luci.languages.${lang//-/_} >/dev/null 2>&1; then
name=`luci18n2name $lang`
uci set "luci.languages.${lang//-/_}=${name:-$lang}"
fi
done
uci changes luci | grep -Fqm1 luci 2>/dev/null && uci commit luci >/dev/null 2>&1
}

View File

@ -0,0 +1,32 @@
#!/bin/sh /etc/rc.common
START=97
check_kernel() {
local major=$1
local minor=$2
[ "$major" -gt 5 -o \( "$major" -eq 5 -a "$minor" -ge 4 \) ]
}
boot() {
if check_kernel `uname -r | grep -Eo '[0-9]+\.[0-9]+' | sed 's/\./ /g'`; then
if [ ! -f /usr/lib/samba/vfs/io_uring.so ]; then
if [ -f /usr/lib/samba/vfs/io_uring.so.bak ]; then
mv /usr/lib/samba/vfs/io_uring.so.bak /usr/lib/samba/vfs/io_uring.so
elif [ -f /rom/usr/lib/samba/vfs/io_uring.so ]; then
mkdir -p /usr/lib/samba/vfs
cp -a /rom/usr/lib/samba/vfs/io_uring.so /usr/lib/samba/vfs/io_uring.so
cat /usr/lib/samba/vfs/io_uring.so >/dev/null
rm -f /overlay/upper/usr/lib/samba/vfs/io_uring.so
fi
fi
rm -f /usr/lib/samba/vfs/io_uring.so.bak
elif [ -f /usr/lib/samba/vfs/io_uring.so ]; then
rm -f /usr/lib/samba/vfs/io_uring.so.bak
if [ ! -d /overlay/upper -o -f /overlay/upper/usr/lib/samba/vfs/io_uring.so ]; then
mv /usr/lib/samba/vfs/io_uring.so /usr/lib/samba/vfs/io_uring.so.bak
else
rm -f /usr/lib/samba/vfs/io_uring.so
fi
fi
}

View File

@ -0,0 +1,13 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
STOP=89
shutdown() {
/etc/init.d/dockerman stop 2>/dev/null
/etc/init.d/dockerd stop 2>/dev/null
/etc/init.d/netdata stop 2>/dev/null
while /usr/bin/umount -R -d /overlay/upper/opt/docker; do true; done
}

View File

@ -0,0 +1,102 @@
#!/bin/sh /etc/rc.common
# istoreos upgrade post process
# Copyright (C) 2022 jjm2473
START=14
split_opkg_status() {
local line
local gap=1
exec 3>/dev/null
rm -rf $2
mkdir -p $2
cat $1 | while read; do
line="$REPLY"
if [ -z "$line" ]; then
echo >&3
exec 3>&-
exec 3>/dev/null
gap=1
else
if [[ "x1" = "x$gap" && "$line" = "Package: *" ]]; then
exec 3>&-
exec 3>$2/${line##Package: }
gap=0
fi
echo "$line" >&3
fi
done
exec 3>&-
}
split_both_status() {
split_opkg_status /usr/lib/opkg/status /tmp/newopkgstatus &
split_opkg_status /rom/usr/lib/opkg/status /tmp/romopkgstatus &
wait
}
ls_all_pkgs() {
( cd /usr/lib/opkg/info ; find . -maxdepth 1 -name '*.control' | sed -E 's#./(.*).control#\1#g' | grep -v '^kernel$' )
}
rebuild_opkg_status() {
local line
[ -f /tmp/romopkgstatus/kernel ] && cat /tmp/romopkgstatus/kernel
ls_all_pkgs | while read line; do
if [ -f /overlay/upper/usr/lib/opkg/info/$line.control -o -f /ext_overlay/upper/usr/lib/opkg/info/$line.control ]; then
echo /tmp/newopkgstatus/$line
else
echo /tmp/romopkgstatus/$line
fi
done | xargs cat
}
clean_tmp_files() {
rm -rf /tmp/newopkgstatus
rm -rf /tmp/romopkgstatus
}
clean_themes() {
local line
local name
local path
uci show luci.themes | tail -n +2 | sed "s/^luci.themes.//g; s/'//g" | while read; do
line="$REPLY"
name=`echo "$line" | cut -d= -f 1`
path=`echo "$line" | cut -d= -f 2`
[ "x$path" != "x" -a -d /www$path ] || uci delete "luci.themes.$name"
done
uci commit luci
}
is_overlayed() {
[ -e "/overlay/upper$1" -o -e "/ext_overlay/upper$1" ]
}
upgrade_opkg_distfeeds() {
local newrelease=$(grep -m1 '/base$' /rom/etc/opkg/distfeeds.conf | grep -Eo '/releases/[^/]+/')
local oldrelease=$(grep -m1 '/base$' /etc/opkg/distfeeds.conf | grep -Eo '/releases/[^/]+/')
[ -z "$newrelease" -o -z "$oldrelease" ] && return 0
[ "$newrelease" = "$oldrelease" ] && return 0
sed -i -e 's#'"$oldrelease"'#'"$newrelease"'#g' /etc/opkg/distfeeds.conf
}
boot() {
[ -f /.recovery_mode ] && return 0
if [ -f /usr/lib/opkg/.upgrading ]; then
rm -f /usr/lib/opkg/.upgrading
is_overlayed /usr/lib/opkg/status && {
split_both_status
rebuild_opkg_status > /usr/lib/opkg/status
clean_tmp_files
}
is_overlayed /etc/config/luci && {
clean_themes
}
is_overlayed /etc/opkg/distfeeds.conf && {
upgrade_opkg_distfeeds
}
fi
rm -f /overlay/upper/.upgrading
}

View File

@ -0,0 +1,26 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2016 OpenWrt.org
START=20
USE_PROCD=1
start_service() {
/etc/init.d/wan_drop enabled || return 0
local PROTO=`uci get network.wan.proto`
logger -t 'wan_drop' "current proto $PROTO"
if [ "$PROTO" = "pppoe" ]; then
WAN_ZONE=`uci show firewall | grep -E '^firewall\.@zone\[[0-9]+\]\.name='"'wan'" | head -n1 | head -c -12`
if [ "`uci get ${WAN_ZONE}.input`" = "ACCEPT" ]; then
logger -t 'wan_drop' "set firewall drop input from wan"
uci -q batch <<-EOF >/dev/null
set ${WAN_ZONE}.input=DROP
commit firewall
EOF
/etc/init.d/firewall reload >/dev/null
fi
fi
}
service_triggers() {
procd_add_reload_trigger "network"
}

View File

@ -0,0 +1,20 @@
#!/bin/sh /etc/rc.common
# 2022 jjm2473
START=99
boot() {
# tune printk level after success boot, avoid noise in console
echo '4 5 1 7' > /proc/sys/kernel/printk
# notify console system is ready
sleep 1
local pids=`pgrep -P 1 askfirst 2>/dev/null`
if [ -n "$pids" ]; then
local pid
for pid in $pids; do
echo "iStoreOS is ready!" >/proc/$pid/fd/1
echo "Please press Enter to activate this console." >/proc/$pid/fd/1
done
fi
}

View File

@ -0,0 +1,4 @@
net.netfilter.nf_conntrack_max=65535
net.netfilter.nf_conntrack_helper=1
net.netfilter.nf_conntrack_buckets=16384
net.netfilter.nf_conntrack_expect_max=16384

View File

@ -0,0 +1,87 @@
#!/bin/sh
# Copyright (C) 2022 jjm2473
if [ ! -f /etc/config/fstab ]; then
/usr/libexec/blockmount.sh detect 2>/dev/null
fi
uci -q batch <<-EOF >/dev/null
set system.@system[-1].zonename='Asia/Shanghai'
commit system
EOF
uci set dockerd.globals.data_root=/overlay/upper/opt/docker
if grep -qFw nas /proc/device-tree/chosen/default-firewall; then
WAN_ZONE=`uci show firewall | grep -E '^firewall\.@zone\[[0-9]+\]\.name='"'wan'" | head -n1 | head -c -12`
uci -q batch <<-EOF >/dev/null
del_list dockerd.firewall.blocked_interfaces=wan
set ${WAN_ZONE}.input=ACCEPT
commit firewall
EOF
uci -q batch <<-EOF >/dev/null
delete ucitrack.@wan_drop[-1]
add ucitrack wan_drop
set ucitrack.@wan_drop[-1].init=wan_drop
commit ucitrack
EOF
else
/etc/init.d/wan_drop disable
if grep -qFw dual /proc/device-tree/chosen/default-firewall; then
# firewall.allow_wan_input will auto enabled by /etc/hotplug.d/iface/19-fw-wan-input
uci -q batch <<-EOF >/dev/null
set firewall.allow_wan_input=rule
set firewall.allow_wan_input.name='Allow-WAN-Input'
set firewall.allow_wan_input.proto='all'
set firewall.allow_wan_input.src='wan'
set firewall.allow_wan_input.target='ACCEPT'
set firewall.allow_wan_input.enabled='0'
commit firewall
EOF
fi
fi
if ! grep -qFw router /proc/device-tree/chosen/default-firewall; then
WAN_IF=`jsonfilter -i /etc/board.json -e '@.network.wan.device'`
if [ -n "$WAN_IF" -a -e /etc/config/minidlna ]; then
uci -q batch <<-EOF >/dev/null
set minidlna.@minidlna[0].interface='br-lan,$WAN_IF'
commit minidlna
EOF
fi
if [ -e /etc/config/ttyd ]; then
uci -q batch <<-EOF >/dev/null
delete ttyd.@ttyd[0].interface
commit ttyd
EOF
fi
for samba in samba4 samba ; do
if [ -e /etc/config/$samba ]; then
uci -q batch <<-EOF >/dev/null
set $samba.@samba[0].interface='lan wan'
commit $samba
EOF
fi
done
fi
uci -q batch <<-EOF >/dev/null
commit dockerd
EOF
uci -q batch <<-EOF >/dev/null
set luci.apply.rollback=30
set luci.apply.holdoff=2
commit luci
EOF
if [ -f /etc/config/argon ]; then
uci -q batch <<-EOF >/dev/null
set argon.@global[0].mode=light
commit argon
EOF
fi
exit 0

View File

@ -0,0 +1,10 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete upnpd.config.use_stun
set upnpd.config.stun_host='stun.sipgate.net'
set upnpd.config.force_forwarding='1'
commit upnpd
EOF
exit 0

View File

@ -0,0 +1,15 @@
#!/bin/sh
uci -q batch <<-EOF
set firewall.docker_nat=nat
set firewall.docker_nat.name='DockerNAT'
set firewall.docker_nat.family='ipv4'
set firewall.docker_nat.proto='all'
set firewall.docker_nat.src='lan'
set firewall.docker_nat.target='MASQUERADE'
set firewall.docker_nat.extra='-i docker0'
set firewall.docker_nat.src_ip='172.16.0.0/12'
commit firewall
EOF
exit 0

View File

@ -0,0 +1,24 @@
#!/bin/sh
mediaurlbase=
theme=
if [ -d /www/luci-static/argon_light_green -a -e /proc/device-tree/chosen/default-password ]; then
mediaurlbase=/luci-static/argon_light_green
else
for theme in argon argon_dark material ; do
if [ -d /www/luci-static/$theme ]; then
mediaurlbase=/luci-static/$theme
break
fi
done
fi
if [ -n "$mediaurlbase" ]; then
uci -q batch <<-EOF >/dev/null
set luci.main.mediaurlbase=$mediaurlbase
commit luci
EOF
fi
exit 0

View File

@ -0,0 +1,4 @@
failsafe_dropbear () {
cp -a /etc/dropbear/dropbear_failsafe_host_key /tmp/dropbear_failsafe_host_key
dropbear -r /tmp/dropbear_failsafe_host_key <> /dev/null 2>&1
}

View File

@ -0,0 +1,45 @@
#!/bin/sh
# author: jjm2473
toname() {
local lang_ar="العربية (Arabic)"
local lang_bg="български (Bulgarian)"
local lang_bn="বাংলা (Bengali)"
local lang_ca="Català (Catalan)"
local lang_cs="Čeština (Czech)"
local lang_da="Dansk (Danish)"
local lang_de="Deutsch (German)"
local lang_el="Ελληνικά (Greek)"
local lang_en="English"
local lang_es="Español (Spanish)"
local lang_fi="Suomi (Finnish)"
local lang_fr="Français (French)"
local lang_he="עִבְרִית (Hebrew)"
local lang_hi="हिंदी (Hindi)"
local lang_hu="Magyar (Hungarian)"
local lang_it="Italiano (Italian)"
local lang_ja="日本語 (Japanese)"
local lang_ko="한국어 (Korean)"
local lang_mr="Marāṭhī (Marathi)"
local lang_ms="Bahasa Melayu (Malay)"
local lang_no="Norsk (Norwegian)"
local lang_nl="Nederlands (Dutch)"
local lang_pl="Polski (Polish)"
local lang_pt_br="Português do Brasil (Brazilian Portuguese)"
local lang_pt="Português (Portuguese)"
local lang_ro="Română (Romanian)"
local lang_ru="Русский (Russian)"
local lang_sk="Slovenčina (Slovak)"
local lang_sv="Svenska (Swedish)"
local lang_tr="Türkçe (Turkish)"
local lang_uk="Українська (Ukrainian)"
local lang_vi="Tiếng Việt (Vietnamese)"
local lang_zh_cn="简体中文 (Chinese Simplified)"
local lang_zh_tw="繁體中文 (Chinese Traditional)"
eval "[ -n \"\${lang_$1}\" ] && echo \${lang_$1}"
}
if [ -n "$1" ]; then
toname ${1//-/_}
fi

View File

@ -0,0 +1,10 @@
-- Copyright 2022 jjm2473 <jjm2473@gmail.com>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.admin.compat", package.seeall)
function action_fatab()
local dsp = require "luci.dispatcher"
luci.http.redirect(dsp.build_url("admin/system/mounts"))
end

View File

@ -0,0 +1,117 @@
#!/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/libexec/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
local dev
if [ "$DETECT" = "0" -a -n "$DEVNAME" ]; then
dev="/dev/$DEVNAME"
fi
block info $dev | 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 port_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 -q batch <<-EOF >/dev/null
set fstab.@global[0].port_mount=1
commit fstab
EOF
fi

View File

@ -0,0 +1,82 @@
#!/bin/sh
DEVNAME=${1#/dev/}
[ -z "$DEVNAME" ] && exit 1
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%%-1}
echo usb`echo "$usb" | sed 's/[-.]/_/g'`
return 0
fi
case "$DISK" in
mmcblk*)
echo "$path" | grep -oE '/mmc[0-9]+/'
return 0
;;
nvme*)
echo "/$DISK/"
return 0
;;
esac
# sata
local sata=`echo "$path" | grep -oE '/ata[0-9]+/host[0-9]+/target[0-9]+:[0-9]+'`
if [ -n "$sata" ]; then
sata=`echo "$sata" | sed -r 's#/ata([0-9]+)/host[0-9]+/target[0-9]+:([0-9]+)#sata\1.\2#'`
sata=${sata%%.0}
echo "/$sata/"
return 0
fi
# virtio
sata=`echo "$path" | grep -oE '/virtio[0-9]+/host[0-9]+/target[0-9]+:[0-9]+:[0-9]+'`
if [ -n "$sata" ]; then
sata=`echo "$sata" | sed -r 's#/virtio([0-9]+)/host[0-9]+/target[0-9]+:[0-9]+:([0-9]+)#vio\1.\2#'`
sata=${sata%%.0}
echo "/$sata/"
return 0
fi
# sas
sata=`echo "$path" | grep -oE '/host[0-9]+/port-[0-9]+:[0-9]+'`
if [ -n "$sata" ]; then
sata=`echo "$sata" | sed -r 's#/host([0-9]+)/port-[0-9]+:([0-9]+)#sas\1.\2#'`
sata=${sata%%.0}
echo "/$sata/"
return 0
fi
# scsi
sata=`echo "$path" | grep -oE '/host[0-9]+/target[0-9]+:[0-9]+:[0-9]+'`
if [ -n "$sata" ]; then
sata=`echo "$sata" | sed -r 's#/host([0-9]+)/target[0-9]+:[0-9]+:([0-9]+)#scsi\1.\2#'`
sata=${sata%%.0}
echo "/$sata/"
return 0
fi
echo "$path" | grep -oE '/host[0-9]+/' | sed 's/host/sata/g'
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

@ -0,0 +1,7 @@
#!/bin/sh
if [ -x /rom/usr/bin/curl ]; then
/usr/bin/curl -V >/dev/null 2>&1 && exec /usr/bin/curl "$@"
exec /rom/usr/bin/curl "$@"
fi
exec /usr/bin/curl "$@"

View File

@ -0,0 +1,9 @@
{
"admin/system/fstab": {
"action": {
"type": "call",
"module": "luci.controller.admin.compat",
"function": "action_fatab"
}
}
}

View File

@ -0,0 +1,57 @@
@font-face {
font-family: "easeicon"; /* Project id 3156136 */
src: url('iconfont.woff2?t=1642756089463') format('woff2'),
url('iconfont.woff?t=1642756089463') format('woff'),
url('iconfont.ttf?t=1642756089463') format('truetype');
}
.easeicon {
font-family: "easeicon" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.eicon-store:before {
content: "\e60f";
}
.eicon-docker:before {
content: "\e659";
}
.eicon-network:before {
content: "\ecc7";
}
.eicon-dashboard:before {
content: "\e664";
}
.main>.main-left>.nav>li.slide>.menu[data-title=Docker]:before {
font-family: 'easeicon' !important;
content: "\e659" !important;
color: #0c93f3;
}
.main>.main-left>.nav>li.slide>.menu[data-title=iStore]:before,
.main>.main-left>.nav>li>a[data-title=iStore]:before {
font-family: 'easeicon' !important;
content: "\e60f" !important;
color: #8965e0;
}
.main>.main-left>.nav>li.slide>.menu[data-title=QuickStart]:before,
.main>.main-left>.nav>li>a[data-title=QuickStart]:before {
font-family: 'easeicon' !important;
content: "\e664" !important;
color: #11cdef;
}
.main>.main-left>.nav>li.slide>.menu[data-title=NetworkGuide]:before,
.main>.main-left>.nav>li>a[data-title=NetworkGuide]:before {
font-family: 'easeicon' !important;
content: "\ecc7" !important;
color: #fb6340;
}

View File

@ -0,0 +1,30 @@
if PACKAGE_istoreos-files
config PACKAGE_istoreos-files_CUSTOMIZE_SETTINGS
bool
default y
select LUCI_LANG_zh_Hans
select KERNEL_PROC_PAGE_MONITOR
select BUSYBOX_CUSTOM
select BUSYBOX_CONFIG_TOP
select BUSYBOX_CONFIG_FEATURE_TOPMEM # top -m
select BUSYBOX_CONFIG_DD
select BUSYBOX_CONFIG_FEATURE_DD_SIGNAL_HANDLING
select BUSYBOX_CONFIG_FEATURE_DD_THIRD_STATUS_LINE # dd show speed
config LUCI_LANG_zh-cn
tristate
default LUCI_LANG_zh_Hans
config LUCI_LANG_zh-tw
tristate
default LUCI_LANG_zh_Hant
config LUCI_LANG_pt-br
tristate
default LUCI_LANG_pt_BR
config LUCI_LANG_no
tristate
default LUCI_LANG_nb_NO
config LUCI_LANG_bn
tristate
default LUCI_LANG_bn_BD
endif

View File

@ -0,0 +1 @@
# dummy file