|
|
1.1 root 1: #!/bin/sh
2: # TrueCrypt build script
3:
4: KERNEL_SRC=/usr/src/linux-$(uname -r)
5:
6: umask 022
7:
8: error ()
9: {
10: echo "Error: $*" >&2
11: }
12:
13: check_kernel_version ()
14: {
15: M="$1/Makefile"
16: VER=$(grep '^VERSION *=' "$M" | head -1 | tr -d ' ' | cut -d'=' -f2)
17: VER=$VER.$(grep '^PATCHLEVEL *=' "$M" | head -1 | tr -d ' ' | cut -d'=' -f2)
18: VER=$VER.$(grep '^SUBLEVEL *=' "$M" | head -1 | tr -d ' ' | cut -d'=' -f2)
19:
20: [ $VER = $( uname -r | tr -- - . | cut -d. -f1-3) ] && return 0
21: return 1
22: }
23:
24: # Prerequisites
25:
26: echo "Checking build requirements..."
27:
28: [ $(id -u) -ne 0 ] && error "Administrator (root) privileges required" && exit 1
29:
30: V=""
31: case "$(uname -r)" in
32: [01].*) V=1 ;;
33: 2.[0-5].*) V=1 ;;
34: 2.6.[0-4]) V=1 ;;
35: 2.6.[0-4][.-]*) V=1 ;;
36: esac
37: [ "$V" ] && error "TrueCrypt requires Linux kernel 2.6.5 or later" && exit 1
38:
39: [ ! -d $KERNEL_SRC ] && KERNEL_SRC=/usr/src/linux
40: if [ ! -d $KERNEL_SRC ] || ! check_kernel_version "$KERNEL_SRC"
41: then
42: echo -n "Linux kernel ($(uname -r)) source directory [$KERNEL_SRC]: "
43: read A
44: [ "$A" ] && KERNEL_SRC="$A"
45: [ ! -d $KERNEL_SRC ] && error "$KERNEL_SRC does not exit" && exit 1
46: fi
47:
48: if ! check_kernel_version "$KERNEL_SRC"
49: then
50: error "Kernel source version in $KERNEL_SRC is not $(uname -r)"
51: exit 1
52: fi
53:
54: if [ ! -f "$KERNEL_SRC/.config" ]
55: then
56: error "Kernel not configured. You should run make -C $KERNEL_SRC config modules"
57: exit 1
58: fi
59:
60: grep -qi 'CONFIG_BLK_DEV_DM=N' $KERNEL_SRC/.config && echo "Warning: kernel device mapper support (CONFIG_BLK_DEV_DM) is disabled in $KERNEL_SRC" && sleep 5
61:
62:
63: # Build
64:
65: echo -n "Building kernel module... "
66: cd Kernel && make "KERNEL_SRC=$KERNEL_SRC" NO_WARNINGS=1 >/dev/null
67: [ $? -ne 0 ] && error "Failed to build kernel module" && exit 1
68: echo Done.
69:
70: echo -n "Building truecrypt... "
71: cd ../Cli && make NO_WARNINGS=1 >/dev/null
72: [ $? -ne 0 ] && error "Failed to build truecrypt" && exit 1
73: echo Done.
74:
75: exit 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.