diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-29 12:10:06 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-29 12:10:06 +0000 |
commit | 5a996d9c69fea807e2ac54b422378ffc8ae0cc09 (patch) | |
tree | 235486bf16bcac5ecb70f3452d87e3a846377aee /time_wizard | |
parent | 36a0689eb82eb9a0c31b554abccbc7c63481c220 (diff) | |
download | drakwizard-5a996d9c69fea807e2ac54b422378ffc8ae0cc09.tar drakwizard-5a996d9c69fea807e2ac54b422378ffc8ae0cc09.tar.gz drakwizard-5a996d9c69fea807e2ac54b422378ffc8ae0cc09.tar.bz2 drakwizard-5a996d9c69fea807e2ac54b422378ffc8ae0cc09.tar.xz drakwizard-5a996d9c69fea807e2ac54b422378ffc8ae0cc09.zip |
changed some __WIZ_HOME__ prefix
Diffstat (limited to 'time_wizard')
-rwxr-xr-x | time_wizard/scripts/compute_liste.sh | 36 | ||||
-rwxr-xr-x | time_wizard/scripts/test_timeservers.sh | 105 |
2 files changed, 141 insertions, 0 deletions
diff --git a/time_wizard/scripts/compute_liste.sh b/time_wizard/scripts/compute_liste.sh new file mode 100755 index 00000000..287808fb --- /dev/null +++ b/time_wizard/scripts/compute_liste.sh @@ -0,0 +1,36 @@ +#!/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 + +# script for wizard time configuration +# +# echo on stdout liste & description (same) of timezone + +# zoneinfo directory probably exists, but +[ -d /usr/share/zoneinfo ] || exit 1 + +echo_debug "timezone list" + +cd /usr/share/zoneinfo && find [A-Z]* -type f | sort + diff --git a/time_wizard/scripts/test_timeservers.sh b/time_wizard/scripts/test_timeservers.sh new file mode 100755 index 00000000..1e5ce41a --- /dev/null +++ b/time_wizard/scripts/test_timeservers.sh @@ -0,0 +1,105 @@ +#!/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 perform a test of the time servers whose names +# can be found into the variables +# - $server1 +# - $typedserver1 +# - $server2 +# - $typesserver2 +# The typed variables have precedence over the fixed, if they are not empty. +# This test (ntpdate...) have a fixed timeout. +# If the test succeeds, it calls the script save_config.sh and then outputs 'ciao' +# else, it outputs 'server_not_responding' + +echo_debug "$(date)= begin $0" + +tout=30 +typeset -i i + +if [ -n "${typedserver1}" ]; then + tserver1=${typedserver1} +else + tserver1=${server1} +fi + +if [ -n "${typedserver2}" ]; then + tserver2=${typedserver2} +else + tserver2=${server2} +fi + +echo_debug "tserver1=${tserver1} tserver2=${tserver2}" + +if [ -x /usr/sbin/ntpdate ] && [ -n "${tserver1}" -o -n "${tserver2}" ]; then + echo_debug "launching /usr/sbin/ntpdate -q ${tserver1} ${tserver2}" + TMPFILE=`mktemp -q /tmp/tmwiz.XXXXXX` + if [ $? -ne 0 ];then + echo_debug "$0 cant create tmpfile, exit 1" + exit 1 + fi + + /usr/sbin/ntpdate -q ${tserver1} ${tserver2} > ${TMPFILE} 2>&1 & + + pid=$! + echo_debug "pid du process : ${pid}" + i=0 + ok=0 + while [ $ok -eq 0 ]; do + if [ `ps h ${pid} | wc -l` -eq 1 ]; then + i=i+1 + echo_debug "still running $i" + if [ $i -ge ${tout} ]; then + kill ${pid} >/dev/null 2>&1 + echo_debug "killing process" + echo_debug "server_not_responding" + exit 1 + else + sleep 1 + fi + else + echo_debug "ok end loop" + ok=1 + fi + done +# time server found? + + if [ `grep -c "no servers can be used" ${TMPFILE}` -ne 0 ];then + echo_debug "bad server" + echo_debug "$(cat ${TMPFILE})" + else + echo_debug "launching ${CWD}/scripts/save_config.sh" + __WIZ_HOME__/time_wizard/scripts/save_config.sh + echo_debug "exiting saying ciao" + rm -f ${TMPFILE} + exit 2 + fi +fi + +# some problem : +rm -f ${TMPFILE} +echo_debug "server_not_responding" +exit 1 + |