blob: 307433ad2d513dc7f78ba3ca21b4ef1353810f4c (
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
|
#!/bin/bash
. config/binary
. config/bootstrap
. config/common
. config/kanotix
bit=32
LABEL=Kanotix
[ "$LB_ARCHITECTURE" = "amd64" ] && bit=64 && LABEL=${LABEL}64
export LB_BOOTLOADER LB_BINARY_IMAGES
# Update kanotix-version (32/64-bit and timestamp)
KANOTIX_CODENAMES="lenny=Excalibur squeeze=Hellfire wheezy=Dragonfire jessie=TBA"
KANOTIX_CODENAME="$(echo $KANOTIX_CODENAMES | fmt -w1 | grep "^${LB_DISTRIBUTION}=" | cut -d= -f2)"
mkdir -p config/chroot_local-includes/etc
[ ! -f config/chroot_local-includes/etc/kanotix-version ] && echo Kanotix $KANOTIX_CODENAME 0000-00:00 > config/chroot_local-includes/etc/kanotix-version
[ "$KANOTIX_CODENAME" ] && perl -pi -e "s%($(echo $(echo $KANOTIX_CODENAMES | fmt -w1 | cut -d= -f2) | tr ' ' '|'))%$KANOTIX_CODENAME%i; s%(Kanotix|$KANOTIX_CODENAME)(32|64)%\${1}$bit%i" config/chroot_local-includes/etc/kanotix-version
perl -pi -e "s%(32|64)(bit)%$bit\${2}%i; s|[0-9]+-[0-9]+:[0-9]+|$(date +%Y%m%d-%H:%M)|" config/chroot_local-includes/etc/kanotix-version
prebuild()
{
# make current build configuration available for hooks inside chroot
mkdir -p config/chroot_local-includes/root
cat config/* 2>/dev/null | grep ^LB_ > config/chroot_local-includes/root/build.conf
for bootstrap_dir in cache/stages_bootstrap cache/bootstrap
do
if [ -d ${bootstrap_dir} ]; then
bsbit=$(file ${bootstrap_dir}/bin/true | grep -q "ELF 64-bit" && echo 64 || echo 32)
mv ${bootstrap_dir} ${bootstrap_dir}$bsbit
fi
[ -d ${bootstrap_dir}$bit ] && mv ${bootstrap_dir}$bit ${bootstrap_dir}
done
rm -f kanotix$bit.iso
echo "LB_SYSLINUX_MENU_LIVE_ENTRY=\"$LABEL\"" >> config/binary
}
postbuild()
{
for bootstrap_dir in cache/stages_bootstrap cache/bootstrap
do
[ -d ${bootstrap_dir} ] && mv ${bootstrap_dir} ${bootstrap_dir}$bit
done
[ -f binary-hybrid.iso ] && mv -f binary-hybrid.iso kanotix$bit.iso
[ -f binary.hybrid.iso ] && mv -f binary.hybrid.iso kanotix$bit.iso
}
if [ "$LB_KANOTIX_TMPFS" = "true" ]; then
mkdir -p tmpfs
# build using tmpfs
[ -z "$(stat --printf "%d\n" . tmpfs | uniq -u)" ] && mount -t tmpfs -o "$LB_KANOTIX_TMPFS_OPTIONS" tmpfs tmpfs
cd tmpfs
# delete everything except cache and *.iso
find . -maxdepth 1 ! -name cache ! -name '*.iso' -exec rm -r '{}' \; 2>/dev/null
# copy everything to tmpfs
rsync -a .. . --exclude=tmpfs --exclude '*.iso'
# build
prebuild
time lb build noauto "${@}" 2>&1 | tee binary.log
postbuild
cd ..
else
prebuild
time lb build noauto "${@}" 2>&1 | tee binary.log
postbuild
fi
exit 1
|