]> git.pld-linux.org Git - packages/opera.git/blob - opera.sh
rel 1
[packages/opera.git] / opera.sh
1 #!/bin/sh
2
3 migrate_profiledir() {
4         # restore location of opera dir for new opera to do automatic profile migration
5         # we used to setup OPERA_PERSONALDIR to use XDG config path
6         # but seems there's no way to tell new opera where to take old profile for
7         # migration than it's hardcoded $HOME/.opera
8         # so we move stuff back there before launching opera
9
10         DOT_DIR="$HOME/.opera"
11         XDG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/opera"
12
13         # skip if already migrated
14         if [ -e $XDG_DIR/Preferences ]; then
15                 return
16         fi
17
18         OPERA_PERSONALDIR=$DOT_DIR
19         if [ ! -d "$OPERA_PERSONALDIR/operaprefs.ini" ]; then
20                 OPERA_PERSONALDIR=$XDG_DIR
21         fi
22
23         if [ "$OPERA_PERSONALDIR" = "$DOT_DIR" ]; then
24                 # already there
25                 return
26         fi
27
28         # if ~/.opera contains just OperaAutoupdateChecker.sqlite, remove it
29         rm -f $DOT_DIR/OperaAutoupdateChecker.sqlite
30         test -d "$DOT_DIR" && rmdir --ignore-fail-on-non-empty $DOT_DIR
31
32         # neither dir exists, nothing to do
33         if [ ! -d "$DOT_DIR" ] && [ ! -d $XDG_DIR ]; then
34                 return
35         fi
36
37         # if no dir, just move
38         if [ ! -d "$DOT_DIR" ]; then
39                 mv $XDG_DIR $DOT_DIR
40                 return
41         fi
42
43         # may attempt to figure which dir is newer and then rename
44 }
45
46 migrate_profiledir
47
48 exec /usr/lib/opera/opera "$@"
This page took 0.054397 seconds and 3 git commands to generate.