Debian Codegraph @

debian/session-migrations/luitk-config-migration.sh

raw
1 #!/bin/sh -euf
2 #
3 # Copyright (C) 2023 UBports Foundation
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; version 3.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # Authored by: Ratchanan Srirattanamet <[email protected]>
18
19 old_path="${HOME}/.config/ubuntu-ui-toolkit/theme.ini"
20 new_path="${HOME}/.config/lomiri-ui-toolkit/theme.ini"
21
22 if [ -e "$new_path" ]; then
23 echo "${new_path} exists. Users might have already configured new settings." \
24 "Don't migrate." >&2
25 exit 0
26 fi
27
28 if ! [ -e "$old_path" ]; then
29 echo "${old_path} doesn't exist. Nothing to do." >&2
30 exit 0
31 fi
32
33 mkdir -p "$(dirname "$new_path")"
34 # Special care has to be taken due to component name change.
35 sed -e 's/Ubuntu\.Components/Lomiri.Components/' "$old_path" >"$new_path"
36
37 echo "Lomiri UI toolkit config migrated." >&2