summarylogtreecommitdiffstats
path: root/deadsync.install
blob: a2d80aee68eb604f9c987108f7b720ce10501dd0 (plain)
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
post_install() {
    echo "DeadSync has been installed to /opt/deadsync."
    echo "Run 'deadsync' from a terminal or launch it from your application menu."
    echo
    echo "Game data and configuration can be found in \$XDG_DATA_HOME/deadsync after first launch"
}

post_upgrade() {
    local _breaking_ver="0.3.826"

    if [ $(vercmp "$2" "$_breaking_ver") -lt 0 ]; then
        local _old_dir="$HOME/.deadsync"
        local _xdg_base="${XDG_DATA_HOME:-$HOME/.local/share}"
        local _new_dir="$_xdg_base/deadsync"
  
        if [ -d "$_old_dir" ] && [ ! -d "$_new_dir" ]; then
            echo ">>> Deadsync version 0.3.826+ uses XDG_DATA_HOME."
            echo ">>> Migrating data: $_old_dir -> $_new_dir"
            mkdir -p "$_xdg_base"
            mv "$_old_dir" "$_new_dir"
        elif [ -d "$_old_dir" ] && [ -d "$_new_dir" ]; then
            echo ">>> WARNING: Both $_old_dir and $_new_dir exist."
            echo ">>> Automatic migration skipped to prevent data loss."
            echo ">>> Please manually merge your data into $_new_dir"
        fi
    fi
    
    post_install
}