istoreos: fix some grep patterns to limited syntax
This commit is contained in:
parent
45892831e7
commit
8da479e698
@ -43,7 +43,7 @@ _getpartofdisk()
|
||||
echo "$disk"
|
||||
else
|
||||
part="$disk"
|
||||
echo "$part" | grep -q '^.*\d$' && part="${part}p"
|
||||
echo "$part" | grep -q '^.*[0-9]$' && part="${part}p"
|
||||
part="${part}"$(( ${offset} ))
|
||||
if [ ! -b "/dev/$part" ]; then
|
||||
# lvm
|
||||
|
||||
@ -236,7 +236,7 @@ export_partdevice() {
|
||||
return 0
|
||||
else
|
||||
part="$BOOTDEV_DEVNAME"
|
||||
echo "$part" | grep -q '^.*\d$' && part="${part}p"
|
||||
echo "$part" | grep -q '^.*[0-9]$' && part="${part}p"
|
||||
part="${part}${offset}"
|
||||
if [ -b "/dev/$part" ]; then
|
||||
export "$var=$part"
|
||||
|
||||
@ -9,7 +9,7 @@ check_kernel() {
|
||||
}
|
||||
|
||||
boot() {
|
||||
if check_kernel `uname -r | grep -Eo '\d+\.\d+' | sed 's/\./ /g'`; then
|
||||
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
|
||||
|
||||
@ -8,7 +8,7 @@ start_service() {
|
||||
local PROTO=`uci get network.wan.proto`
|
||||
logger -t 'wan_drop' "current proto $PROTO"
|
||||
if [ "$PROTO" = "pppoe" ]; then
|
||||
WAN_ZONE=`uci show firewall | egrep '^firewall\.@zone\[\d+\]\.name=' | grep wan | head -n1 | head -c -12`
|
||||
WAN_ZONE=`uci show firewall | grep -E '^firewall\.@zone\[[0-9]+\]\.name=' | grep 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
|
||||
|
||||
@ -22,7 +22,7 @@ if [ ! -f /proc/device-tree/chosen/default-firewall ] || grep -qFw nas /proc/dev
|
||||
EOF
|
||||
|
||||
if grep -qFw nas /proc/device-tree/chosen/default-firewall; then
|
||||
WAN_ZONE=`uci show firewall | egrep '^firewall\.@zone\[\d+\]\.name=' | grep wan | head -n1 | head -c -12`
|
||||
WAN_ZONE=`uci show firewall | grep -E '^firewall\.@zone\[[0-9]+\]\.name=' | grep wan | head -n1 | head -c -12`
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
del_list dockerd.firewall.blocked_interfaces=wan
|
||||
set ${WAN_ZONE}.input=ACCEPT
|
||||
|
||||
@ -6,7 +6,7 @@ DEVNAME=${1#/dev/}
|
||||
getdisk() {
|
||||
local DISK=$1
|
||||
local path=`readlink /sys/block/$DISK`
|
||||
local usb=`echo "$path" | grep -oE '/usb\d+/[^:]+'`
|
||||
local usb=`echo "$path" | grep -oE '/usb[0-9]+/[^:]+'`
|
||||
if [ -n "$usb" ]; then
|
||||
usb=${usb##*/}
|
||||
usb=${usb%%-1}
|
||||
@ -15,7 +15,7 @@ getdisk() {
|
||||
fi
|
||||
case "$DISK" in
|
||||
mmcblk*)
|
||||
echo "$path" | grep -oE '/mmc\d+/'
|
||||
echo "$path" | grep -oE '/mmc[0-9]+/'
|
||||
return 0
|
||||
;;
|
||||
nvme*)
|
||||
@ -24,38 +24,38 @@ getdisk() {
|
||||
;;
|
||||
esac
|
||||
# sata
|
||||
local sata=`echo "$path" | grep -oE '/ata\d+/host\d+/target\d+:\d+'`
|
||||
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(\d+)/host\d+/target\d+:(\d+)#sata\1.\2#'`
|
||||
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\d+/host\d+/target\d+:\d+:\d+'`
|
||||
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(\d+)/host\d+/target\d+:\d+:(\d+)#vio\1.\2#'`
|
||||
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\d+/port-\d+:\d+'`
|
||||
sata=`echo "$path" | grep -oE '/host[0-9]+/port-[0-9]+:[0-9]+'`
|
||||
if [ -n "$sata" ]; then
|
||||
sata=`echo "$sata" | sed -r 's#/host(\d+)/port-\d+:(\d+)#sas\1.\2#'`
|
||||
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\d+/target\d+:\d+:\d+'`
|
||||
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(\d+)/target\d+:\d+:(\d+)#scsi\1.\2#'`
|
||||
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\d+/' | sed 's/host/sata/g'
|
||||
echo "$path" | grep -oE '/host[0-9]+/' | sed 's/host/sata/g'
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user