blob: fc400da74dbf88a798b8353315f50bee2b559129 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/bash
function do_install()
{
send install_step check_partitions_for_install
check_partitions_for_install
prepare_target
prepare_partitions_for_install
copy_system_to_target
update_fstab_on_target
update_passwd_on_target
copy_home_to_target
copy_etc_to_target
configure_target_update_files
configure_target_purge_live_only_stuff
configure_target_services
install_bootmanager_to_target
send install_step cleanup
cleanup
}
function prepare_target()
{
send install_step prepare_target
mkdir -p /live/hdinstall
export TARGET=/live/hdinstall
}
# Synopsis: chroot_it <...>
#
# execute the supplied command in the target
function chroot_it()
{
[ -n "$TARGET" -a $UID -eq 0 ] && chroot $TARGET "$@"
}
# Synopsis: copy_system_to_target
#
# This function copies the system to the target.
# Therefore $TARGET and all partitions of hd_map have to be mounted
# this should have be done in the prepare-stage (see prepare_partitions_for_install)
#
function copy_system_to_target()
{
send install_step copy_system_to_target
emit_progress 0
orig_size="$ESTIMATED_ROOT_MIN"
dest_size_before=$(di -dm -fSMu | gawk '/\/live\/hdinstall/{used+=int($3)} END{print int(used)}')
dest_size_diff=0
cd /live/filesystem
cp -a * $TARGET &
cp=$!
old_percent=0
while ps --pid $cp &>/dev/null
do
dest_size=$(di -dm -fSMu | gawk '/\/live\/hdinstall/{used+=int($3)} END{print int(used)}')
dest_size_diff=$(( $dest_size - $dest_size_before ))
percent=$((( 100 * $dest_size_diff ) / $orig_size ))
if [ "$percent" != "$old_percent" ]; then
emit_progress $percent
old_percent="$percent"
fi
sleep 5
done
sync
mkdir -p "$TARGET/proc" "$TARGET/dev" "$TARGET/sys"
mount --bind /proc "$TARGET/proc"
mount --bind /dev "$TARGET/dev"
mount --bind /sys "$TARGET/sys"
}
|