functions: cleanup

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-10-25 14:12:48 +02:00
parent a03f4fcada
commit 91babd9162
2 changed files with 6 additions and 17 deletions

View File

@ -1676,19 +1676,6 @@ function greplogs() {
MSG+="Can't find system logs!\n" MSG+="Can't find system logs!\n"
fi fi
PSTORE=0
if [ -n "$(ls /sys/fs/pstore 2>/dev/null)" ]; then
mkdir -p "${TMP_PATH}/logs/pstore"
cp -rf /sys/fs/pstore/* "${TMP_PATH}/logs/pstore"
[ -n "$(ls /sys/fs/pstore/*.z 2>/dev/null)" ] && zlib-flate -uncompress </sys/fs/pstore/*.z >"${TMP_PATH}/logs/pstore/ps.log" 2>/dev/null
PSTORE=1
fi
if [ ${PSTORE} -eq 1 ]; then
MSG+="Pstore logs found!\n"
else
MSG+="Can't find pstore logs!\n"
fi
ADDONS=0 ADDONS=0
if [ -d "${PART1_PATH}/logs" ]; then if [ -d "${PART1_PATH}/logs" ]; then
mkdir -p "${TMP_PATH}/logs/addons" mkdir -p "${TMP_PATH}/logs/addons"

View File

@ -230,8 +230,8 @@ function _sort_netif() {
local ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list local ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
for ETH in ${ETHX}; do for ETH in ${ETHX}; do
local MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')" local MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g; s/.*/\L&/')"
local ETHBUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)" local BUS="$(ethtool -i ${ETH} 2>/dev/null | grep bus-info | cut -d' ' -f2)"
ETHLIST="${ETHLIST}${ETHBUS} ${MAC} ${ETH}\n" ETHLIST="${ETHLIST}${BUS} ${MAC} ${ETH}\n"
done done
local ETHLISTTMPM="" local ETHLISTTMPM=""
local ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)" local ETHLISTTMPB="$(echo -e "${ETHLIST}" | sort)"
@ -245,14 +245,16 @@ function _sort_netif() {
local ETHLIST="$(echo -e "${ETHLISTTMPM}${ETHLISTTMPB}" | grep -v '^$')" local ETHLIST="$(echo -e "${ETHLISTTMPM}${ETHLISTTMPB}" | grep -v '^$')"
local ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')" local ETHSEQ="$(echo -e "${ETHLIST}" | awk '{print $3}' | sed 's/eth//g')"
local ETHNUM="$(echo -e "${ETHLIST}" | wc -l)" local ETHNUM="$(echo -e "${ETHLIST}" | wc -l)"
# echo "${ETHSEQ}"
# sort # sort
if [ ! "${ETHSEQ}" == "$(seq 0 $((${ETHNUM:0} - 1)))" ]; then if [ ! "${ETHSEQ}" = "$(seq 0 $((${ETHNUM:0} - 1)))" ]; then
/etc/init.d/S41dhcpcd stop >/dev/null 2>&1 /etc/init.d/S41dhcpcd stop >/dev/null 2>&1
/etc/init.d/S40network stop >/dev/null 2>&1 /etc/init.d/S40network stop >/dev/null 2>&1
for i in $(seq 0 $((${ETHNUM:0} - 1))); do for i in $(seq 0 $((${ETHNUM:0} - 1))); do
ip link set dev eth${i} name tmp${i} ip link set dev eth${i} name tmp${i}
done done
local I=0 I=0
for i in ${ETHSEQ}; do for i in ${ETHSEQ}; do
ip link set dev tmp${i} name eth${I} ip link set dev tmp${i} name eth${I}
I=$((${I} + 1)) I=$((${I} + 1))