summaryrefslogtreecommitdiff
path: root/src/scripts/13chroot.sh
blob: f06cf4d5a5ccac3c3f89886ddac136c44738491c (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh

# make-live - utility to build Debian Live systems
#
# Copyright (C) 2006 Daniel Baumann <daniel@debian.org>
# Copyright (C) 2006 Marco Amadori <marco.amadori@gmail.com>
#
# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see COPYING for details.

Chroot ()
{
	if [ ! -f "${LIVE_ROOT}"/.stage/chroot ]
	then
		# Configure chroot
		lh_patchchroot apply
		lh_patchrunlevel apply

		# Configure network
		lh_patchnetwork apply

		# Mount proc
		mount proc-live -t proc "${LIVE_CHROOT}"/proc

		# Configure sources.list
		lh_setupapt custom initial
		lh_configapt apply-proxy
		lh_configapt apply-recommends

		# Install aptitude
		lh_installapt

		# Update indices
		lh_chroot "aptitude update"

		# Configure linux-image
		lh_patchlinux apply

		# Install linux-image, modules and casper
		lh_chroot "aptitude install --assume-yes ${LIVE_KERNEL_PACKAGES} casper"

		# Deconfigure linux-image
		lh_patchlinux deapply

		lh_clone
		lh_preseed

		lh_installtasks
		lh_installpackagelists
		lh_installpackages
		lh_includechroot
		lh_hook

		# Save package list
		lh_chroot "dpkg --get-selections" > "${LIVE_ROOT}"/packages.txt

		lh_config disable-daemons

		lh_manifest

		lh_cleanapt

		# Workaround binfmt-support /proc locking
		umount "${LIVE_CHROOT}"/proc/sys/fs/binfmt_misc > /dev/null || true

		# Unmount proc
		umount "${LIVE_CHROOT}"/proc

		# Deconfigure network
		lh_patchnetwork deapply

		# Deconfigure chroot
		lh_patchrunlevel deapply
		lh_patchchroot deapply

		# Touching stage file
		touch "${LIVE_ROOT}"/.stage/chroot
	fi

	# Check depends
	if [ "`grep dosfstools ${LIVE_ROOT}/packages.txt`" ]
	then
		KEEP_DOSFSTOOLS="true"
	fi

	if [ "`grep memtest86+ ${LIVE_ROOT}/packages.txt`" ]
	then
		KEEP_MEMTEST86="true"
	fi

	if [ "`grep mtools ${LIVE_ROOT}/packages.txt`" ]
	then
		KEEP_MTOOLS="true"
	fi

	if [ "`grep parted ${LIVE_ROOT}/packages.txt`" ]
	then
		KEEP_PARTED="true"
	fi

	if [ "`grep syslinux ${LIVE_ROOT}/packages.txt`" ]
	then
		KEEP_SYSLINUX="true"
	fi
}