Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37715013
en ru br
Репозитории ALT
S:0.2.2-alt1.1.1
5.1: 0.2-alt1
www.altlinux.org/Changes

Группа :: Система/Настройка/Прочее
Пакет: alterator-updates

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

alterator-updates-0.2/000075500000000000000000000000001215312431600150075ustar00rootroot00000000000000alterator-updates-0.2/Makefile000064400000000000000000000001411215312431600164430ustar00rootroot00000000000000NAME=updates

all:
clean:
install: install-module

include /usr/share/alterator/build/module.mak
alterator-updates-0.2/applications/000075500000000000000000000000001215312431600174755ustar00rootroot00000000000000alterator-updates-0.2/applications/updates.desktop000064400000000000000000000003151215312431600225340ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-System
Terminal=false
Name=System update
Icon=updates
X-Alterator-URI=/updates
X-Alterator-Help=updates
Name[ru]=п·п╠п╫п╬п╡п╩п╣п╫п╦п╣ я│п╦я│я┌п╣п╪я▀
alterator-updates-0.2/backend3/000075500000000000000000000000001215312431600164615ustar00rootroot00000000000000alterator-updates-0.2/backend3/updates000075500000000000000000000135031215312431600200560ustar00rootroot00000000000000#!/bin/sh

alterator_api_version=1

. alterator-sh-functions
. shell-config
. shell-regexp

url_re='^\(ftp://\|http://\|rsync://\|file:/\)[a-zA-Z0-9._/:@-]\+$'

repo_dir=/etc/apt/repositories/

compatlist_file=/etc/apt/repositories/.compatlist
updates_file=/etc/sisyphus-updates/sisyphus-updates.conf
repolist_file=
schedule_file=/etc/cron.d/alterator-updates
updates_cmd="/usr/sbin/sisyphus-updates >/var/log/sisyphus-updates.log 2>&1"

exit_handler()
{
local rc=$?
trap - EXIT

rm -f "$repolist_file"
exit $rc
}

trap exit_handler EXIT HUP INT QUIT TERM

repolist_file="$(mktemp -t alterator-updates.XXXXXX)"
grep -v '\(^[[:space:]]*#\|^[[:space:]]*$\)' "$compatlist_file" >"$repolist_file"

validate_mirror()
{
local m_repolist=";$1;"

while read repo;do
[ "$m_repolist" = ";;" -o -z "${m_repolist##*;$repo;*}" ] && return 0
done<"$repolist_file"
return 1
}

print_mirror()
{
local id= repolist= name= comment=
local IFS=' '
while read id repolist name comment; do
id="${id##*/}"
id="${id%%.desktop}"
if [ "$repolist" = "all" ] || validate_mirror "$repolist"; then
write_enum_item "$id" "$name ($comment)"
fi
done
}

list_mirror()
{
find /etc/apt/mirrors -name '*.desktop'|
xargs alterator-dump-desktop \
-v lang="$in_language" \
-v 'out=Filename;X-Repositories;Name;Comment' \
-v 'def=nofile;all;noname;'|
print_mirror
write_enum_item "custom" "`_ "Custom url"`"
}

list_weekday()
{
write_enum_item "1" "`_ "monday"`"
write_enum_item "2" "`_ "tuesday"`"
write_enum_item "3" "`_ "wednesday"`"
write_enum_item "4" "`_ "thursday"`"
write_enum_item "5" "`_ "friday"`"
write_enum_item "6" "`_ "saturday"`"
write_enum_item "0" "`_ "sunday"`"
}

list_repo()
{
local m_file="/etc/apt/mirrors/$1.desktop"
local m_repolist=";;"

[ "$1" = "custom" ] ||
m_repolist=";$(shell_config_get "$m_file" X-Repositories);"

sed "s/.*/$(quote_sed_regexp "$repo_dir")\/&.desktop/" "$repolist_file"|
xargs alterator-dump-desktop \
-v lang="$in_language" \
-v out='Filename;Name' \
-v def='noname;'|
while read name label; do
name="${name##*/}"
name="${name%%.desktop}"

[ "$m_repolist" = ";;" -o -z "${m_repolist##*;$name;*}" ] || continue
write_enum_item "$name" "$label"
done
}

read_schedule()
{
if [ -s "$schedule_file" ] ;then
while read min hour monthday month weekday rest;do
[ -n "${min%\#*}" ] || continue

write_string_param "time" "$hour:$min:00"
if [ "$monthday" = "*" -a "$month" = "*" -a "$weekday" = "*" ]; then
write_string_param "period" "daily"
elif [ "$monthday" = "*" -a "$month" = "*" -a "$weekday" != "*" ];then
write_string_param "period" "weekly"
write_string_param "weekday" "$weekday"
elif [ "$monthday" != "*" -a "$month" = "*" -a "$weekday" = "*" ]; then
write_string_param "period" "monthly"
write_string_param "monthday" "$monthday"
else
write_string_param "period" "daily"
fi
return
done <"$schedule_file"
else
write_string_param "time" "02:00:00"
write_string_param "period" "daily"
fi
}

write_schedule()
{
[ "$in_mode" != "none" ] || return

if [ "$in_period" = "weekly" -a -z "$in_weekday" ]; then
write_error "`_ "Day of week should be selected"`"
return
fi

if [ "$in_period" = "monthly" -a -z "$in_monthday" ];then
write_error "`_ "Day of month should be defined"`"
return
fi

in_time="${in_time%:*}"
local hour="${in_time%:*}"
local min="${in_time#*:}"

local new_schedule_file="$(mktemp "$schedule_file.XXXXXXXXXX")"
if [ -z "$new_schedule_file" ]; then
write_error "`_ "Unable to create temp file"`"
return
fi

printf "#autogenerated by alterator-updates\n" >"$new_schedule_file"
case "$in_period" in
daily)
printf '%s %s * * * root %s\n' "$min" "$hour" "$updates_cmd"
;;
weekly)
printf '%s %s * * %s root %s\n' "$min" "$hour" "$in_weekday" "$updates_cmd"
;;
monthly)
printf '%s %s %s * * root %s\n' "$min" "$hour" "$in_monthday" "$updates_cmd"
;;
esac >>"$new_schedule_file"
mv -f "$new_schedule_file" "$schedule_file"
}


on_message() {
case "$in_action" in
type)
write_type_item time time
write_type_item monthday updates-day
;;
read)
local mode="$(shell_config_get "$updates_file" mode)"
local mirror="$(shell_config_get "$updates_file" mirror)"
local custom_url="$(shell_config_get "$updates_file" custom_url)"
local repolist="$(shell_config_get "$updates_file" repolist|tr ' ' ';')"

repolist="${repolist#\"}"
repolist="${repolist%\"}"
[ -n "$mode" ] || mode="none"
[ -n "$mirror" ] || mirror="alt"

write_string_param mode "$mode"
write_string_param mirror "$mirror"
write_string_param custom_url "$custom_url"
write_string_param repolist "$repolist"

read_schedule
;;
write)
if [ "$in_mode" = "internet" -a -z "$in_repolist" ] ;then
write_error "`_ "You should define a minimum one repository"`"
return
fi

if [ "$in_mode" = "internet" -a "$in_mirror" = "custom" ] ;then
if [ -z "$in_custom_url" ]; then
write_error "`_ "You should define custom url"`"
return
elif echo "$in_custom_url"|grep -qvs "$url_re"; then
write_error "`_ "Invalid or unsupported protocol. Should be http://, ftp://, rsync:// or file:"`"
return
else
shell_config_set "$updates_file" custom_url "$in_custom_url"
fi
fi

[ -z "$in_mode" ] ||
shell_config_set "$updates_file" mode "$in_mode"
[ -z "$in_mirror" ] ||
shell_config_set "$updates_file" mirror "$in_mirror"
[ -z "$in_repolist" ] ||
shell_config_set "$updates_file" repolist "\"$(echo "$in_repolist"|tr ';' ' ')\""

write_schedule
;;
list)
case "$in__objects" in
avail_mirror) list_mirror;;
avail_weekday) list_weekday;;
avail_repo) list_repo "$in_mirror";;
esac
;;
esac
}

message_loop
alterator-updates-0.2/type/000075500000000000000000000000001215312431600157705ustar00rootroot00000000000000alterator-updates-0.2/type/updates-day.scm000064400000000000000000000005651215312431600207220ustar00rootroot00000000000000(define-module (type updates-day)
:use-module (alterator woo)
:export (type))

(define (valid-range? v)
(and (number? v) (< 0 v 32)))

(define (type v _)
(or (and (string? v) (string-null? v))
(and (string? v) (valid-range? (string->number v)))
(and (number? v) (valid-range? v))
(type-error (_ "Invalid day of month" "alterator-updates"))))

alterator-updates-0.2/ui/000075500000000000000000000000001215312431600154245ustar00rootroot00000000000000alterator-updates-0.2/ui/updates/000075500000000000000000000000001215312431600170715ustar00rootroot00000000000000alterator-updates-0.2/ui/updates/ajax.scm000064400000000000000000000035301215312431600205210ustar00rootroot00000000000000(define-module (ui updates ajax)
:use-module (alterator woo)
:use-module (alterator ajax)
:export (on-load))

(define (update-mirror)
(let ((mirror (form-value "mirror")))
(form-update-visibility '("custom_url") (string=? mirror "custom"))
(form-update-enum "repolist" (woo-list "/updates/avail_repo" 'mirror mirror 'language (form-value "language")))))

(define (update-mode)
(let ((is-internet (string=? (or (form-value "mode") "") "internet"))
(not-none (not (string=? (or (form-value "mode") "") "none"))))
(form-update-activity '("mirror" "custom_url")
is-internet)
(form-update-activity '("repolist" "schedule" "period" "weekday" "monthday" "time")
not-none)
(and not-none (update-period))))

(define (update-period)
(let ((period (or (form-value "period") "")))
(form-update-activity '("monthday") (string=? period "monthly"))
(form-update-activity '("weekday") (string=? period "weekly"))))

(define (ui-commit)
(catch/message
(lambda()
(apply woo-write
"/updates"
'language (form-value "language")
(form-value-list)))))

(define (ui-init)
(let ((data (woo-read-first "/updates" 'language (form-value "language"))))
(form-update-enum "mirror" (woo-list "/updates/avail_mirror" 'language (form-value "language")))
(form-update-enum "weekday" (woo-list "/updates/avail_weekday" 'language (form-value "language")))
(form-update-value-list '("mode" "mirror" "custom_url" "period" "weekday" "monthday" "time") data)
(update-period)
(update-mirror)
(update-mode)
(form-update-value-list '("repolist") data)))

(define (on-load)
(ui-init)
(form-bind "mirror" "change" update-mirror)
(form-bind "mode" "change" update-mode)
(form-bind "period" "change" update-period)
(form-bind "apply" "click" ui-commit)
(form-bind "reset" "click" ui-init))
alterator-updates-0.2/ui/updates/index.html000064400000000000000000000051411215312431600210670ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html wf="none">
<body>
<form method="POST">
<table>
<tr>
<td colspan="2">
<input type="radio" name="mode" value="none"/>
<span translate="_">Don't update system</span>
</td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="mode" value="local"/>
<span translate="_">System update managed by server</span>
</td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="mode" value="internet"/>
<span translate="_">Update system automatically from Internet</span>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>
<span name="mirror" translate="_">Source:</span>
</td>
<td>
<select name="mirror"/>
<br/>
<input type="text" class="text" name="custom_url" style="width:98%"/>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td valign="top">
<span name="repolist" translate="_">Repositories:</span>
</td>
<td>
<table name="repolist" class="alterator-checklistbox" style="width:98%"/>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><strong><span translate="_">Update schedule</span></strong></td>
</tr>
<tr>
<td colspan="2">
<table>
<tr>
<td>
<input type="radio" name="period" value="daily"/>
<span name="period" translate="_">Every day</span>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<input type="radio" name="period" value="weekly"/>
<span name="period" translate="_">Every week at:</span>
&nbsp;
</td>
<td>
<select name="weekday"/>
</td>
</tr>
<tr>
<td>
<input type="radio" name="period" value="monthly"/>
<span name="period" translate="_">Every month at day:</span>
&nbsp;
</td>
<td>
<span translate="_" style="display:none" name="monthday">Day of month:</span>
<input type="text" class="text" name="monthday" size="2"/>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2">
<span translate="_" name="time">Time:</span>
&nbsp;
<input type="text" class="text" size="8" name="time"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<input type="button" class="btn" name="apply" value="Apply"/>
<input type="button" class="btn" name="reset" value="Reset"/>
</td>
</tr>
</table>
</form>
</body>
</html>
alterator-updates-0.2/ui/updates/index.scm000064400000000000000000000027121215312431600207060ustar00rootroot00000000000000(document:surround "/std/frame")

(define stop (make-attribute 'stop))

(gridbox
margin 30
columns "0;100"
(radio name "mode" value "none" colspan 2 text (_ "Don't update system"))
(radio name "mode" value "local" colspan 2 text (_ "System update managed by server"))
(radio name "mode" value "internet" colspan 2 text (_ "Update system automatically from Internet"))

(label colspan 2)

(label name "mirror" text (_ "Source:"))
(combobox name "mirror")

(spacer)
(edit name "custom_url" visibility #t)

(label colspan 2)

(label name "repolist" text (_ "Repositories:") align "top")
(checklistbox name "repolist")

(label colspan 2)

(label colspan 2 align "left" text (bold (_ "Update schedule")) name "schedule")
(hbox
colspan 2
spacing 100
;;align "left"
(gridbox
columns "0;100"
(radio name "period" value "daily" text (_ "Every day"))
(spacer)

(document:id bna (radio name "period" value "weekly" text (_ "Every week at:")))
(combobox name "weekday" align "left")

(radio name "period" value "monthly" text (_ "Every month at day:"))
(spinbox align "left" minimum 1 maximum 31 step 1 name "monthday")

(label colspan 2)

(hbox colspan 2
align "left"
(label (_ "Time:") name "time")
(timeedit name "time" stop #t))))

(label colspan 2)

(hbox
align "left"
(button name "apply" text (_ "Apply"))
(button name "reset" text (_ "Reset"))))
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin