aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xscripts/migration/migrate-unix.sh70
2 files changed, 71 insertions, 1 deletions
diff --git a/README.md b/README.md
index 2b2b7cc88..323217381 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,7 @@ Since we are waiting to acquire the Apple Developer License, we are publishing o
61 61
62## Migrating from Ferdi 62## Migrating from Ferdi
63 63
64If you are a pre-existing user of Ferdi, and are thinking of switching to Ferdium, you might want to run [the following script](./scripts/migration/migrate-windows.ps1) to migrate your existing Ferdi profile such that Ferdium can pick up the configurations. 64If you are a pre-existing user of Ferdi, and are thinking of switching to Ferdium, you might want to run [the following scripts](./scripts/migration) to migrate your existing Ferdi profile such that Ferdium can pick up the configurations. (.ps1 for PowerShell/Windows users and .sh for UNIX (Linux and MacOS users)
65 65
66## Contributing 66## Contributing
67 67
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