summaryrefslogtreecommitdiff
path: root/nautilus-installer/src/prescript
blob: a9c0c53d737ece6c5200e911f35efedaa09258e9 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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
PR3_TO_10=no
if test -f /usr/bin/nautilus; then
    VERSION=`/usr/bin/nautilus --version`
    if [ "x$VERSION" = "xGnome nautilus 0.1.0" ]; then
        PR3_TO_10=yes
    fi
fi

# Is the glibc bad...
RH70BADGLIBC=no
RHSTRING=`cat /etc/redhat-release`
if [ "x$RHSTRING" = "xRed Hat Linux release 7.0 (Guinness)" ]; then
        rpm -q glibc | grep -q "2.2"
	if [ $? != 0 ]; then
		RH70BADGLIBC=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 1.0"
    echo ""
    if test "x$PR3_TO_10" = "xyes"; then
        echo "Your PR3 setttings will be moved to ~/.nautilus.pr3.backup..."
        echo ""
    fi
fi

if test $UID -ne 0 -a "x$QUICK" '!=' "xyes"; then
    # Must we upgrade glibc ?

    if test "x$RH70BADGLIBC" = "xyes" -a "x`echo x$* | grep glibc`" = "x" ; then
        echo ""
        echo "The Nautilus installer requires a newer version of glibc before Nautilus"
        echo "can be installed.  RedHat 7.0 shipped with an experimental glibc version,"
        echo "but an update is available.  We can install the update for you."
        echo ""
        echo "The installer will not contain verbose instructions during this process, so"
        echo "please bear with us.  This is a safe upgrade and will be done with an official"
        echo "RedHat update package."
        echo ""
        echo "You could cut and paste the below command to upgrade your glibc version:"
        echo ""
        echo "    sh $0 $* --package=glibc"
        echo ""
        echo "After this succeeds, you should run the installer again, and Nautilus will"
        echo "be installed."
        echo ""
        #exit 1
    fi

    echo "To use the Eazel installer, you need superuser (root) access to your system."
    echo "If you are prompted for your root password, please enter it to log in as the"
    echo "superuser.  The root password is used only on your local machine, and is not"
    echo "transmitted to Eazel or any other party."
    echo ""

    # Start
    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$PR3_TO_10" = "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.pr3.backup >& /dev/null
            mv -f $HOME/.nautilus $HOME/.nautilus.pr3.backup/ >& /dev/null
            mv -f $HOME/Nautilus $HOME/.nautilus.pr3.backup/ >& /dev/null
            mv -f $HOME/.gconf/apps/nautilus/ $HOME/.nautilus.pr3.backup/ >& /dev/null
            mv -f $HOME/.gconf/apps/eazel-trilobite/ $HOME/.nautilus.pr3.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
        # note that the --user option has to be of the '=' variety because of
        # a bug in popt. (if any of the user args use the '=' form, a final
        # non-'=' ['--user arg'] option silently corrupts argv.)
	/bin/sh -c "$params && $export && cd $PWD && /bin/sh $0 $* --user=$USER"
	exit
    fi
fi