From f3fb31acfa056c5d240058a6d8b71c7823f316fa Mon Sep 17 00:00:00 2001 From: iamromulan <50184035+iamromulan@users.noreply.github.com> Date: Sat, 5 Oct 2024 04:44:19 -0400 Subject: [PATCH] Update test_status_update.sh --- .../sdxpinn-mount-fix/test_status_update.sh | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/ipk-source/sdxpinn-mount-fix/test_status_update.sh b/ipk-source/sdxpinn-mount-fix/test_status_update.sh index b6416e1..e1b5b8e 100644 --- a/ipk-source/sdxpinn-mount-fix/test_status_update.sh +++ b/ipk-source/sdxpinn-mount-fix/test_status_update.sh @@ -2,7 +2,7 @@ # Function to update the status file with a properly formatted entry add_to_status_file() { - local package_name="$1" + local bundled_package_name="$1" local version="$2" local depends="$3" local arch="$4" @@ -11,16 +11,25 @@ add_to_status_file() { # Status file location local status_file="/usr/lib/opkg/status" - # Check if the package already exists and remove the old entry - if grep -q "Package: $package_name" "$status_file"; then - echo "Removing old entry for $package_name" - sed -i "/Package: $package_name/,/^$/d" "$status_file" + # Debugging: Output the details of the package being added + echo "Adding package: $bundled_package_name" + echo "Version: $version" + echo "Depends: $depends" + echo "Architecture: $arch" + echo "Installed-Time: $installed_time" + + # Check if the package already exists in the status file + if grep -q "Package: $bundled_package_name" "$status_file"; then + echo "Removing old entry for $bundled_package_name from $status_file" + sed -i "/Package: $bundled_package_name/,/^$/d" "$status_file" + else + echo "No existing entry for $bundled_package_name found. Adding new entry." fi - # Append the new formatted entry - echo "Adding new entry for $package_name to $status_file" + # Append the new formatted entry to the status file + echo "Appending new entry for $bundled_package_name to $status_file" cat << EOF >> "$status_file" -Package: $package_name +Package: $bundled_package_name Version: $version Depends: $depends Status: install user installed @@ -28,10 +37,21 @@ Architecture: $arch Installed-Time: $installed_time EOF + + # Verification: Check if the package was added correctly + if grep -q "Package: $bundled_package_name" "$status_file"; then + echo "Successfully added $bundled_package_name to $status_file." + else + echo "Failed to add $bundled_package_name to $status_file." + fi } # Example usage: adding `libinotifytools` and `inotifywait` with dummy values add_to_status_file "libinotifytools" "3.20.11.0-1" "libc" "aarch64_cortex-a53" "315965672" add_to_status_file "inotifywait" "3.20.11.0-1" "libc, libinotifytools" "aarch64_cortex-a53" "315965672" -echo "Status file updated!" +# Output the entire status file for review +echo "Current status file:" +cat /usr/lib/opkg/status + +echo "Status file update completed."