Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37866893
en ru br
ALT Linux repos
S:0.2-alt1

Group :: System/Configuration/Other
RPM: alterator-mkimage

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

alterator-mkimage-0.2/000075500000000000000000000000001201522760100147525ustar00rootroot00000000000000alterator-mkimage-0.2/Makefile000064400000000000000000000002271201522760100164130ustar00rootroot00000000000000NAME=mkimage
DESCRIPTION="Create distribution images"

all:
clean:
install: install-module install-help

include /usr/share/alterator/build/module.mak
alterator-mkimage-0.2/applications/000075500000000000000000000000001201522760100174405ustar00rootroot00000000000000alterator-mkimage-0.2/applications/mkimage.desktop000064400000000000000000000003611201522760100224450ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-System
Icon=mkimage
Terminal=false
Name=Create distribution images
Name[ru]=Создание образов дистрибутивов
X-Alterator-URI=/mkimage
X-Alterator-Help=mkimage
alterator-mkimage-0.2/backend3/000075500000000000000000000000001201522760100164245ustar00rootroot00000000000000alterator-mkimage-0.2/backend3/mkimage000075500000000000000000000022131201522760100177620ustar00rootroot00000000000000#!/bin/sh

po_domain="alterator-mkimage"
alterator_api_version=1

. alterator-sh-functions

list_targets()
{
make __frontend=1 help/distro 2>/dev/null \
| while read i; do
write_enum_item "$i" "$i"
done
}

list_arches()
{
if [ "`arch`" = x86_64 ]; then
write_enum_item "64-bit" "x86_64"
fi
write_enum_item "32-bit" "i586"
}

xfer_args()
{
set \
| sed -rn 's/^in_([A-Z_0-9]+=.*)$/\1/p' \
| sed -e "s/'#t'/1/" -e "s/'#f'//"
}

make_target()
{
if [ "$EUID" = 0 ]; then
alterator-mailbox-send "message \"root builds unsupported\""
exit 0
fi
#xfer_args >&2
# NB: distclean happens even after a failed build
make __frontend=1 `xfer_args` "$1" distclean 2>&1 \
| while read -r time line; do
alterator-mailbox-send "message \"$line\""
done
}

for dir in ~/mkimage/mkimage-profiles /usr/share/mkimage-profiles; do
[ -d "$dir" ] && cd "$dir" && break
done || exit 1

on_message() {
case "$in_action" in
read) ;;
write)
if [ -n "$in_target" ]; then
make_target "$in_target" &
fi
;;
list)
case "$in__objects" in
targets) list_targets;;
arches) list_arches;;
esac
;;
esac
}

message_loop
alterator-mkimage-0.2/help/000075500000000000000000000000001201522760100157025ustar00rootroot00000000000000alterator-mkimage-0.2/help/en_US/000075500000000000000000000000001201522760100167135ustar00rootroot00000000000000alterator-mkimage-0.2/help/en_US/mkimage.html000064400000000000000000000014501201522760100212130ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<h2>Image build</h2>
<h3>Purpose</h3>
<p>
This module should facilitate local builds of custom ALT Linux based images by means of <tt>mkimage</tt> using <tt>mkimage-profiles</tt>.
</p>
<p>
Currently it allows to:
<ul>
<li>choose a predefined target image;</li>
<li>tweak a few parameters;</li>
<li>run a quick configuration test;</li>
<li>start the image build process.</li>
</ul>
</p>
<h3>References</h3>
<p>
Please see <a href="http://www.altlinux.org/Mkimage/Profiles/m-p">altlinux.org page on mkimage-profiles</a> for more detailed documentation.</p>
</body>
</html>
alterator-mkimage-0.2/ui/000075500000000000000000000000001201522760100153675ustar00rootroot00000000000000alterator-mkimage-0.2/ui/mkimage/000075500000000000000000000000001201522760100170015ustar00rootroot00000000000000alterator-mkimage-0.2/ui/mkimage/index.scm000064400000000000000000000113171201522760100206170ustar00rootroot00000000000000(document:surround "/std/frame")

(define squashfs-list
'("fast" "normal" "tight"))

(gridbox columns "10;40;40;10"
(spacer)
(document:id targets
(listbox name "target"
header (_ "Target image")
(when changed
(allow-builds #t #f))
(when selected
(let ((t (not-empty-string? (form-value "target"))))
(test-button activity t)
(if t
(status-set (_ "Let's test it before building"))
(choose-target))))))
(gridbox columns "20;80"
;;
(hbox colspan 2
(label text (bold (_ "Image configuration:")) align "center"))
;;
;;; ARCH needs apt-conf support; let's assume native one for a while
; (document:id ARCH
; (combobox name "ARCH"
; enumref "/mkimage/arches"))
; (label (_ "Architecture") align "left")
;;
(document:id SQUASHFS
(combobox name "SQUASHFS" rows squashfs-list))
(label (_ "SquashFS compression") align "left")
;;
(document:id ISOHYBRID
(checkbox name "ISOHYBRID" align "right"))
(label (_ "Hybrid ISO") align "left")
;;
(hbox colspan 2 (separator))
;;
(document:id reset-button
(button (_ "Reset") align "center"))
(hbox
(document:id test-button (button (_ "Test")))
(document:id build-button (button (_ "Build"))))
(spacer))
(spacer)
;;
(spacer)
(document:id progress (progressbar))
(document:id status-label (label))
(spacer)
;;
(spacer)
(hbox colspan 2
(document:id result (edit alterability #f)))
(spacer))

;;;;;;;;;;;;;;;;;;;;;; interface handling

(define (status-set message)
(status-label text (bold message)))

;;; tweak availability/behaviour of the form in different states
(define (status message inter active)
(status-set message)
; (format (current-error-port) "status: ~S~%" message)
(allow-changes inter)
(if active
(progress minimum 0 value 0 maximum 0)
(progress minimum 0 value 0 maximum -1 text (_ "idle"))))

;;; process incoming messages from backend
(define (message-handler args)
(format (current-error-port) "message-handler: ~S~%" args)
(and-let* ((msg (cond-plistq 'message args #f)))
(cond
;;status
((string-match "root builds unsupported" msg)
(status (_ "Builds using root privileges are not supported.") #f #f))
;;; can be post- or pre-, and is generally pretty fast
; ((string-match "cleaning up after build" msg)
; #t)
; ((string-match "cleaning up" msg)
; (status-set (_ "Cleaning up")))
((string-match "initializing BUILDDIR" msg)
(status (_ "Initializing build directory...") #f #t))
((string-match "preparing distro config" msg)
(status (_ "Preparing image configuration...") #f #t))
((string-match "starting image build" msg)
(status (_ "Building image, please wait...") #f #t))
((string-match "done" msg)
(status (_ "Done.") #t #f))
((string-match "failed" msg)
(status (_ "Failed!") #t #f))
((string-match ". Stop." msg)
(begin
(status (_ "Failed!") #t #f)
(allow-builds #f #f)
(result text msg)))
((string-match "skipping actual image build" msg)
(begin
(status (_ "Test passed") #t #f)
(result text "(no actual image yet)")))
((string-match "image: " msg)
(begin
(status "Image successfully built:" #t #f)
(result text (substring msg 7))))
)))

;;; FIXME: how to hook it up for pre-exit cleanup actions?
;(define (stop)
; (remove-mailbox message-handler))

(define (allow-builds test build)
(test-button activity test)
(build-button activity build))

(define (allow-changes v)
(allow-builds v v)
(targets activity v)
; (ARCH activity v)
(SQUASHFS activity v)
(ISOHYBRID activity v)
(reset-button activity v))

(define (choose-target)
(status-set "Choose target"))

;;;;;;;;;;;;;;;;;;;;;; backend communication

(define (reset-interface)
(catch/message
(lambda()
(begin
(form-update-enum "target" (woo-list "/mkimage/targets"))
(ISOHYBRID state #t)
(SQUASHFS current 1)
; (ARCH current 0)
(targets activity #t)
(choose-target)
(allow-builds #f #f)
))))

;;; "not really" means CHECK=1
(define (run-build really)
(begin
(allow-changes #f)
(catch/message
(lambda()
(woo-write "/mkimage"
'target (form-value "target")
; 'ARCH (ARCH text)
'SQUASHFS (SQUASHFS text)
'ISOHYBRID (form-value "ISOHYBRID")
'CHECK (not really)
)))))

;;;;;;;;;;;;;;;;;;;;;; button handlers

(test-button
(when clicked (run-build #f)))

(build-button
(when clicked (run-build #t)))

(reset-button
(when clicked (reset-interface)))

;;;;;;;;;;;;;;;;;;;;;; initialization
(document:root
(when loaded
(reset-interface)
(add-mailbox message-handler)))
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin