diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-29 12:29:41 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-29 12:29:41 +0000 |
commit | ae36b036f949dbde8c8433f191a318fb38d82444 (patch) | |
tree | 9f5ab05c874a47f5a7bf19fccd9159427658c058 | |
parent | 5a996d9c69fea807e2ac54b422378ffc8ae0cc09 (diff) | |
download | drakwizard-ae36b036f949dbde8c8433f191a318fb38d82444.tar drakwizard-ae36b036f949dbde8c8433f191a318fb38d82444.tar.gz drakwizard-ae36b036f949dbde8c8433f191a318fb38d82444.tar.bz2 drakwizard-ae36b036f949dbde8c8433f191a318fb38d82444.tar.xz drakwizard-ae36b036f949dbde8c8433f191a318fb38d82444.zip |
first revision
-rwxr-xr-x | time_wizard/scripts/handle_local_internet.sh | 65 | ||||
-rwxr-xr-x | time_wizard/scripts/handle_no_network.sh | 49 | ||||
-rwxr-xr-x | time_wizard/scripts/install_rpm.sh | 75 | ||||
-rwxr-xr-x | time_wizard/scripts/save_config.sh | 91 | ||||
-rwxr-xr-x | time_wizard/scripts/test_tools.sh | 39 |
5 files changed, 319 insertions, 0 deletions
diff --git a/time_wizard/scripts/handle_local_internet.sh b/time_wizard/scripts/handle_local_internet.sh new file mode 100755 index 00000000..3fe4528f --- /dev/null +++ b/time_wizard/scripts/handle_local_internet.sh @@ -0,0 +1,65 @@ +#!/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 use the value of the variable $chooser1 (== 'local' or 'internet') +#as follows: +# +#if $chooser1 == 'local', +#- call the standard time setting tool and then output the string "ciao" +# +#if $chooser1 == 'internet', +# test the existence of the network. +# if it exists, call the script test_tools.sh +# else output 'page3' + +# (if chooser1 is different from 'local' and 'internet', return an error code) + + + +echo_debug "$(date) begin $0, loading /etc/sysconfig/network" + +. /etc/sysconfig/network + +echo_debug "chooser1=${chooser1}" + +[ -n "${chooser1}" ] || exit 1 + +echo_debug "NETWORKING=${NETWORKING} chooser1=${chooser1} timetool=${timetool}" + +case "${chooser1}" in +local) + exit 1 + ;; +internet) + echo_debug "NETWORKING=${NETWORKING}" + [ ${NETWORKING} = "no" ] && exit 2 + echo_debug "launching test_tools.sh" + exec /usr/share/wizards/time_wizard/scripts/test_tools.sh + ;; +*) + echo_debug "a bug ?" + exit -1 +esac + diff --git a/time_wizard/scripts/handle_no_network.sh b/time_wizard/scripts/handle_no_network.sh new file mode 100755 index 00000000..848e3f96 --- /dev/null +++ b/time_wizard/scripts/handle_no_network.sh @@ -0,0 +1,49 @@ +#!/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 +# +# no network was found, than $chooser4 tell us to : +# - tryagain +# - save config without testing +# + + +echo_debug "$(date) begin $0, whith chooser4=${chooser4}" + +case "${chooser4}" in +tryagain) + echo_debug "server_not_responding" + exit 1 + ;; +savewithouttest) + echo_debug "exec ${CWD}/scripts/save_config.sh" + exec ${CWD}/scripts/save_config.sh + echo_debug "saying ciao" + exit 2 + ;; +*) + echo_debug "bug" + exit 1 + ;; +esac 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 diff --git a/time_wizard/scripts/save_config.sh b/time_wizard/scripts/save_config.sh new file mode 100755 index 00000000..a0bcebfa --- /dev/null +++ b/time_wizard/scripts/save_config.sh @@ -0,0 +1,91 @@ +#!/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 saves the xntp configuration. + +echo_debug "$(date) begin $0" + +# save time zone info +config=/etc/sysconfig/clock +bck_file ${config} + +echo -e "\ +UTC=true\n\ +ZONE=${wiz_timezone}\n\ +ARC=false\ +" > ${config} + +export TZ=${wiz_timezone} + +cp -f /usr/share/zoneinfo/${wiz_timezone} /etc/localtime + + + +if [ -n "${typedserver1}" ]; then + tserver1=${typedserver1} +else + tserver1=${server1} +fi + +if [ -n "${typedserver2}" ]; then + tserver2=${typedserver2} +else + tserver2=${server2} +fi + +# and set time ! + +echo_debug "tserver=${tserver1} tserver2=${tserver2}" + +[ -d /etc/ntp ] || exit 1 +echo_debug "/etc/ntp ok" + +bck_file /etc/ntp/step-tickers + +if [ -n "${tserver1}" ]; then + echo ${tserver1} > /etc/ntp/step-tickers +fi + +if [ -n "${tserver2}" ]; then + echo ${tserver2} >> /etc/ntp/step-tickers +fi + +echo_debug "$(date) wrote /etc/ntp/step-tickers, starting services" + +# now set time (if network ok) +if [ "$wiz_time_ok" = "ok" ]; then +/etc/rc.d/init.d/crond stop > /dev/null +/etc/rc.d/init.d/atd stop > /dev/null +/etc/rc.d/init.d/ntpd restart > /dev/null +/etc/rc.d/init.d/crond start > /dev/null +/etc/rc.d/init.d/atd start > /dev/null + +# set hw clock +[ -x /sbin/hwclock ] && hwclock --systohc --utc & + +fi + +echo_debug "$(date) service restart end, exiting from $0" + diff --git a/time_wizard/scripts/test_tools.sh b/time_wizard/scripts/test_tools.sh new file mode 100755 index 00000000..06f54c1f --- /dev/null +++ b/time_wizard/scripts/test_tools.sh @@ -0,0 +1,39 @@ +#!/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 + +#Test the existence of the tools NTP (test -f /var/bin/ntpdate, rpm -q ntp) +#-- if the test succeeds, output "choose_server", +#- else "no_tools" + +echo_debug "$(date) begin $0" + +if [ -x /usr/sbin/ntpdate ] ; then + echo_debug "exiting, choose_server" + exit 3 +else + echo_debug "exiting, no_tools" + exit 4 +fi + |