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

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

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

alterator-firsttime-0.4/000075500000000000000000000000001206137174400153615ustar00rootroot00000000000000alterator-firsttime-0.4/Makefile000064400000000000000000000004711206137174400170230ustar00rootroot00000000000000NAME=firsttime

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

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

install-data:
install -d $(libexecdir)/alterator/hooks/firsttime.d

install-units:
for f in systemd/system/*; do \
install -D -m0644 "$$f" "$(unitdir)/$$(basename "$$f")"; \
done
alterator-firsttime-0.4/ahttpd-firsttime.conf000064400000000000000000000005651206137174400215260ustar00rootroot00000000000000#main server settings
#format:parameter value

server-listen *
server-port 8080
server-user _ahttpd
server-group _ahttpd
server-pidfile /var/run/ahttpd-firsttime.pid
server-auth none

log-file /var/log/ahttpd/access-firsttime.log
log-mode errors

tls-key-file /var/lib/ssl/private/ahttpd.key
tls-cert-file /var/lib/ssl/certs/ahttpd.cert

framework-uri /firsttime/framework
alterator-firsttime-0.4/ahttpd-firsttime.init000075500000000000000000000032511206137174400215420ustar00rootroot00000000000000#!/bin/sh
#
# configd Start/Stop alterator specific httpd (firsttime mode)
#
# chkconfig: - 95 05
#
# processname: ahttpd
# config: /etc/httpd-alterator
# description: alterator specific httpd
# pidfile: /var/run/httpd-alterator/httpd.pid

WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

. cert-sh-functions
. avahi-sh-functions
. shell-config

CONFIGFILE=/etc/ahttpd/ahttpd-firsttime.conf
PIDFILE=/var/run/ahttpd-firsttime.pid
LOCKFILE=/var/lock/subsys/ahttpd-firsttime
CERTCONF=/etc/ahttpd/ahttpd.cnf
RETVAL=0

ahttpd_port()
{
shell_config_get "$CONFIGFILE" server-port '[[:space:]]\+'
}

start()
{
ssl_generate "ahttpd"

start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user _ahttpd --name ahttpd --displayname ahttpd -- ahttpd -c "$CONFIGFILE"
RETVAL=$?

[ "$RETVAL" != "0" ] || publish_service ahttpd 'Initial system setup at %h' '_https._tcp' "$(ahttpd_port)"

return $RETVAL
}

stop()
{
stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user _ahttpd --name ahttpd --displayname ahttpd -- ahttpd
RETVAL=$?

[ "$RETVAL" != "0" ] || unpublish_service ahttpd

return $RETVAL
}

restart()
{
stop
start
}


# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
condrestart|condreload)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
status)
status --lockfile "$LOCKFILE" --pidfile "$PIDFILE" --expect-user _ahttpd --name ahttpd --displayname ahttpd -- ahttpd
RETVAL=$?
;;
*)
msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
RETVAL=1
esac

exit $RETVAL
alterator-firsttime-0.4/backend3/000075500000000000000000000000001206137174400170335ustar00rootroot00000000000000alterator-firsttime-0.4/backend3/firsttime000075500000000000000000000003451206137174400207710ustar00rootroot00000000000000#!/bin/sh -f

alterator_api_version=1

. alterator-sh-functions

###

do_finish()
{
sleep 1
run-parts /usr/lib/alterator/hooks/firsttime.d
}


on_message()
{
case "$in_action" in
finish) do_finish & ;;
esac
}

message_loop
alterator-firsttime-0.4/interfaces/000075500000000000000000000000001206137174400175045ustar00rootroot00000000000000alterator-firsttime-0.4/interfaces/guile/000075500000000000000000000000001206137174400206115ustar00rootroot00000000000000alterator-firsttime-0.4/interfaces/guile/workflow/000075500000000000000000000000001206137174400224635ustar00rootroot00000000000000alterator-firsttime-0.4/interfaces/guile/workflow/firsttime-finish.scm000064400000000000000000000016241206137174400264560ustar00rootroot00000000000000(define-module (alterator workflow firsttime-finish)
:use-module (alterator algo)
:use-module (alterator ahttpd)
:use-module (alterator ajax)
:use-module (alterator http template)
:use-module (alterator http html)
:use-module (alterator woo)
:export (workflow))

(define (redirect-path msg)
(let ((data (woo-read-first "/ahttpd-server")))
(format #f "https://~A:~A"
(or (message-header msg "host") "localhost")
(woo-get-option data 'port "443"))))

(define (workflow url msg template-args)
(begin-1
(template (cond-assq 'scm template-args)
(replace-tag: "body"
(lambda (options content)
`(body ,@options
,(html: "script"
(format #f "$(document).ready(function() {form_replace_if_ready(~A,3);});"
(->json (redirect-path msg))))
,@content))))
(woo "finish" "/firsttime")))

alterator-firsttime-0.4/interfaces/guile/workflow/firsttime-framework.scm000064400000000000000000000037231206137174400271750ustar00rootroot00000000000000(define-module (alterator workflow firsttime-framework)
:use-module (srfi srfi-1)
:use-module (srfi srfi-13)

:use-module (alterator ahttpd)

:use-module (alterator algo)
:use-module (alterator woo)

:use-module (alterator http template)
:use-module (alterator http html)

:use-module (alterator ahttpd translate)
:use-module (alterator ahttpd html)
:use-module (alterator ahttpd workflow)
:export (workflow))

(define (scm-content scm name)
(call-with-current-continuation
(lambda(return)
(template
scm (tag: name (lambda (options content) (return content))))
'())))

(define (main-tag scm)
(and (pair? scm)
(tag: "div" (@ 'id "main") (scm-content scm "body"))))

(define (title? x)
(and (pair? x) (eq? (car x) 'title)))

(define (head-tag scm title)
(and (pair? scm)
(replace-tag: "head"
(lambda(options content)
(list 'head
(remove title? content)
(remove title? (scm-content scm "head"))
(html: "title" title))))))

(define (title-tag title)
(tag: "span" (@ 'id "title") title))

(define (apply-po-domain scm po-domain)
(if (string? po-domain)
(template scm
(replace-tag: "html" (lambda (options content)
`(html ,@options ,@content
,(@ 'po-domain po-domain)))))
scm))

;;; main
(define (workflow uri msg template-args)
(let* ((language (message-accept-language msg))
(init-data (woo-read-first "/menu" 'language language 'ui "html" 'desktopfile "firsttime"))
(init-uri (woo-get-option init-data 'uri)))
(if (or (uri-prefix? init-uri uri)
(uri-prefix? "/firsttime" uri))
(let* ((scm (cond-assq 'scm template-args))
(scm2 (process-module uri msg))
(po-domain (and (pair? scm2) (find-po-domain scm2)))
(init-title (woo-get-option init-data 'name)))
(apply-po-domain
(template scm
(head-tag scm2 init-title)
(title-tag init-title)
(main-tag scm2))
po-domain))
(html:redirect init-uri))))
alterator-firsttime-0.4/systemd/000075500000000000000000000000001206137174400170515ustar00rootroot00000000000000alterator-firsttime-0.4/systemd/system/000075500000000000000000000000001206137174400203755ustar00rootroot00000000000000alterator-firsttime-0.4/systemd/system/alterator-firsttime.service000064400000000000000000000005051206137174400257600ustar00rootroot00000000000000
[Unit]
Description=Alterator WWW first-boot frontend server

[Service]
ExecStartPre=/usr/bin/cert-sh generate "ahttpd"
ExecStart=/usr/sbin/ahttpd -c /etc/ahttpd/ahttpd-firsttime.conf
ExecStartPost=/usr/bin/avahi-sh publish_service ahttpd 'Initial system setup at %h' '_https._tcp' 8080

[Install]
WantedBy=multi-user.target
alterator-firsttime-0.4/systemd/system/alterator-firsttime.socket000064400000000000000000000002051206137174400256050ustar00rootroot00000000000000
[Unit]
Description=Alterator WWW first-boot frontend server (socket)

[Socket]
ListenStream=8080

[Install]
WantedBy=sockets.target
alterator-firsttime-0.4/ui/000075500000000000000000000000001206137174400157765ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/000075500000000000000000000000001206137174400200045ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/finish/000075500000000000000000000000001206137174400212645ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/finish/index.html000064400000000000000000000004621206137174400232630ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html wf="firsttime-finish">
<body>
<p><img src="/design/images/loading.gif" style="vertical-align:middle"/>&nbsp;&nbsp;<span translate="_">Configuring system. Please wait...</span></p>
</body>
</html>
alterator-firsttime-0.4/ui/firsttime/framework/000075500000000000000000000000001206137174400220015ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/framework/index.html000064400000000000000000000032211206137174400237740ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!-- main template -->
<html wf="firsttime-framework">
<head>
<meta http-equiv="cache-control" value="no-cache"/>
<meta http-equiv="content-type" value="text/html;charset=utf-8"/>

<link type="text/css" rel="stylesheet" href="/design/styles/common.css"/>
<link type="text/css" rel="stylesheet" href="/design/styles/alterator.css"/>

<script src="/design/scripts/jquery.js"/>
<script src="/design/scripts/form.js"/>

<script src="/design/scripts/excanvas.js"/>
<script src="/design/scripts/coolclock.js"/>
</head>
<body class="firsttime">
<noscript>
<div class="alterator-attention-message">
<img src="/design/images/attention.gif"/>
<span translate="alterator-ahttpd">This page uses Javascript. Your browser either doesn't support Javascript or you have it turned off. To see this page as it is meant to appear please use a Javascript enabled browser.</span>
</div>
</noscript>
<div id="top" class="ui-corner-all">
<table style="width:100%">
<tbody>
<tr>
<td>
<img id="product-logo" src="/design/images/null.gif"/>
</td>
<td style="width:100%;white-space:nowrap" valign="middle">
<span id="title" translate="alterator-firsttime">Hostname</span>
</td>
<td style="width:0px" class="top-button" valign="middle">
<form>
<input type="button" class="btn" id="help-button" translate="alterator-firsttime" value="Help"/>
</form>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<div id="main" class="box ui-corner-all"/>
</div>
</body>
</html>
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin