This repository has been archived by the owner on Jun 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
migrate_to_ls
executable file
·61 lines (51 loc) · 1.56 KB
/
migrate_to_ls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
#
# Migrate well-know config locations from rpufky to ls digikam config.
#
USAGE="
Migrate well-known config locations from rpufky to ls digikam config.
Assumes a base ls/digikam config location has been run once. This is
non-destructive for the source config.
See https://github.com/r-pufky/digikam/blob/master/migration.md for full
migration instructions.
Usage: $0 [OPTIONS]
Options:
-s [DIR] Source config mount (rpufky/digikam config mount). Use trailing
slash. Required.
-d [DIR] Dest config mount (ls/digikam config mount). Use trailing slash.
Required.
Examples:
$0 -s /data/rp/config/ -d /data/ls/config/
"
while getopts "s:d:h" options; do
case "${options}" in
s)
SOURCE=${OPTARG%%/}
;;
d)
DEST=${OPTARG%%/}
;;
h)
echo "${USAGE}"
exit 1
;;
:)
echo "${USAGE}"
exit 1
;;
esac
done
if [ -z ${SOURCE} ] || [ -z ${DEST} ]; then
echo 'Error: source and destination config locations required.'
exit 2
fi
# Migrate user settings.
cp -av "${DEST}/.config/digikamrc" "${DEST}/.config/digikamrc.orig"
cp -av "${SOURCE}/xdg/config/digikamrc" "${DEST}/.config/digikamrc"
chown --reference="${DEST}/.config/digikamrc.orig" "${DEST}/.config/digikamrc"
chmod --reference="${DEST}/.config/digikamrc.orig" "${DEST}/.config/digikamrc"
# Migrate DBs.
find "${DEST}" -type f -name "*.db" -exec mv -v {} {}.orig \;
cp -av "${SOURCE}"/*.db "${DEST}"
chown --reference="${DEST}/digikam4.db.orig" "${DEST}/"*.db
chmod --reference="${DEST}/digikam4.db.orig" "${DEST}/"*.db