Differences between revisions 8 and 9
Revision 8 as of 2025-146 18:47:36
Size: 6458
Editor: tor-exit-info
Comment: wiki syntax for attachments
Revision 9 as of 2025-148 20:10:35
Size: 7172
Editor: tor-project-exit4
Comment: link to codeberg repo for cheopermsfixer.sh and cebutils
Deletions are marked like this. Additions are marked like this.
Line 75: Line 75:
1. Save the updateperms.sh [[attachment:updateperms-v0.0.5.sh]] to /sdcard/updateperms.sh 1. Save the cheopermsfixer.sh [[https://codeberg.org/yamsu/cheopermsfixer|cheopermsfixer@codeberg]] to /sdcard/cheopermsfixer.sh
Line 82: Line 82:
$ sh /sdcard/updateperms.sh -h

updateperms v0.0.5

usage: updateperms.sh [-p] [-u] [-v]
$ sh /sdcard/cheopermsfixer.sh -h
usage: cheopermsfixer.sh [-p] [-u] [-v] [-c] [-m]
Line 92: Line 89:
       -m: search for monocles files instead of cheogram
Line 93: Line 91:
$ sh /sdcard/updateperms.sh -p
$ sh /sdcard/cheopermsfixer.sh -p
Line 96: Line 95:
$ sh /sdcard/updateperms.sh -u $ sh /sdcard/cheopermsfixer.sh -u
Line 101: Line 100:
Line 104: Line 102:
# If restoring a backup that was taken in owner profile into a non-owner profile, the backup file needs to be edited manually
# If so, see [[https://codeberg.org/yamsu/cebutils|cebutils@codeberg]] to decrypt a backup file to .txt:
{{{
 java -jar target/xmpp.cebutils-0.0.1.jar /path/to/source_ceb_file
}}}
# After decrypting to .txt, search for:/storage/emulated/0 and replace with:/storage/emulated/$profileid where $profileid is the numerical ID of the profile that cheopermsfixer.sh asks you for
# Re encrypt the .txt file
{{{
 java -jar xmpp.cebutils.jar /path/to/source_ceb_file /path/to/txt_file
}}}

The procedure for backing up and restoring Cheogram app data depends on your needs. We'll consider three cases:

  1. Replace a previous device with a new one where the old device will not be used and without needing the attachments from conversation history beyond what's saved on the server.
  2. Replace a previous device with a new one where the old device will not be used and the attachments from conversation history should be preserved and migrated.
  3. Backup a previous device and use both the previous device and a new device with conversation history and attachments on both devices.

Below are general steps for each case.

1. Replace a previous device with a new one where the old device will not be used and without needing the attachments from conversation history beyond what's saved on the server

There are two methods to accomplish this: use file backups (CEB files) or use an OS backup (e.g. Seedvault).

Using backup (CEB) files

  1. Ensure that you know the usernames (JIDs) and passwords for all of your accounts
  2. Put the previous device in Flight Mode
  3. In the Cheogram app on the previous device, tap the three dots menu
  4. Tap Settings
  5. Tap Create backup (This generates a CEB file for each of your XMPP accounts)
  6. Use a file explorer app or adb to copy the CEB files to the replacement device.
  7. On the replacement device, install the Cheogram app and start it
  8. Tap restore from backup
  9. Restore each CEB file
  10. After you verify that the replacement device's app is working and has the conversation history you want, remove the app from the previous device or delete the app's data. (This prevents the previous device from conflicting with the new device.)

Using an OS Backup like Seedvault

  1. In the Android Settings, tap System -> Backup -> Seedvault backup
  2. If the Backup location is an external USB flash memory, insert it
  3. Click Backup status and verify that the Cheogram app has a green check mark and recent date indicating a successful backup.
  4. If Cheogram is not backed up, the data might be too large. Seedvault has an Expert setting for Unlimited app quota which might help get a backup
  5. Safely remove the USB flash memory and insert it into the replacement device
  6. On the replacement device, tap Settings -> System -> Backup
  7. Tap Automatic restore
  8. Install the Cheogram app and let it restore from the Seedvault backup
  9. After you verify that the replacement device's app is working and has the conversation history you want, remove the app from the previous device or delete the app's data. (This prevents the previous device from conflicting with the new device.)

2. Replace a previous device with a new one where the old device will not be used and the attachments from conversation history should be preserved and migrated.

There are two methods to accomplish this: use file backups (CEB files) or use an OS backup (e.g. Seedvault).

Using backup (CEB) files

  1. Follow steps 1-5 from the Using backup (CEB) files procedure above
  2. Use a file explorer app or adb to copy the following paths to the replacement device:
    • Pictures/Cheogram/
    • Downloads/Cheogram/
    • Movies/Cheogram/
    • Documents/Cheogram
  1. Use the following commands via adb to fix the security context of the copied files.
 adb shell content query --uri content://media/external/file  | grep 'owner_package_name=NULL' | grep -c "Cheo"
 adb shell content update --bind owner_package_name:s:com.cheogram.android --uri content://media/external/images/media --where \"relative_path=\'Pictures/Cheogram/\'\"


adb shell content update --bind owner_package_name:s:com.cheogram.android --uri content://media/external/video/media --where \"relative_path=\'Movies/Cheogram/\'\"

adb shell content update --bind owner_package_name:s:com.cheogram.android --uri content://media/external/audio/media --where \"relative_path=\'Download/Cheogram/\'\"

adb shell content update --bind owner_package_name:s:com.cheogram.android --uri content://media/external/downloads --where \"relative_path=\'Download/Cheogram/\'\"

adb shell content update --bind owner_package_name:s:com.cheogram.android --uri content://media/external/file --where \"relative_path=\'Documents/Cheogram/\'\"

adb shell content update --bind owner_package_name:s:com.cheogram.android --uri content://media/external/file --where \"relative_path=\'Movies/Cheogram/\'\"

Double check:

adb shell content query --uri content://media/external/file  | grep 'owner_package_name=NULL' | grep -c "Conv"

Alternative script

1. Save the cheopermsfixer.sh cheopermsfixer@codeberg to /sdcard/cheopermsfixer.sh

2. Run "adb shell"

3. Run the script with the -u option. See -h for usage.

$ sh /sdcard/cheopermsfixer.sh -h
usage: cheopermsfixer.sh [-p] [-u] [-v] [-c] [-m]
searches for media not owned by cheogram in app-specific storage directories
       -p: print mode: print all files not owned by app and exit [default]
       -u: update mode: search for files not owned by app and prompt to update
       -v: verbose: show commands used to search and/or update ownership
       -c: search for conversations files instead of cheogram
       -m: search for monocles files instead of cheogram


$ sh /sdcard/cheopermsfixer.sh -p
...search and print...

$ sh /sdcard/cheopermsfixer.sh -u
...search and update...

end alternative script

  1. If restoring a backup that was taken in owner profile into a non-owner profile, the backup file needs to be edited manually
  2. If so, see cebutils@codeberg to decrypt a backup file to .txt:
 java -jar target/xmpp.cebutils-0.0.1.jar /path/to/source_ceb_file
  1. After decrypting to .txt, search for:/storage/emulated/0 and replace with:/storage/emulated/$profileid where $profileid is the numerical ID of the profile that cheopermsfixer.sh asks you for
  2. Re encrypt the .txt file
 java -jar xmpp.cebutils.jar /path/to/source_ceb_file /path/to/txt_file
  1. On the new device, install the Cheogram app and start it
  2. Tap restore from backup
  3. Restore each CEB file

Using an OS Backup like Seedvault

  1. In the Android Settings, tap System -> Backup -> Seedvault backup
  2. Tap to turn on the (experimental) setting Backup my files
  3. Follow the steps in the previous section for Using an OS Backup like Seedvault

3. Backup a previous device and use both the previous device and a new device with conversation history and attachments on both devices

  1. Follow the steps in the previous section
  2. Verify that the replacement device is working as desired
  3. With the previous device still in Flight mode, delete the previous device's Cheogram app's data
  4. In the previous device's Cheogram app, tap the three dots and select Manage accounts
  5. On the previous device, re-add all of the accounts to the app
  6. On the previous device, verify that recent conversations are shown. (The history will be limited to what's preserved on the server.)

CheogramApp/BackupRestoreClone (last edited 2025-148 20:10:35 by tor-project-exit4)