blob: bf38040955c2f8e4f0e0d3511282911d2aa738fc (
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
#!/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_exec ()
{
# Execute commands chrooted
chroot "${LIVE_CHROOT}" /usr/bin/env -i HOME="/root" PATH="/usr/sbin:/usr/bin:/sbin:/bin" TERM="${TERM}" ftp_proxy="${LIVE_PROXY_FTP}" http_proxy="${LIVE_PPROXY_HTTP}" DEBIAN_FRONTEND="noninteractive" DEBIAN_PRIORITY="critical" ${1}
return ${?}
}
Chroot ()
{
if [ ! -f "${LIVE_ROOT}"/.stage/chroot ]
then
# Configure chroot
Patch_chroot apply
Patch_runlevel apply
# Configure network
Patch_network apply
# Mount proc
mount proc-live -t proc "${LIVE_CHROOT}"/proc
# Configure sources.list
Indices custom
# Install secure apt
if [ "${LIVE_DISTRIBUTION}" = "testing" ] || [ "${LIVE_DISTRIBUTION}" = "unstable" ]
then
if [ "${LIVE_FLAVOUR}" != "minimal" ]
then
Chroot_exec "apt-get install --yes --force-yes debian-archive-keyring"
for NAME in ${LIVE_REPOSITORIES}
do
eval REPOSITORY_KEY="$`echo LIVE_REPOSITORY_KEY_$NAME`"
eval REPOSITORY_KEYRING="$`echo LIVE_REPOSITORY_KEYRING_$NAME`"
if [ -n "${REPOSITORY_KEYRING}" ]
then
Chroot_exec "apt-get install ${REPOSITORY_KEYRING}"
elif [ -n "${REPOSITORY_KEY}" ]
then
Chroot_exec "wget ${REPOSITORY_KEY}"
Chroot_exec "apt-key add `basename ${REPOSITORY_KEY}`"
Chroot_exec "rm -f `basename ${REPOSITORY_KEY}`"
fi
done
fi
fi
# Update indices
Chroot_exec "apt-get update"
# Configure linux-image
Patch_linux apply
# Install linux-image, modules and casper
Chroot_exec "apt-get install --yes --force-yes linux-image-2.6-${LIVE_KERNEL} squashfs-modules-2.6-${LIVE_KERNEL} unionfs-modules-2.6-${LIVE_KERNEL} casper"
# Deconfigure linux-image
Patch_linux deapply
# Install packages list
if [ -n "${LIVE_PACKAGE_LIST}" ]
then
grep -v "^#" "${LIVE_PACKAGE_LIST}" > "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`"
Chroot_exec "xargs --arg-file=/root/`basename ${LIVE_PACKAGE_LIST}` apt-get install --yes --force-yes"
rm -f "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`"
fi
# Install extra packages
if [ -n "${LIVE_PACKAGES}" ]
then
Chroot_exec "apt-get install --yes --force-yes ${LIVE_PACKAGES}"
fi
# Copy external directory into the chroot
if [ -d "${LIVE_INCLUDE_CHROOT}" ]
then
cd "${LIVE_INCLUDE_CHROOT}"
find . | cpio -pumd "${LIVE_CHROOT}"
cd "${OLDPWD}"
fi
# Process flavour specific hooks
if [ -r "${BASE}"/hooks/"${LIVE_FLAVOUR}" ]
then
grep -v "^#" "${BASE}"/hooks/"${LIVE_FLAVOUR}" > "${LIVE_CHROOT}"/root/"${LIVE_FLAVOUR}"
Chroot_exec "sh /root/${LIVE_FLAVOUR}"
rm -f "${LIVE_CHROOT}"/root/"${LIVE_FLAVOUR}"
fi
# Execute extra command in the chroot
if [ -r "${LIVE_HOOK}" ]
then
# FIXME
Chroot_exec "`cat ${LIVE_HOOK}`"
elif [ -n "${LIVE_HOOK}" ]
then
Chroot_exec "${LIVE_HOOK}"
fi
# Temporary hacks for broken packages
Hack_xorg
# Add filesystem.manifest
Chroot_exec "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest
if [ ! -z "${LIVE_MANIFEST}" ]
then
Chroot_exec "apt-get install --yes --force-yes ${LIVE_MANIFEST}"
Chroot_exec "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest-desktop
fi
# Remove unused packages
Chroot_exec "apt-get remove --purge --yes cdebootstrap-helper-diverts"
# Clean apt packages cache
rm -rf "${LIVE_CHROOT}"/var/cache/apt
mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
# Remove cdebootstrap packages cache
rm -rf "${LIVE_CHROOT}"/var/cache/bootstrap
# Unmount proc
umount "${LIVE_CHROOT}"/proc
# Deconfigure network
Patch_network deapply
# Deconfigure chroot
Patch_runlevel deapply
Patch_chroot deapply
# Touching stage file
touch "${LIVE_ROOT}"/.stage/chroot
fi
}
|