fix sdxpinn-patch
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
clean_distfeeds() {
|
clean_distfeeds() {
|
||||||
# Define the list of items to comment out
|
# Define the list of items to comment out
|
||||||
items_to_comment="
|
items_to_comment=$(cat <<EOF
|
||||||
src/gz openwrt_core https://downloads.openwrt.org/releases/22.03.5/targets/sdx75/generic/packages
|
src/gz openwrt_core https://downloads.openwrt.org/releases/22.03.5/targets/sdx75/generic/packages
|
||||||
src/gz openwrt_qtiagm https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiagm
|
src/gz openwrt_qtiagm https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiagm
|
||||||
src/gz openwrt_qtiargs https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiargs
|
src/gz openwrt_qtiargs https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiargs
|
||||||
@@ -43,16 +43,18 @@ src/gz openwrt_qtissmgr https://downloads.openwrt.org/releases/22.03.5/packages/
|
|||||||
src/gz openwrt_qtissmgrprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtissmgrprop
|
src/gz openwrt_qtissmgrprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtissmgrprop
|
||||||
src/gz openwrt_qtiwlan https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiwlan
|
src/gz openwrt_qtiwlan https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiwlan
|
||||||
src/gz openwrt_qtiwlanprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiwlanprop
|
src/gz openwrt_qtiwlanprop https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/qtiwlanprop
|
||||||
"
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
# Define the list of items to ensure are uncommented
|
# Define the list of items to ensure are uncommented
|
||||||
items_to_keep="
|
items_to_keep=$(cat <<EOF
|
||||||
src/gz openwrt_base https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/base
|
src/gz openwrt_base https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/base
|
||||||
src/gz openwrt_luci https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/luci
|
src/gz openwrt_luci https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/luci
|
||||||
src/gz openwrt_packages https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/packages
|
src/gz openwrt_packages https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/packages
|
||||||
src/gz openwrt_routing https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/routing
|
src/gz openwrt_routing https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/routing
|
||||||
src/gz openwrt_telephony https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/telephony/
|
src/gz openwrt_telephony https://downloads.openwrt.org/releases/22.03.5/packages/aarch64_cortex-a53/telephony/
|
||||||
"
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
# Input file to process
|
# Input file to process
|
||||||
INPUT_FILE="/etc/opkg/distfeeds.conf"
|
INPUT_FILE="/etc/opkg/distfeeds.conf"
|
||||||
@@ -64,35 +66,32 @@ src/gz openwrt_telephony https://downloads.openwrt.org/releases/22.03.5/packages
|
|||||||
|
|
||||||
# Process the file line by line
|
# Process the file line by line
|
||||||
while IFS= read -r line || [ -n "$line" ]; do
|
while IFS= read -r line || [ -n "$line" ]; do
|
||||||
# Trim leading/trailing spaces from the line
|
# Remove malformed or empty lines
|
||||||
trimmed_line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
if [ -z "$line" ] || ! echo "$line" | grep -qE '^src/gz '; then
|
||||||
|
|
||||||
# Skip empty lines
|
|
||||||
if [ -z "$trimmed_line" ]; then
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the line should be commented out
|
# Check if the line matches items to comment out
|
||||||
for item in $items_to_comment; do
|
for item in $items_to_comment; do
|
||||||
if [ "$trimmed_line" = "$item" ] || [ "$trimmed_line" = "# $item" ]; then
|
if [ "$line" = "$item" ] || [ "$line" = "# $item" ]; then
|
||||||
echo "# $item" >> "$TEMP_FILE"
|
echo "# $item" >> "$TEMP_FILE"
|
||||||
continue 2
|
continue 2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if the line should be uncommented
|
# Check if the line matches items to keep
|
||||||
for item in $items_to_keep; do
|
for item in $items_to_keep; do
|
||||||
if [ "$trimmed_line" = "# $item" ] || [ "$trimmed_line" = "$item" ]; then
|
if [ "$line" = "$item" ] || [ "$line" = "# $item" ]; then
|
||||||
echo "$item" >> "$TEMP_FILE"
|
echo "$item" >> "$TEMP_FILE"
|
||||||
continue 2
|
continue 2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Preserve other lines as is
|
# Preserve all other lines
|
||||||
echo "$trimmed_line" >> "$TEMP_FILE"
|
echo "$line" >> "$TEMP_FILE"
|
||||||
done < "$INPUT_FILE"
|
done < "$INPUT_FILE"
|
||||||
|
|
||||||
# Ensure all items_to_keep are present and uncommented
|
# Ensure all items_to_keep are present
|
||||||
for item in $items_to_keep; do
|
for item in $items_to_keep; do
|
||||||
if ! grep -qx "$item" "$TEMP_FILE"; then
|
if ! grep -qx "$item" "$TEMP_FILE"; then
|
||||||
echo "$item" >> "$TEMP_FILE"
|
echo "$item" >> "$TEMP_FILE"
|
||||||
|
|||||||
Reference in New Issue
Block a user