alterator-firsttime-0.4/000075500000000000000000000000001127501035600153545ustar00rootroot00000000000000alterator-firsttime-0.4/Makefile000064400000000000000000000002671127501035600170210ustar00rootroot00000000000000NAME=firsttime all: clean: install: install-data install-module include /usr/share/alterator/build/module.mak install-data: install -d $(libexecdir)/alterator/hooks/firsttime.d alterator-firsttime-0.4/ahttpd-firsttime.conf000064400000000000000000000005651127501035600215210ustar00rootroot00000000000000#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.init000075500000000000000000000032511127501035600215350ustar00rootroot00000000000000#!/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/000075500000000000000000000000001127501035600170265ustar00rootroot00000000000000alterator-firsttime-0.4/backend3/firsttime000075500000000000000000000003451127501035600207640ustar00rootroot00000000000000#!/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/000075500000000000000000000000001127501035600174775ustar00rootroot00000000000000alterator-firsttime-0.4/interfaces/guile/000075500000000000000000000000001127501035600206045ustar00rootroot00000000000000alterator-firsttime-0.4/interfaces/guile/workflow/000075500000000000000000000000001127501035600224565ustar00rootroot00000000000000alterator-firsttime-0.4/interfaces/guile/workflow/firsttime-finish.scm000064400000000000000000000016241127501035600264510ustar00rootroot00000000000000(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.scm000064400000000000000000000037231127501035600271700ustar00rootroot00000000000000(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/ui/000075500000000000000000000000001127501035600157715ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/000075500000000000000000000000001127501035600177775ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/finish/000075500000000000000000000000001127501035600212575ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/finish/index.html000064400000000000000000000004621127501035600232560ustar00rootroot00000000000000

  Configuring system. Please wait...

alterator-firsttime-0.4/ui/firsttime/framework/000075500000000000000000000000001127501035600217745ustar00rootroot00000000000000alterator-firsttime-0.4/ui/firsttime/framework/index.html000064400000000000000000000032211127501035600237670ustar00rootroot00000000000000