summaryrefslogtreecommitdiff
path: root/nautilus-installer/src/prescript
blob: e1a2708fb069f282647826874f423ff9e57f7fdb (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
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
62
63
64
65
66
67
68
69
70
if test x$DISPLAY = x; then
    echo "Eazel Installer requires X to be running."
    exit
fi
export="export DISPLAY botan_rice_candy"
params="DISPLAY=$DISPLAY && botan_rice_candy=yum"

# Check proxy settings
if test x$http_proxy '!=' x; then
    export="$export http_proxy"
    params="$params && http_proxy=$http_proxy"
fi

# Figure out what is already installed
PR1_TO_PR2=no
if test -f /usr/bin/nautilus; then
    VERSION=`/usr/bin/nautilus --version`
    if [ "x$VERSION" = "xGnome nautilus 0.1.0" ]; then
        PR1_TO_PR2=yes
    fi
fi

if test "x$1" = "x--version" -o "x$1" = "x--build" -o "x$1" = "x--help"; then
    QUICK=yes
fi

# First time through?  spam...
if test "x$botan_rice_candy" = "x" -a "x$QUICK" '!=' "xyes"; then
    # blurp 
    echo ""
    echo "Eazel Installer PR2"
    echo ""
    if test "x$PR1_TO_PR2" = "xyes"; then
        echo "Your PR1 setttings will be moved to ~/.nautilus.pr2.backup..."
        echo ""
    fi
fi

if test $UID -ne 0 -a "x$QUICK" '!=' "xyes"; then
    echo "Eazel Installer requires superuser (root) access to prepare the system"
    echo "and to install packages."
    echo ""

    # Start
    echo "Please enter root password at the prompt."
    xhost + localhost
    /bin/su -s /bin/sh -c "$params && $export && cd $PWD && echo Uncompressing... && /bin/sh $0 $* --user $USER"
    xhost - localhost

    # FIXME: this will only work if they didn't run as root.
    # Move config
    if test "x$PR1_TO_PR2" = "xyes"; then
        VERSION=`/usr/bin/nautilus --version`
        if test "x$VERSION" != "xGNOME nautilus 0.1.0"; then
            echo "Saving old settings..."
            mkdir -p $HOME/.nautilus.pr2.backup >& /dev/null
            mv -f $HOME/.nautilus $HOME/.nautilus.pr2.backup/ >& /dev/null
            mv -f $HOME/Nautilus $HOME/.nautilus.pr2.backup/ >& /dev/null
            mv -f $HOME/.gconf/apps/nautilus/ $HOME/.nautilus.pr2.backup/ >& /dev/null
            mv -f $HOME/.gconf/apps/eazel-trilobite/ $HOME/.nautilus.pr2.backup/ >& /dev/null
        fi
    fi
    exit
else
    if test "x$botan_rice_candy" = "x"; then
        # running as root, or has "--{version|build|help}" command-line option
	/bin/sh -c "$params && $export && cd $PWD && /bin/sh $0 $* --user $USER"
	exit
    fi
fi