aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/migration
diff options
context:
space:
mode:
authorLibravatar Evan <71018479+Evan-aja@users.noreply.github.com>2022-05-05 00:26:25 +0700
committerLibravatar GitHub <noreply@github.com>2022-05-04 12:26:25 -0500
commiteb42729b5aa3da6b425a3ccfe581fa9dcc7fa46e (patch)
tree1b1a09b99330d0f5256809e28323962974cf894c /scripts/migration
parent6.0.0-nightly.25 [skip ci] (diff)
downloadferdium-app-eb42729b5aa3da6b425a3ccfe581fa9dcc7fa46e.tar.gz
ferdium-app-eb42729b5aa3da6b425a3ccfe581fa9dcc7fa46e.tar.zst
ferdium-app-eb42729b5aa3da6b425a3ccfe581fa9dcc7fa46e.zip
Migration script from Ferdi to Ferdium for Linux & MacOS (#91) [skip ci]
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'scripts/migration')
-rwxr-xr-xscripts/migration/migrate-unix.sh70
1 files changed, 70 insertions, 0 deletions
diff --git a/scripts/migration/migrate-unix.sh b/scripts/migration/migrate-unix.sh
new file mode 100755
index 000000000..529716d85
--- /dev/null
+++ b/scripts/migration/migrate-unix.sh
@@ -0,0 +1,70 @@
1#!/bin/bash
2
3set -e
4
5echo "********************************************"
6echo " Ferdium User Data Migration Tool "
7echo " WARNING: UNIX OS Only! "
8echo "********************************************"
9echo "This tool migrates your user data from Ferdi to Ferdium."
10echo "Intended to be used on Linux or MacOS machine."
11read -p "Do you want to proceed? (y/N) " confirm
12
13case "$confirm" in
14 y|Y|[yY][eE][sS] ) echo "Starting...";;
15 n|N|[nN][oO] ) exit 1;;
16 * ) exit 1;;
17esac
18
19os_check=$(uname)
20
21if [ $os_check == "Linux" ]; then
22 echo "Your OS is: Linux"
23 BASE_PATH="$HOME/.config"
24elif [ $os_check == "Darwin" ]; then
25 echo "Your OS is: MacOS"
26 BASE_PATH="$HOME/Library/Application Support"
27else
28 echo "Your OS is not supported by this script"
29 exit 1
30fi
31
32FERDI_PATH="$BASE_PATH/Ferdi"
33FERDIUM_PATH="$BASE_PATH/Ferdium2"
34
35if [ -d "$FERDIUM_PATH" ]; then
36 echo "Path $FERDIUM_PATH exist, making a backup"
37 if ! mv -vf "$FERDIUM_PATH" "$FERDIUM_PATH.bak" 2> /dev/null ; then
38 read -p "A previous backup already exists at $FERDIUM_PATH.bak. do you want to remove it? (y/N) " confirm
39 echo
40 case "$confirm" in
41 y|Y|[yY][eE][sS] ) echo "Deleting...";;
42 n|N|[nN][oO] ) exit 1;;
43 * ) exit 1;;
44 esac
45 echo
46 rm -rf "$FERDIUM_PATH.bak"
47 mv -vf "$FERDIUM_PATH" "$FERDIUM_PATH.bak"
48 fi
49fi
50
51if mv -vf "$FERDI_PATH" "$FERDIUM_PATH"; then
52 echo "Files exported succesfully"
53else
54 echo "ERROR!"
55 echo "No user data was found to be exported. Exiting..."
56 exit 1
57fi
58
59if [ -f "$FERDIUM_PATH/server.sqlite" ]; then
60 echo "********************************************"
61 echo " Success! "
62 echo "********************************************"
63else
64 echo "********************************************"
65 echo "WARNING: Your data was partially migrated!"
66 echo "It was detected that your account is using Ferdi servers to sync your data."
67 echo "Please, check this guide on how to export and import your data manually:"
68 echo "https://github.com/ferdium/ferdi/blob/main/MIGRATION.md"
69 echo "********************************************"
70fi