summaryrefslogtreecommitdiffstats
path: root/time_wizard/scripts/install_rpm.sh
blob: c7989c0778777a39470cfd2f7c138f9009cb613b (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
#!/bin/bash
# 
# Wizard
#
# Copyright (C) 2000 Mandrakesoft.
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# See file LICENSE for further informations on licensing terms.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# 
# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi
# icons: Helene Durosini <ln@mandrakesoft.com>
# <corporate@mandrakesoft.com> http://www.mandrakesoft.com

# This script installs the "NTP utils" (URPMI or KDE package)
# This will be eventually made more generic to create a 
# RPM installer script.
# it outputs "choose_server" if OK, "not_installed" otherwise

echo_debug () {
([ -n "${DEBUG_WIZ}" ] && echo $1 >> ${DEBUG_WIZ})||:
}


echo_debug "$(date) begin $0"

rpmname="ntp"
rpm=`which rpm`
urpmi=`which urpmi`

# quit if package already installed

if [ `$rpm --quiet -q ${rpmname} 2>/dev/null` ];then
   echo_debug "package ${rpmname} already installed, saying choose_server"
   exit 1
fi

# try to install the $rpmname package by some way

if [ -x "$urpmi" ]; then
	echo_debug "found urpmi, installing ${rpmname}"
	$urpmi --X --auto ${rpmname} >/dev/stderr 2>&1
else
	echo_debug "urpmi not found. can't install ${rpmname}"
   	exit 1
#elif [ -d /mnt/cdrom/Mandrake/RPMS ]; then
#    echo_debug "found ${rpmname} on local cdrom, installing using rpm"
#    rpmfile=`find /mnt/cdrom/Mandrake/RPMS -name "${rpmname}-*.rpm"`
#    rpm -U --quiet ${rpmfile} >/dev/stderr 2>&1
fi

# test if all is ok (and provide exit code)
echo_debug "exiting, testing: $($rpm --quiet -q ${rpmname} 2>/dev/null)"

if [ `$rpm --quiet -q ${rpmname} 2>/dev/null` ]; then
     exit 1
else    
#    if [ -x /usr/X11R6/bin/rpmdrake ]; then
#        # should display some help here
#        echo_debug "launching rpmdrake as last choice"
#        /usr/X11R6/bin/rpmdrake > /dev/null 2>&1 &
#    fi
    exit 2
fi