alterator-livecd-0.8.4/000075500000000000000000000000001230535136000147605ustar00rootroot00000000000000alterator-livecd-0.8.4/Makefile000064400000000000000000000012051230535136000164160ustar00rootroot00000000000000NAME=livecd SUBDIRS = scripts notes 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-initinstall.d install -dm755 $(hooks_dir)/livecd-preinstall.d install -dm755 $(hooks_dir)/livecd-postinstall.d cp -a livecd-initinstall.d/* $(hooks_dir)/livecd-initinstall.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) datadir=$(datadir) || exit; \ done alterator-livecd-0.8.4/backend3/000075500000000000000000000000001230535136000164325ustar00rootroot00000000000000alterator-livecd-0.8.4/backend3/livecd-finish000075500000000000000000000023401230535136000211030ustar00rootroot00000000000000#!/bin/sh po_domain="alterator-livecd" alterator_api_version=1 postinstall_hooks_dir=/usr/lib/alterator/hooks/livecd-postinstall.d livecd_root_dir=/livecd-root . alterator-sh-functions . alterator-livecd-functions on_message() { case "$in_action" in write) case "$in__objects" in /) # update /etc/fstab after installation chroot "$livecd_root_dir" service livecd-fstab start >&2 ||: # resurrect fixed mount points at the end of installer work chroot "$livecd_root_dir" mount -a # turn on swap again chroot "$livecd_root_dir" swapon -a # Unmount /livecd-root and remove it. mount | sed -r -n "s;^.+ on ($livecd_root_dir/.+) type .+$;\1;p" | sort -r | xargs umount umount "$livecd_root_dir" && rmdir "$livecd_root_dir" || write_error "`_ "Can't remove $livecd_root_dir"`" ;; run-postinstall) # Run postintall scripts in livecd root. chroot "$livecd_root_dir" run-parts "$postinstall_hooks_dir" ;; esac ;; read) local languages= html_file= languages="$(printf '%s' "$in_language" |tr ';' ' ') all" html_file="$(find_htmlfile "livecd-finish" "$languages")" if [ -s "$html_file" ]; then write_string_param "url" "$html_file" else write_error "`_ "File not found"`" fi ;; esac } message_loop alterator-livecd-0.8.4/backend3/livecd-install000075500000000000000000000133351230535136000212770ustar00rootroot00000000000000#!/bin/sh . shell-config . shell-var po_domain="alterator-livecd" alterator_api_version=1 source_dir="${source_dir:-/.ro}" target_dir="${target_dir:-/mnt/destination}" preinstall_hooks_dir=/usr/lib/alterator/hooks/livecd-preinstall.d du_exclude_list='/mnt /home /media /run /var/run /srv' install_pid= slideshow_conf="/etc/alterator/slideshow.conf" # Default slideshow timeout, sec default_slideshow_step=30 default_slideshow_path="/usr/share/install2/slideshow" export target_dir . alterator-sh-functions . livecd-functions . install2-remount-functions do_notify() { alterator-mailbox-send "$1 \"$(write_string "$2")\"" echo "message:$1 $2" >&2 sleep 0.1 } do_notify_error() { do_notify error "$1" } do_notify_status() { do_notify status "$1" } do_notify_stage() { do_notify stage "$1" } ## # 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 } ## # copy squashfs image # do_install() { local src="$1";shift local dst="$1";shift local total_size= total_files= free= checkpoint_step= checkpoint= pct= cur= dst_size= local checkpoints_number=200 local count=0 local prev_pct=-1 local du_exclude_dir= local du_exclude_file=/tmp/alterator-livecd-du-exclude-list if [ ! -d "$src" ]; then do_notify_error "Can't find image mountpoint ($src)" return 1 fi if ! mkdir -p -- "$dst";then do_notify_error "Can't write to $dst directory" return 1 fi do_notify_stage preinstall shopt -sq dotglob total_size="$(du -sb "$src" 2>/dev/null | cut -f1)" total_files="$(find "$src"/* 2>/dev/null | wc -l)" if [ -z "$total_size" -o $total_files -eq 0 ] ; then do_notify_error "Can't calculate image size" return 1 fi free=$(free_space "$dst") if [ $total_size -gt $free ]; then do_notify_error "No free space to copy image" return 1 fi checkpoint_step="$(($total_files / $checkpoints_number))" do_notify_stage install checkpoint="$checkpoint_step" if [ -n "$(find "$dst" -mount -type f -print -quit)" ]; then do_notify_error "$dst is not empty!" fi # exclude specified directories from du counts # if needed (mounted to the $dst) touch "$du_exclude_file" for du_exclude_dir in $du_exclude_list; do if mount | egrep -qs "^/dev.+ ${dst%/}$du_exclude_dir.* type.+$"; then echo "${dst%/}$du_exclude_dir" >>"$du_exclude_file" fi done cp -avf "$src"/* "$dst" | while read cur; do count="$(($count + 1))" [ $count -ge $checkpoint ] || continue checkpoint="$(($checkpoint + $checkpoint_step))" dst_size="$(du -sb --exclude-from="$du_exclude_file" "$dst" 2>/dev/null | cut -f1)" pct="$(($dst_size * 100 / $total_size))" [ $pct -le 100 ] || pct=100 # Don't sent the same percentage again [ $pct -gt $prev_pct ] || continue prev_pct="$pct" do_notify_status "$pct" done # Set right perms on root directory of installed system chmod 0755 "$dst" do_notify_stage postinstall for i in proc dev sys run; do mkdir -p -- "$dst/$i" mountpoint -q "$dst/$i" || mount --bind /$i "$dst/$i" done # Remount volumes (involves shutting down EVMS) if ! remount_chroot >&2; then do_notify_error "Can't remount destination filesystems" fi # Mount cgroups in the $dst: # can be needed in case of systemd if mountpoint -q /sys/fs/cgroup; then mkdir -p -- "$dst" mountpoint -q "$dst/sys/fs/cgroup" || mount --rbind /sys/fs/cgroup "$dst/sys/fs/cgroup" fi # Run preinstall scripts run-parts "$preinstall_hooks_dir" alteratord_socket_dir="/var/run/alteratord" # replace itself with alteratord from chroot [ -n "${dst:-}" ] || return mount -o bind "$dst/$alteratord_socket_dir" "$alteratord_socket_dir" chroot "$dst" /etc/init.d/alteratord start # Mount root to target dir for access from chroot at finish stage mkdir -p "$dst/livecd-root" mount --rbind / "$dst/livecd-root" 2>/dev/null mount --make-rslave "$dst/livecd-root" 2>/dev/null # wait until new alteratord is ready to use alterator-wait # notify interface about finish do_notify_stage done sync return 0 } ### slideshow configuration read_slideshow_conf() { local step="$(shell_config_get "$slideshow_conf" step)" if [ -z "$step" ] || echo "$step" | egrep -vqs '^[[:digit:]]+$'; then step="$default_slideshow_step" fi write_string_param step "$step" local once="$(shell_config_get "$slideshow_conf" once)" if [ -n "$once" ] && shell_var_is_yes "$once"; then once='true' else once='false' fi write_bool_param once "$once" local url="$(shell_config_get "$slideshow_conf" url)" [ -n "$url" ] || url="$default_slideshow_path" write_string_param url "$url" } on_message() { case "$in_action" in read) case "$in__objects" in slideshow-config) read_slideshow_conf ;; *) ;; esac ;; write) if [ -n "$install_pid" ] && kill -0 "$install_pid" ;then write_error "Process already running" return fi do_install "$source_dir" "$target_dir"& install_pid=$! ;; esac } message_loop alterator-livecd-0.8.4/backend3/livecd-start000075500000000000000000000024461230535136000207670ustar00rootroot00000000000000#!/bin/sh po_domain="alterator-livecd" alterator_api_version=1 image_dir="${image_dir:-/image}" target_dir="${target_dir:-/mnt/destination}" initinstall_hooks_dir=/usr/lib/alterator/hooks/livecd-initinstall.d . alterator-sh-functions . alterator-livecd-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 [ -n "${mpoint%%/.*}" ] || 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 # Run initinstall scripts run-parts "$initinstall_hooks_dir" ;; read) local languages= html_file= languages="$(printf '%s' "$in_language" |tr ';' ' ') all" html_file="$(find_htmlfile "livecd-start" "$languages")" if [ -s "$html_file" ]; then write_string_param "url" "$html_file" else write_error "`_ "File not found"`" fi ;; esac } message_loop alterator-livecd-0.8.4/livecd-initinstall.d/000075500000000000000000000000001230535136000210005ustar00rootroot00000000000000alterator-livecd-0.8.4/livecd-initinstall.d/55-slideshow.sh000075500000000000000000000013311230535136000235650ustar00rootroot00000000000000#!/bin/sh . livecd-functions . shell-config slideshow_conf='/etc/alterator/slideshow.conf' mem=$(cat /proc/meminfo | grep MemTotal | egrep -o '[0-9]+') if [ "$mem" -le 500000 ] ; then # Don't bring up slideshow. if [ -s "$slideshow_conf" ]; then shell_config_set "$slideshow_conf" url /var/empty else # Just remove slideshow if there is no config file rm -fr /usr/share/install2/slideshow/* fi else url="$(shell_config_get "$slideshow_conf" url)" url="${url:-/usr/share/install2/slideshow}" # Setup proper localized slideshow lang=$(sed -n 's/^.*lang=\([^ ]*\).*/\1/gp' /proc/cmdline) lang="${lang%%_*}" if [ -n "$lang" -a -d "$url-$lang" ]; then shell_config_set "$slideshow_conf" url "$url-$lang" fi fi alterator-livecd-0.8.4/notes/000075500000000000000000000000001230535136000161105ustar00rootroot00000000000000alterator-livecd-0.8.4/notes/Makefile000064400000000000000000000001501230535136000175440ustar00rootroot00000000000000 install: install -d $(datadir)/alterator-livecd/notes cp -a *.html $(datadir)/alterator-livecd/notes alterator-livecd-0.8.4/notes/livecd-finish.all.html000064400000000000000000000003411230535136000222670ustar00rootroot00000000000000

All work is succesfully done.

New system is available at /mnt/destination mount point.

alterator-livecd-0.8.4/notes/livecd-finish.ru.html000064400000000000000000000004251230535136000221500ustar00rootroot00000000000000

Работа успешно завершена.

Новая система располагается в каталоге /mnt/destination.

alterator-livecd-0.8.4/notes/livecd-start.all.html000064400000000000000000000004521230535136000221470ustar00rootroot00000000000000

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.

alterator-livecd-0.8.4/notes/livecd-start.ru.html000064400000000000000000000006721230535136000220310ustar00rootroot00000000000000

Перед тем, как начать установку, пожалуйста, закройте все открытые окна приложений.

Во время работы все устройства будут отмонтированы, а все разделы подкачки отключены.

alterator-livecd-0.8.4/scripts/000075500000000000000000000000001230535136000164475ustar00rootroot00000000000000alterator-livecd-0.8.4/scripts/Makefile000064400000000000000000000005641230535136000201140ustar00rootroot00000000000000INSTALL = /usr/bin/install sbin_TARGETS = livecd-functions bin_TARGETS = alterator-livecd-functions 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.8.4/scripts/alterator-livecd-functions000064400000000000000000000007101230535136000236370ustar00rootroot00000000000000#!/bin/sh dirs="/usr/share/alt-notes /usr/share/alterator-livecd/notes" find_htmlfile() { local name="$1" local languages="$2" local path= html_file= for path in $dirs; do for lang in $languages; do case "$lang" in POSIX|C|all) lang="all";; *) lang="$(printf %s "${lang%%_*}" |tr '[A-Z]' '[a-z]')";; esac html_file="$path/$name.$lang.html" if [ -s "$html_file" ]; then echo "$html_file" return fi done done } alterator-livecd-0.8.4/scripts/livecd-functions000064400000000000000000000006541230535136000216530ustar00rootroot00000000000000#!/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}" destdir=$target_dir exec_chroot() { env -i PATH="$PATH" HOME="/root" TMPDIR="/tmp" \ chroot "$target_dir" "$@" } alterator-livecd-0.8.4/steps/000075500000000000000000000000001230535136000161165ustar00rootroot00000000000000alterator-livecd-0.8.4/steps/livecd-finish.desktop000064400000000000000000000003471230535136000222410ustar00rootroot00000000000000[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.8.4/steps/livecd-install.desktop000064400000000000000000000003441230535136000224240ustar00rootroot00000000000000[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.8.4/steps/livecd-start.desktop000064400000000000000000000003541230535136000221140ustar00rootroot00000000000000[Desktop Entry] Type=Application Categories=X-Alterator-Other Terminal=false Name=Preparing for install Icon=steps/greeting X-Alterator-URI=/livecd/start X-Alterator-Help=livecd-start Name[ru]=Подготовка к установке alterator-livecd-0.8.4/ui/000075500000000000000000000000001230535136000153755ustar00rootroot00000000000000alterator-livecd-0.8.4/ui/livecd/000075500000000000000000000000001230535136000166435ustar00rootroot00000000000000alterator-livecd-0.8.4/ui/livecd/finish/000075500000000000000000000000001230535136000201235ustar00rootroot00000000000000alterator-livecd-0.8.4/ui/livecd/finish/index.scm000064400000000000000000000011421230535136000217340ustar00rootroot00000000000000(document:surround "/std/frame") margin 10 spacing 10 (document:id finish-text (textbox (string-append "

" (_ "Finish text not found") "

") alterability #f)) (define (load-text) (woo-catch/ignore (thunk (finish-text url (woo-get-option (woo-read-first "/livecd-finish") 'url))))) (define (ui-on-next) (or (catch/message (lambda() (woo-write "/livecd-finish"))) 'cancel)) (define (run-postinstall) (catch/message (lambda() (woo-write "/livecd-finish/run-postinstall")))) (document:root (when loaded (load-text) (run-postinstall))) (frame:on-next ui-on-next) alterator-livecd-0.8.4/ui/livecd/install/000075500000000000000000000000001230535136000203115ustar00rootroot00000000000000alterator-livecd-0.8.4/ui/livecd/install/index.scm000064400000000000000000000035701230535136000221310ustar00rootroot00000000000000(document:surround "/std/frame") ;;; UI (box orientation "vertical" margin 10 (document:id sl (slideshow)) (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))))) (define (slideshow-config) (catch/message (lambda() (let ((config (woo-read-first "/livecd-install/slideshow-config"))) (sl step (woo-get-option config 'step)) (sl once (woo-get-option config 'once)) (sl url (woo-get-option config 'url)))))) ;;;;;; ;;; 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) (slideshow-config) (sl start #t) (ready))) alterator-livecd-0.8.4/ui/livecd/start/000075500000000000000000000000001230535136000200005ustar00rootroot00000000000000alterator-livecd-0.8.4/ui/livecd/start/index.scm000064400000000000000000000007771230535136000216260ustar00rootroot00000000000000(document:surround "/std/frame") margin 10 spacing 10 (document:id start-text (textbox (string-append "

" (_ "Start text not found") "

") alterability #f)) (define (load-text) (woo-catch/ignore (thunk (start-text url (woo-get-option (woo-read-first "/livecd-start") 'url))))) (define (ui-on-next) (or (catch/message (lambda() (woo-write "/livecd-start"))) 'cancel)) (frame:on-next ui-on-next) (document:root (when loaded (load-text)))