Debian Codegraph @

debian/session-migrations/lomiri-push-service-rename-migration.sh

raw
1 #!/bin/sh -euf
2
3 # We migrate only levels.db. helpers/ and helpers_data.json can be re-created
4 # by the click hook (and will likely have to be, anyway, due to app rename).
5 old_path="${HOME}/.local/share/ubuntu-push-client/levels.db"
6 new_path="${HOME}/.local/share/lomiri-push-service/levels.db"
7
8 if [ -e "$new_path" ]; then
9 echo "${new_path} exists. Not migrating to avoid overwriting new information" >&2
10 exit 0
11 fi
12
13 if ! [ -e "$old_path" ]; then
14 echo "${old_path} doesn't exist. Nothing to migrate" >&2
15 exit 0
16 fi
17
18 # Don't remove the old path, in case migration goes wrong.
19 mkdir -p "$(dirname "$new_path")"
20 cp -a "$old_path" "$new_path"
21
22 echo "Migrated lomiri-push-service seen msg and level DB" >&2