rdlist-transform/rdlist_strip.sh

21 lines
754 B
Bash
Raw Normal View History

2023-08-13 15:05:54 -04:00
#!/bin/bash
# Prompt user for rdlist location
echo "Enter the path to rdlist:"
read RDLIST
# Check and create blank JSON files
echo "{}" > "$RDLIST/dist/known_rooms.json"
echo "{}" > "$RDLIST/dist/memberships.json"
# Blank out the values of "room_id" in $RDLIST/dist/summaries.json
if [ -f "$RDLIST/dist/summaries.json" ]; then
jq -c 'map(if .room? and .room.room_id then .room.room_id = "" else . end)' "$RDLIST/dist/summaries.json" > "$RDLIST/dist/summaries.json.tmp"
mv "$RDLIST/dist/summaries.json.tmp" "$RDLIST/dist/summaries.json"
echo "Processed $RDLIST/dist/summaries.json and blanked room_id values."
else
echo "$RDLIST/dist/summaries.json not found!"
fi
echo "Script completed. The room_ids have been stripped from rdlist."