Репозиторий Sisyphus
Последнее обновление: 14 апреля 2021 | Пакетов: 17839 | Посещений: 20720879
en ru br
Репозитории ALT
S:0.8.6-alt1
5.1: 0.3-alt2
www.altlinux.org/Changes

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

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

alterator-livecd-0.3/000075500000000000000000000000001124517366300146235ustar00rootroot00000000000000alterator-livecd-0.3/Makefile000064400000000000000000000007711124517366300162700ustar00rootroot00000000000000NAME=livecd

SUBDIRS = scripts

hooks_dir = $(libexecdir)/alterator/hooks

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

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

install-data:
install -dm755 $(hooks_dir)/livecd-preinstall.d
install -dm755 $(hooks_dir)/livecd-postinstall.d

all-subdirs:
for i in $(SUBDIRS); do \
make -C $$i || exit; \
done

install-subdirs:
for i in $(SUBDIRS); do \
make -C $$i install bindir=$(bindir) sbindir=$(sbindir) || exit; \
done
alterator-livecd-0.3/backend3/000075500000000000000000000000001124517366300162755ustar00rootroot00000000000000alterator-livecd-0.3/backend3/livecd-finish000075500000000000000000000005331124517366300207500ustar00rootroot00000000000000#!/bin/sh

po_domain="alterator-livecd"
alterator_api_version=1

. alterator-sh-functions

on_message() {
case "$in_action" in
write)
# update /etc/fstab after installation
service livecd-fstab start >&2 ||:
# resurrect fixed mount points at the end of installer work
mount -a
# turn on swap again
swapon -a
;;
esac
}

message_loop
alterator-livecd-0.3/backend3/livecd-install000075500000000000000000000064211124517366300211400ustar00rootroot00000000000000#!/bin/sh -f

po_domain="alterator-livecd"
alterator_api_version=1
source_file="${source_dir:-/image/live}"
target_dir="${target_dir:-/mnt/destination}"
preinstall_hooks_dir=/usr/lib/alterator/hooks/livecd-preinstall.d
postinstall_hooks_dir=/usr/lib/alterator/hooks/livecd-postinstall.d
install_pid=

export target_dir

. alterator-sh-functions

do_notify()
{
alterator-mailbox-send "$1 \"$(write_string "$2")\""
echo "message:$1 $2" >&2
sleep 1
}

do_notify_error()
{
do_notify error "$1"
}

do_notify_status()
{
do_notify status "$1"
}

do_notify_stage()
{
do_notify stage "$1"
}

##
# Calculate unpacked sqaushfs size
#
sqfs_size() {
local total=0 file_size=0

local img="$1" && shift

[ -f "$img" ] || return 1


unsquashfs -ll "$img" 2>/dev/null | sed -e '1,3d' -e 's/[[:space:]]\+/ /g' | cut -f 3 -d ' ' | sed -e '/,/d' |
{
local total=0 file_size=0

while read file_size; do
((total += file_size))
done

echo $total
}

return 0
}

##
# Return free space in bytes on mounted file system
#
free_space() {
local target="$1" && shift

[ -e "$target" ] || return 1

df --block-size=1 "$target" | sed -e '1d' -e 's/[[:space:]]\+/ /g' | cut -d ' ' -f 4

return 0
}

##
# unpack squashfs image
#

do_install()
{
local img="$1";shift
local dst="$1";shift
local percent1=

if ! [ -r "$img" ]; then
do_notify_error "Can't read squashfs image $img"
return 1
fi

if ! mkdir -p -- "$dst";then
do_notify_error "Can't write to $dst directory"
return 1
fi

do_notify_stage preinstall
run-parts "$preinstall_hooks_dir"

# calculate inodes per one percent
percent1="$(unsquashfs -n -s "$img" | grep inodes | sed -e 's/[^[:digit:]]\+//')"
percent1="$((percent1/99))"

# calculate size necessary for unpacked squashfs image
local unpacked=$(sqfs_size "$img")

if [ -z "$unpacked" ]; then
do_notify_error "Can't calculate unpacked squashfs size"
return 1
fi

local free=$(free_space "$target_dir")

if [ $unpacked -gt $free ]; then
do_notify_error "No free space to unpack squashfs image"
return 1
fi

do_notify_stage install

unsquashfs -force -no-progress -info -dest "$dst" "$img" 2>/dev/null |
{
local i=0
local progress=0

while read ignore; do
((i += 1))
if [ $i -gt $percent1 ]; then
do_notify_status "$((progress++))"
i=0
fi
done
}

do_notify_stage postinstall

for i in proc dev sys; do
mkdir -p -- "$target_dir/$i"
mountpoint -q "$target_dir/$i" || mount --bind /$i "$target_dir/$i"
done

run-parts "$postinstall_hooks_dir"

do_notify_stage done

return 0
}

on_message()
{
case "$in_action" in
write)
if [ -n "$install_pid" ] && kill -0 "$install_pid" ;then
write_error "Process already running"
return
fi
do_install "$source_file" "$target_dir"&
install_pid=$!
;;
esac
}

message_loop
alterator-livecd-0.3/backend3/livecd-start000075500000000000000000000015141124517366300206250ustar00rootroot00000000000000#!/bin/sh

po_domain="alterator-livecd"
alterator_api_version=1

image_dir="${image_dir:-/image}"
target_dir="${target_dir:-/mnt/destination}"

. alterator-sh-functions

on_message() {
case "$in_action" in
write)
local dev mpoint rest
sort -r -k2,2 /proc/mounts|
while read dev mpoint rest; do
[ "$mpoint" != "/" -a "$mpoint" != "$image_dir" ] || continue
[ -b "$dev" ] || [ "${mpoint##$target_dir}" != "$mpoint" ] || continue
if ! umount "$mpoint";then
local msg="$(printf "`_ "Unable to unmount %s\n"`" "$mpoint")"
write_error "$msg"
return
fi
done

if ! swapoff -a; then
write_error "`_ "Unable to turn off swap partitions"`"
return
fi

if ! mkdir -p -- "$target_dir"; then
write_error "`_ "Unable to create directory for new system"`"
return
fi
;;
esac
}

message_loop
alterator-livecd-0.3/scripts/000075500000000000000000000000001124517366300163125ustar00rootroot00000000000000alterator-livecd-0.3/scripts/Makefile000064400000000000000000000005311124517366300177510ustar00rootroot00000000000000INSTALL = /usr/bin/install

sbin_TARGETS = livecd-functions

bin_TARGETS =

all:
install: install-bin install-sbin

install-bin: $(bin_TARGETS)
for i in $(bin_TARGETS); do $(INSTALL) -Dpm755 $$i $(bindir)/$$i || exit; done

install-sbin: $(sbin_TARGETS)
for i in $(sbin_TARGETS); do $(INSTALL) -Dpm755 $$i $(sbindir)/$$i || exit; done

clean:
alterator-livecd-0.3/scripts/livecd-functions000064400000000000000000000006301124517366300215100ustar00rootroot00000000000000#!/bin/sh

unset \
LANG \
LANGUAGE \
LC_CTYPE \
LC_NUMERIC \
LC_TIME \
LC_COLLATE \
LC_MONETARY \
LC_MESSAGES \
LC_PAPER \
LC_NAME \
LC_ADDRESS \
LC_TELEPHONE \
LC_MEASUREMENT \
LC_IDENTIFICATION \
LC_ALL \
TEXTDOMAIN TEXTDOMAINDIR action \
||:

. shell-error

target_dir="${target_dir:-/mnt/destination}"

exec_chroot()
{
env -i PATH="$PATH" HOME="/root" TMPDIR="/tmp" \
chroot "$target_dir" "$@"
}
alterator-livecd-0.3/steps/000075500000000000000000000000001124517366300157615ustar00rootroot00000000000000alterator-livecd-0.3/steps/livecd-finish.desktop000064400000000000000000000003471124517366300221040ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Other
Terminal=false
Name=Finish installation
Icon=steps/finish
X-Alterator-URI=/livecd/finish
X-Alterator-Help=livecd-finish
Name[ru]=п≈п╟п╡п╣я─я┬п╣п╫п╦п╣ я┐я│я┌п╟п╫п╬п╡п╨п╦
alterator-livecd-0.3/steps/livecd-install.desktop000064400000000000000000000003441124517366300222670ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Other
Terminal=false
Name=System installation
Icon=steps/install
X-Alterator-URI=/livecd/install
X-Alterator-Help=livecd-install
Name[ru]=пёя│я┌п╟п╫п╬п╡п╨п╟ я│п╦я│я┌п╣п╪я▀
alterator-livecd-0.3/steps/livecd-start.desktop000064400000000000000000000003131124517366300217520ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Other
Terminal=false
Name=Greeting
Icon=steps/greeting
X-Alterator-URI=/livecd/start
X-Alterator-Help=livecd-start
Name[ru]=п÷я─п╦п╡п╣я┌я│я┌п╡п╦п╣
alterator-livecd-0.3/ui/000075500000000000000000000000001124517366300152405ustar00rootroot00000000000000alterator-livecd-0.3/ui/livecd/000075500000000000000000000000001124517366300165065ustar00rootroot00000000000000alterator-livecd-0.3/ui/livecd/finish/000075500000000000000000000000001124517366300177665ustar00rootroot00000000000000alterator-livecd-0.3/ui/livecd/finish/index.scm000064400000000000000000000005641124517366300216060ustar00rootroot00000000000000(document:surround "/std/frame")

(gridbox
columns "100"
margin "20"
(label text-wrap #t
text (bold (_ "All work is succesfully done.")))
(label text-wrap #t
text (_ "New system is available at /mnt/destination mount point.")))

(define (ui-on-next)
(or (catch/message
(lambda()
(woo-write "/livecd-finish")))
'cancel))

(frame:on-next ui-on-next)
alterator-livecd-0.3/ui/livecd/install/000075500000000000000000000000001124517366300201545ustar00rootroot00000000000000alterator-livecd-0.3/ui/livecd/install/index.scm000064400000000000000000000030531124517366300217700ustar00rootroot00000000000000(document:surround "/std/frame")

;;; UI

(gridbox
columns "100"
margin 50
(label name "stage")
(document:id progress (progressbar maximum 100 value 0 visibility #f))
(label name "status" text-wrap #t))

;;; logic

(define (ui-stop)
(remove-mailbox ui-callback))

(define (ui-done)
(ui-stop)
(frame:next))

(define (ui-error reason)
(ui-stop)
(form-update-value "stage"
(bold (_ "Fatal error")))
(form-update-value "status"
reason))


(define (ui-stage stage)
(form-update-value "status" "")
(case stage
((install) (progress visibility #t)))
(form-update-value "stage"
(bold
(case stage
((install)(_ "Installing system..."))
((preinstall) (_ "Preparing..."))
((postinstall) (_ "Finishing..."))
((done) (_ "Installation is done"))))))

(define (ui-callback args)
(case (car args)
((stage)
(let ((stage (string->symbol (cadr args))))
(ui-stage stage)
(and (eq? stage 'done) (ui-done))))
((error)
(ui-error (cadr args)))
((status)
(let ((percent (cadr args)))
(progress text (string-append percent "%"))
(progress value percent)))))

;;;;;;
;;; Notify backend to start unpack squashfs
;;;
(define (ready)
(catch/message
(lambda()
(woo-write "/livecd-install"))))

(document:root
(when loaded
(frame:next-activity #f)
(frame:back-activity #f)
(add-mailbox ui-callback)
(ready)))
alterator-livecd-0.3/ui/livecd/start/000075500000000000000000000000001124517366300176435ustar00rootroot00000000000000alterator-livecd-0.3/ui/livecd/start/index.scm000064400000000000000000000007241124517366300214610ustar00rootroot00000000000000(document:surround "/std/frame")

(gridbox
columns "100"
margin "20"
(label text-wrap #t
text (string-append (bold (_ "Attention:"))
" "
(_ "Close all open windows before you continue to work.")
" "
(_ "During process all devices will be unmounted and all swap partitions will be turned off."))))

(define (ui-on-next)
(or (catch/message
(lambda()
(woo-write "/livecd-start")))
'cancel))

(frame:on-next ui-on-next)
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin