Annotation of truecrypt/linux/install.sh, revision 1.1.1.6

1.1.1.6 ! root        1: #!/bin/bash 
1.1.1.5   root        2: #
                      3: # Copyright (c) TrueCrypt Foundation. All rights reserved.
                      4: #
1.1.1.6 ! root        5: # Covered by the TrueCrypt License 2.3 the full text of which is contained
1.1.1.5   root        6: # in the file License.txt included in TrueCrypt binary and source code
                      7: # distribution packages.
                      8: #
1.1       root        9: 
1.1.1.4   root       10: BIN_DIR=/usr/bin
                     11: MAN_DIR=/usr/share/man
                     12: SHARE_DIR=/usr/share/truecrypt
                     13: SHARE_DIR_DEF=$SHARE_DIR
1.1       root       14: MOD_DIR=/lib/modules/$(uname -r)/extra
1.1.1.2   root       15: BIN_PERM=755
1.1       root       16: 
                     17: umask 022
                     18: 
                     19: error ()
                     20: {
                     21:        echo "Error: $*" >&2
                     22: }
                     23: 
                     24: # Prerequisites
                     25: 
                     26: echo "Checking installation requirements..."
                     27: 
                     28: [ $(id -u) -ne 0 ] && error "Administrator (root) privileges required" && exit 1
                     29: 
                     30: if ! modprobe -V >&- 2>&- || ! rmmod -V >&- 2>&-
                     31: then
                     32:        error "modprobe or rmmod not found. TrueCrypt requires kernel module tools."
                     33:        exit 1
                     34: fi
                     35: 
                     36: if [ ! -c /dev/mapper/control -a ! -L /dev/mapper/control ]
                     37: then
                     38:        echo -n "/dev/mapper/control not found - create? [Y/n]: "
                     39:        read A
                     40:        if [ "$A" = "" -o "$A" = "y" -o "$A" = "Y" ]
                     41:        then
                     42:                mkdir /dev/mapper 2>/dev/null && chmod 755 /dev/mapper
                     43:                mknod -m 600 /dev/mapper/control c 10 63
                     44:        fi
                     45: fi
                     46: 
1.1.1.3   root       47: lsmod | grep -q ^dm_mod
                     48: [ $? -ne 0 ] && modprobe dm-mod >&- 2>&- && sleep 1
1.1       root       49: 
1.1.1.3   root       50: if ! dmsetup targets >&-
1.1       root       51: then
                     52:        error "TrueCrypt requires device mapper tools (dmsetup) 1.00.08 or later."
                     53:        exit 1
                     54: fi
                     55: 
1.1.1.5   root       56: if ! which losetup >/dev/null
                     57: then
                     58:        echo "Warning: losetup command not found - mounting of containers may fail."
                     59: fi
                     60: 
1.1       root       61: if [ ! -b /dev/loop0 -a ! -b /dev/loop/0 -a ! -b /dev/loop1 ]
                     62: then
                     63:        echo -n "No loopback device found - create? [Y/n]: "
                     64:        read A
1.1.1.5   root       65:        if [ "$A" != "n" -a "$A" != "N" ]
1.1       root       66:        then
                     67:                for I in 0 1 2 3 4 5 6 7
                     68:                do
                     69:                        mknod -m 600 /dev/loop$I b 7 $I
                     70:                done
                     71:        fi
                     72: fi
                     73: 
                     74: rmmod truecrypt >&- 2>&-
                     75: if grep -q "^truecrypt " /proc/modules
                     76: then
                     77:        error "Please dismount all mounted TrueCrypt volumes first."
                     78:        exit 1
                     79: fi
                     80: 
                     81: 
                     82: # Build
                     83: 
                     84: if [ ! -f Kernel/truecrypt.ko -o ! -f Cli/truecrypt ]
                     85: then
                     86:        ./build.sh
                     87:        [ $? -ne -0 ] && error "Build failed - installation aborted" && exit 1
                     88: fi
                     89: 
                     90: 
                     91: # Test
                     92: 
                     93: echo -n "Testing truecrypt... "
                     94: ./Cli/truecrypt --test >/dev/null 2>/dev/null
1.1.1.2   root       95: [ $? -ne 0 ] && echo "FAILED" && exit 1
1.1       root       96: echo Done.
                     97: 
                     98: 
                     99: # Installation
                    100: 
                    101: echo
                    102: echo -n "Install binaries to [$BIN_DIR]: "
                    103: read A
                    104: [ "$A" ] && BIN_DIR=$A
1.1.1.3   root      105: [ ! -d "$BIN_DIR" ] && error "$BIN_DIR does not exist" && exit 1
1.1       root      106: 
                    107: echo -n "Install man page to [$MAN_DIR]: "
                    108: read A
                    109: [ "$A" ] && MAN_DIR=$A
1.1.1.3   root      110: [ ! -d "$MAN_DIR/man1" ] && error "$MAN_DIR/man1 does not exist" && exit 1
1.1       root      111: MAN_DIR=$MAN_DIR/man1
                    112: 
1.1.1.4   root      113: echo -n "Install user guide and kernel module to [$SHARE_DIR]: "
                    114: read A
                    115: [ "$A" ] && SHARE_DIR=$A
                    116: mkdir -p "$SHARE_DIR/doc" 2>&- || exit 1
                    117: 
                    118: 
1.1       root      119: echo -n "Installing kernel module... "
                    120: # make "KERNEL_SRC=$KERNEL_SRC" install >/dev/null
1.1.1.3   root      121: mkdir "$MOD_DIR" 2>&-  # some distributions omit extra directory
                    122: cp Kernel/truecrypt.ko "$MOD_DIR" && chmod 600 $MOD_DIR/truecrypt.ko && depmod -a
1.1       root      123: [ $? -ne 0 ] && error "Failed to install kernel module" && exit 1
                    124: echo Done.
                    125: 
                    126: echo -n "Installing truecrypt to $BIN_DIR... "
                    127: cp Cli/truecrypt "$BIN_DIR" && chown root:root "$BIN_DIR/truecrypt" && chmod $BIN_PERM "$BIN_DIR/truecrypt"
                    128: [ $? -ne 0 ] && error "Failed to install truecrypt" && exit 1
                    129: echo Done.
                    130: 
1.1.1.4   root      131: echo -n "Installing man page to $MAN_DIR... "
1.1       root      132: cp Cli/Man/truecrypt.1 "$MAN_DIR" && chown root:root "$MAN_DIR/truecrypt.1" && chmod 644 "$MAN_DIR/truecrypt.1"
                    133: [ $? -ne 0 ] && error "Failed to install truecrypt man page" && exit 1
                    134: echo Done.
                    135: 
1.1.1.4   root      136: echo -n "Installing user guide to $SHARE_DIR/doc... "
1.1.1.5   root      137: cp ../License.txt "$SHARE_DIR/doc" || exit 1
                    138: cp "../Release/Setup Files/TrueCrypt User Guide.pdf" "$SHARE_DIR/doc/TrueCrypt-User-Guide.pdf" 
1.1.1.4   root      139: [ $? -ne 0 ] && error "Failed to install truecrypt user guide" && exit 1
                    140: chmod 644 "$SHARE_DIR/doc/License.txt" "$SHARE_DIR/doc/TrueCrypt-User-Guide.pdf"
                    141: echo Done.
                    142: 
                    143: if [ "$SHARE_DIR" = "$SHARE_DIR_DEF" ]
                    144: then
                    145:        echo -n "Installing backup kernel module to $SHARE_DIR/kernel... "
                    146:        mkdir -p "$SHARE_DIR/kernel" 2>&-
                    147:        M=$SHARE_DIR/kernel/truecrypt-$(uname -r | cut -d- -f1 | cut -d. -f1-3).ko
                    148:        cp Kernel/truecrypt.ko "$M" || exit 1
                    149:        echo Done.
                    150: fi
                    151: 
1.1       root      152: exit 0

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.