blob: 09368f0560d28556a106825bf5866fe117d0f6d0 [file] [log] [blame]
Dhruvaraj Subhashchandrand1589522024-06-04 00:38:48 -05001#!/bin/bash
2
3# Check if the interface parameter is provided
4if [ -z "$1" ]; then
5 echo "Usage: $0 <interface>"
6 echo "Example: $0 xyz.openbmc_project.Dump.Entry.BMC"
7 exit 1
8fi
9
10INTERFACE=$1
11
12# Run the busctl command with verbose output and capture the output
13output=$(busctl --verbose call xyz.openbmc_project.Dump.Manager \
14 /xyz/openbmc_project/dump \
15 org.freedesktop.DBus.ObjectManager \
16 GetManagedObjects)
17
18# Parse the output and print object paths containing the specified interface
19declare -A seen_paths
20
21echo "$output" | awk -v interface="$INTERFACE" '
22 /OBJECT_PATH/ {
23 path = $2;
24 gsub(/;/, "", path);
25 gsub(/"/, "", path);
26 }
27 $0 ~ interface {
28 print path;
29 }
30' | while read -r path; do
31 if [ -z "${seen_paths[$path]}" ]; then
32 echo "Deleting: $path"
33 busctl call xyz.openbmc_project.Dump.Manager "${path}" \
34 xyz.openbmc_project.Object.Delete Delete
35 seen_paths["$path"]=1
36 fi
37done