#!/bin/sh
#
# This script is a part of the live-install package to copy ALT Linux system from LiveCD to harddisk
#
# Copyright (C) 2010-2011 Eugene Prokopiev  <enp@altlinux.org>
# Copyright (C) 2011      Michael Pozhidaev <msp@altlinux.org>

# argv1 - mounted partition to chroot;

THIS=${0##*/}
DESTDIR="${1%%/}"

if [ -z "$DESTDIR" ]; then
    echo "$THIS:chroot directory is not specified" >&2
    exit 1
fi

find /usr/share/live-install/scripts.d/ -type f |
while read l; do
    LOCAL="$DESTDIR/bin/live-install-local"
    /bin/cp "$l" "$LOCAL"
    /bin/chmod 755 "$LOCAL"
    /sbin/chroot "$DESTDIR" live-install-local
    /bin/rm -f "$LOCAL"
done
