You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
1.3 KiB

#!/usr/bin/env bash
# Based on
# Check before
# upgrading a room and change as necessary (WARNING: deprecated, no replacement
# that includes versions after 7 at the time of writing)
# Note: $ is not a character that worlks without quotes due to signifying a
# variable
set -x
# Creating the new room pointing to old one
# Thanks to for the awk
NEWROOMID=$(curl -s -X POST -H "Authorization: Bearer $ACCESSTOKEN" -H "Content-Type: application/json" --data-binary "{\"name\":\"$NEWROOMNAME\",\"room_version\":\"$ROOMVERSION\",\"creation_content\":{\"predecessor\":{\"room_id\":\"$OLDROOMID\",\"event_id\":\"$LASTEVENTINOLDROOM\"}}}" https://$HOMESERVER/_matrix/client/r0/createRoom | awk -F\" '{ printf $4 }')
# Sending a tombstone
curl -s -X PUT -H "Authorization: Bearer $ACCESSTOKEN" -H "Content-Type: application/json" --data-binary "{\"replacement_room\":\"$NEWROOMID\"}" "https://$HOMESERVER/_matrix/client/r0/rooms/$OLDROOMID/state/"
set +x