sdxpinn-patch fixes

This commit is contained in:
Cameron Thompson
2025-01-21 00:21:22 -05:00
parent 4f99c66cec
commit 0f9fbfa2ab
2 changed files with 9 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
#!/bin/ash
opkg update
echo "Complete"
exit 0

View File

@@ -64,14 +64,17 @@ src/gz openwrt_telephony https://downloads.openwrt.org/releases/22.03.5/packages
# Process the file line by line
while IFS= read -r line || [ -n "$line" ]; do
# Remove malformed lines
if [ -z "$line" ] || ! echo "$line" | grep -qE '^src/gz '; then
# Trim leading/trailing spaces from the line
trimmed_line=$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
# Skip empty lines
if [ -z "$trimmed_line" ]; then
continue
fi
# Check if the line should be commented out
for item in $items_to_comment; do
if [ "$line" = "$item" ] || [ "$line" = "# $item" ]; then
if [ "$trimmed_line" = "$item" ] || [ "$trimmed_line" = "# $item" ]; then
echo "# $item" >> "$TEMP_FILE"
continue 2
fi
@@ -79,14 +82,14 @@ src/gz openwrt_telephony https://downloads.openwrt.org/releases/22.03.5/packages
# Check if the line should be uncommented
for item in $items_to_keep; do
if [ "$line" = "# $item" ] || [ "$line" = "$item" ]; then
if [ "$trimmed_line" = "# $item" ] || [ "$trimmed_line" = "$item" ]; then
echo "$item" >> "$TEMP_FILE"
continue 2
fi
done
# Preserve other lines as is
echo "$line" >> "$TEMP_FILE"
echo "$trimmed_line" >> "$TEMP_FILE"
done < "$INPUT_FILE"
# Ensure all items_to_keep are present and uncommented