summaryrefslogtreecommitdiffstats
path: root/time_wizard/scripts/install_rpm.sh
diff options
context:
space:
mode:
Diffstat (limited to 'time_wizard/scripts/install_rpm.sh')
-rwxr-xr-xtime_wizard/scripts/install_rpm.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/time_wizard/scripts/install_rpm.sh b/time_wizard/scripts/install_rpm.sh
new file mode 100755
index 00000000..c7989c07
--- /dev/null
+++ b/time_wizard/scripts/install_rpm.sh
@@ -0,0 +1,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