blob: 6f5119515a802410c7da6c67580418296d689ca4 (
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
|
#!/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)
declare -A KANOTIX_CODENAME
KANOTIX_CODENAMES[lenny]=Excalibur;
KANOTIX_CODENAMES[squeeze]=Hellfire;
KANOTIX_CODENAMES[wheezy]=Dragonfire;
KANOTIX_CODENAME=${KANOTIX_CODENAMES[$LB_DISTRIBUTION]}
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 ${KANOTIX_CODENAMES[@]}|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()
{
# Include nvidia-driver into chroot
if [ "$LB_KANOTIX_NVIDIA" = "true" -a -f config/chroot_local-includes/usr/local/bin/install-nvidia-debian.sh ]; then
mkdir -p config/chroot_local-includes/usr/src
VER="$(grep -o ^VER=.* config/chroot_local-includes/usr/local/bin/install-nvidia-debian.sh|sed s/VER=//)"
ARCH=; [ "$LB_ARCHITECTURE" = "amd64" ] && ARCH="_64"
URL="http://download.nvidia.com/XFree86/Linux-x86$ARCH/$VER/NVIDIA-Linux-x86$ARCH-$VER.run"
if [ "$LB_CACHE" = "false" ]; then
wget -N -P config/chroot_local-includes/usr/src "$URL"
else
mkdir -p cache
wget -N -P cache "$URL"
cp "cache/$(basename "$URL")" "config/chroot_local-includes/usr/src/$(basename "$URL")"
fi
fi
# 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
if [ -d cache/stages_bootstrap ]; then
bsbit=$(file cache/stages_bootstrap/bin/true | grep -q "ELF 64-bit" && echo 64 || echo 32)
mv cache/stages_bootstrap cache/stages_bootstrap$bsbit
fi
[ -d cache/stages_bootstrap$bit ] && mv cache/stages_bootstrap$bit cache/stages_bootstrap
rm -f kanotix$bit.iso
echo "LB_SYSLINUX_MENU_LIVE_ENTRY=\"$LABEL\"" >> config/binary
}
postbuild()
{
[ -d cache/stages_bootstrap ] && mv cache/stages_bootstrap cache/stages_bootstrap$bit
[ -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
find . -maxdepth 1 ! -name cache -exec rm -r '{}' \; 2>/dev/null
# copy everything to tmpfs
rsync -a .. . --exclude=tmpfs
# 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
|