From 1aca8c892f0b8c076b5a8322b26aafa0418959b4 Mon Sep 17 00:00:00 2001 From: iamromulan <50184035+iamromulan@users.noreply.github.com> Date: Sat, 5 Oct 2024 04:32:12 -0400 Subject: [PATCH] Create test_status_update.sh For diagnosing why we can't write to the status file --- .../sdxpinn-mount-fix/test_status_update.sh | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 ipk-source/sdxpinn-mount-fix/test_status_update.sh diff --git a/ipk-source/sdxpinn-mount-fix/test_status_update.sh b/ipk-source/sdxpinn-mount-fix/test_status_update.sh new file mode 100644 index 0000000..7e775f1 --- /dev/null +++ b/ipk-source/sdxpinn-mount-fix/test_status_update.sh @@ -0,0 +1,49 @@ +#!/bin/ash + +# Define the path to the status file +STATUS_FILE="/usr/lib/opkg/status" + +# Define the control files for bundled packages +CONTROL_FILES="/usr/lib/opkg/info/libinotifytools.control /usr/lib/opkg/info/inotifywait.control" + +# Function to update the status file for a given control file +update_status_file() { + local control_file="$1" + local bundled_package_name=$(basename "$control_file" .control) + + if [ ! -f "$control_file" ]; then + echo "Error: Control file not found for $bundled_package_name at $control_file" + return 1 + fi + + # Append a newline and then add the control file contents to the status file + echo "" >> "$STATUS_FILE" + echo "Adding entry for $bundled_package_name to $STATUS_FILE" + + { + # Read the control file contents + cat "$control_file" + + # Add a 'Status' line indicating the package is 'user installed' + echo "Status: install user installed" + + # Add the architecture (modify this as per your system's architecture if needed) + echo "Architecture: aarch64_cortex-a53" + + # Timestamp for when the package was installed + echo "Installed-Time: $(date +%s)" + } >> "$STATUS_FILE" + + echo "Successfully added $bundled_package_name to $STATUS_FILE" +} + +# Iterate through each control file and update the status file +for control_file in $CONTROL_FILES; do + update_status_file "$control_file" +done + +# Output the status file content for verification +echo "Contents of $STATUS_FILE:" +grep -A 5 -E "Package: (libinotifytools|inotifywait)" "$STATUS_FILE" + +exit 0