Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37568485
en ru br
ALT Linux repositórios
S:4.8.1-alt1
5.0: 2.1-alt2
4.1: 0.8-alt3.M41.6
4.0: 0.3-alt1.M40.3

Group :: Sistema/Configurações/Rede
RPM: alterator-datetime

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

alterator-datetime-0.8/000075500000000000000000000000001114006535400151455ustar00rootroot00000000000000alterator-datetime-0.8/Makefile000064400000000000000000000003061114006535400166040ustar00rootroot00000000000000NAME=datetime

all:
clean:
install: install-module install-data

include /usr/share/alterator/build/module.mak

install-data:
install -d $(datadir)/install2
cp -a preinstall.d $(datadir)/install2
alterator-datetime-0.8/applications/000075500000000000000000000000001114006535400176335ustar00rootroot00000000000000alterator-datetime-0.8/applications/datetime.desktop000064400000000000000000000002651114006535400230250ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-System
Icon=datetime
Terminal=false
Name=Date/Time
X-Alterator-URI=/datetime
X-Alterator-Weight=20
X-Alterator-Help=datetime
alterator-datetime-0.8/backend3/000075500000000000000000000000001114006535400166175ustar00rootroot00000000000000alterator-datetime-0.8/backend3/datetime000075500000000000000000000035011114006535400203400ustar00rootroot00000000000000#!/bin/sh

alterator_api_version=1
ntpd_file=/etc/ntpd.conf
datadir=/usr/share/alterator-datetime/
default_pool_file="$datadir/pools"

rdelim='[[:space:]]\+'
wdelim=' '

. alterator-sh-functions
. shell-config

read_pool()
{
shell_config_get "$ntpd_file" "servers" "$rdelim"|head -n1
}

write_pool()
{
shell_config_del "$ntpd_file" "server" "$rdelim"
shell_config_del "$ntpd_file" "servers" "$rdelim"
shell_config_set "$ntpd_file" "servers" "$1" "$rdelim" "$wdelim"
}

read_runlevel()
{
sed -nr '/:initdefault:$/ {s,^id:([^:]+):.*,\1,;p}' /etc/inittab
}

on_message()
{
case "$in_action" in
type)
write_type_item ntp_pool hostname
write_type_item date date
write_type_item time time
;;
read)
#date&time
write_string_param 'date' "$(date +%F)"
write_string_param 'time' "$(date +%T)"

#ntp
write_string_param ntp_pool "$(read_pool)"

! [ "$(/usr/sbin/control ntpd)" = "server" ]
write_bool_param ntp_accept "$?"

local runlevel="$(read_runlevel)"
! LANG=C /sbin/chkconfig --list ntpd 2>/dev/null|fgrep -qsw "$runlevel:on"
write_bool_param ntp_status "$?"
;;
write)
#date&time
if [ -n "$in_date" -a -n "$in_time" ] &&
! date --set="$in_date $in_time" 2>/dev/null >/dev/null; then
write_error "`_ "unable to setup time"`"
return
fi

#ntp
[ -z "$in_ntp_pool" ] || write_pool "$in_ntp_pool"

if test_bool "$in_ntp_accept";then
/usr/sbin/control ntpd server >/dev/null 2>/dev/null
else
/usr/sbin/control ntpd client >/dev/null 2>/dev/null
fi

if test_bool "$in_ntp_status"; then
/sbin/chkconfig ntpd on
/sbin/service ntpd start >/dev/null 2>/dev/null
else
/sbin/chkconfig ntpd off
/sbin/service ntpd condstop >/dev/null 2>/dev/null
fi

/sbin/service clock sync >/dev/null 2>/dev/null
;;
esac
}

message_loop
alterator-datetime-0.8/help/000075500000000000000000000000001114006535400160755ustar00rootroot00000000000000alterator-datetime-0.8/help/ru_RU/000075500000000000000000000000001114006535400171315ustar00rootroot00000000000000alterator-datetime-0.8/help/ru_RU/datetime.html000064400000000000000000000057051114006535400216220ustar00rootroot00000000000000<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Дата и время</title>
</head>
<body>
<h2>Дата и время</h2>

<p>Системное время в Linux зависит от следующих факторов:</p>

<ul>
<li><strong>Часы в BIOS</strong> &mdash; часы, встроенные в компьютер; они
работают, даже если он выключен.</li>
<li><strong>Системное время</strong> &mdash; часы в ядре операционной
системы. Во время работы системы все процессы пользуются именно этими
часами.</li>
<li><strong>Часовые пояса</strong> &mdash; регионы Земли, в каждом из
которых принято единое местное время.</li>
</ul>

<p>При запуске системы происходит активация системных часов и их
синхронизация с аппаратными, кроме того, в определённых случаях учитывается
значение часового пояса. При завершении работы системы происходит обратный
процесс.</p>

<p>Аппаратные часы компьютера не идеальны, минимум раз в год придётся их
&laquo;подводить&raquo;. Но если у вас есть доступ к серверу точного
времени, то рекомендуется им воспользоваться. Для этого достаточно отметить
пункт &laquo;Получать точное время с NTP-сервера&raquo; и указать имя
сервера.</p>

<p>В большинстве случаев вас устроит сервер pool.ntp.org. Tсть аналогичные
серверы для целых регионов, например:</p>

<ul>
<li>ru.pool.ntp.org &mdash; для России</li>
<li>ua.pool.ntp.org &mdash; для Украины</li>
</ul>

<p>За более подробной информацией обращайтесь на сайт
<a href="http://www.pool.ntp.org/">http://www.pool.ntp.org/</a>.</p>

<p>Если синхронизация времени с NTP-сервером настроена, то ваш компьютер
сможет сам работать как сервер точного времени. Для этого достаточно
отметить соответствующий пункт &laquo;Работать как NTP-сервер&raquo;.</p>

</body>
</html>
alterator-datetime-0.8/preinstall.d/000075500000000000000000000000001114006535400175445ustar00rootroot00000000000000alterator-datetime-0.8/preinstall.d/20-datetime.sh000075500000000000000000000020311114006535400221120ustar00rootroot00000000000000#!/bin/sh -efu
# ***** BEGIN LICENSE BLOCK *****
# * Copyright (C) 2007 Alexey Gladkov <legion@altlinux.org>
# *
# * 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.
# *
# * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# ***** END LICENSE BLOCK *****

. install2-init-functions

[ ! -f /etc/ntpd.conf ] ||
cp -af /etc/ntpd.conf "$destdir/etc/"

! chkconfig --list ntpd |grep -qs '[0-9]:on' || run_chroot chkconfig ntpd on || :
alterator-datetime-0.8/templates/000075500000000000000000000000001114006535400171435ustar00rootroot00000000000000alterator-datetime-0.8/templates/datetime/000075500000000000000000000000001114006535400207375ustar00rootroot00000000000000alterator-datetime-0.8/templates/datetime/index.html000064400000000000000000000027721114006535400227440ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!-- date/time module -->
<html wf="form">
<head>
<script>
effectDisable("ntp_pool","ntp_status", false);
effectDisable("ntp_accept","ntp_status", false);
effectDisable("date","ntp_status", true);
effectDisable("time","ntp_status", true);
</script>
</head>
<body>
<form method="POST">
<table>
<tr>
<td colspan="2">
<input type="checkbox" name="ntp_status"/>
<span name="ntp_status" translate="_">Get time from NTP server:</span>
<span name="ntp_pool" style="display:none" translate="_">NTP server:</span>
<input type="text" class="text" name="ntp_pool"/>
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="ntp_accept"/>
<span name="ntp_accept" translate="_">Work as NTP server</span>
</td>
</tr>
<tr>
<td colspan="2"><hr/></td>
</tr>
<tr>
<td align="center"><span translate="_" name="date">Current date:</span></td>
<td align="center"><span translate="_" name="time">Current time:</span></td>
</tr>
<tr>
<td align="center" valign="bottom">
<div class="alterator-dateedit" name="date"/>
</td>
<td align="center" valign="bottom">
<div class="alterator-timeedit" name="time"/>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>
<input type="submit" value="Apply" class="btn"/>
<input type="reset" value="Reset" class="btn"/>
</td>
</tr>
</table>
</form>
</body>
</html>
alterator-datetime-0.8/ui/000075500000000000000000000000001114006535400155625ustar00rootroot00000000000000alterator-datetime-0.8/ui/datetime/000075500000000000000000000000001114006535400173565ustar00rootroot00000000000000alterator-datetime-0.8/ui/datetime/index.scm000064400000000000000000000041211114006535400211670ustar00rootroot00000000000000(document:surround "/std/frame")

(define (update-datetime data)
(date-set value (woo-get-option data 'date))
(time-set value (woo-get-option data 'time)))

(define (write-datetime)
(woo-catch/message
(thunk
(woo-write "/datetime"
'date (date-set value)
'time (time-set value)
'ntp_status (ntp-status value)
'ntp_accept (ntp-accept value)
'ntp_pool (ntp-pool value))
(update-datetime (woo-read-first "/datetime")))))

(gridbox columns "50;50"
margin 20
(gridbox
columns "50;50"
colspan 2
align "left"
(document:id ntp-status (checkbox text (_ "Get time from NTP server:") name "ntp_status"))
(hbox (label name "ntp_pool" text (_ "NTP server:") visibility #f)
(document:id ntp-pool (edit name "ntp_pool"))))

(document:id ntp-accept (checkbox text (_ "Work as NTP server") widget-name "ntp_accept" name "ntp_accept"))
(spacer)

(separator colspan 2)

(label text (_ "Current date:") align "center" name "date")
(label text (_ "Current time:") align "center" name "time")

(document:id date-set (dateedit expanded #t name "date"))
(document:id time-set (timeedit expanded #t name "time"))

(label colspan 2)

(if (global 'frame:next-button)
(spacer)
(document:id apply-button
(button text (_ "Apply") align "left"
(when clicked (write-datetime)))))
(spacer))

(frame:on-next (thunk (or (write-datetime) 'cancel)))
(frame:on-back (thunk (or (write-datetime) 'cancel)))

(effect-disable "ntp_pool" "ntp_status" #f)
(effect-disable "ntp_accept" "ntp_status" #f)
(effect-disable "date" "ntp_status" #t)
(effect-disable "time" "ntp_status" #t)

(document:root
(when loaded
(let ((data (woo-read-first "/datetime")))
(ntp-status value (woo-get-option data 'ntp_status))
(ntp-pool value (woo-get-option data 'ntp_pool))
(ntp-accept value (woo-get-option data 'ntp_accept))
(update-datetime data)
(init-effect))))
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009