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

1.1     ! root        1: #!/bin/sh 
        !             2: # TrueCrypt install script
        !             3: 
        !             4: BIN_DIR=/usr/local/bin
        !             5: MAN_DIR=/usr/local/man
        !             6: MOD_DIR=/lib/modules/$(uname -r)/extra
        !             7: BIN_PERM=750
        !             8: 
        !             9: umask 022
        !            10: 
        !            11: error ()
        !            12: {
        !            13:        echo "Error: $*" >&2
        !            14: }
        !            15: 
        !            16: # Prerequisites
        !            17: 
        !            18: echo "Checking installation requirements..."
        !            19: 
        !            20: [ $(id -u) -ne 0 ] && error "Administrator (root) privileges required" && exit 1
        !            21: 
        !            22: if ! modprobe -V >&- 2>&- || ! rmmod -V >&- 2>&-
        !            23: then
        !            24:        error "modprobe or rmmod not found. TrueCrypt requires kernel module tools."
        !            25:        exit 1
        !            26: fi
        !            27: 
        !            28: if [ ! -c /dev/mapper/control -a ! -L /dev/mapper/control ]
        !            29: then
        !            30:        echo -n "/dev/mapper/control not found - create? [Y/n]: "
        !            31:        read A
        !            32:        if [ "$A" = "" -o "$A" = "y" -o "$A" = "Y" ]
        !            33:        then
        !            34:                mkdir /dev/mapper 2>/dev/null && chmod 755 /dev/mapper
        !            35:                mknod -m 600 /dev/mapper/control c 10 63
        !            36:        fi
        !            37: fi
        !            38: 
        !            39: modprobe dm-mod >&- 2>&-
        !            40: 
        !            41: if ! dmsetup targets >&- 2>&-
        !            42: then
        !            43:        error "TrueCrypt requires device mapper tools (dmsetup) 1.00.08 or later."
        !            44:        exit 1
        !            45: fi
        !            46: 
        !            47: if [ ! -b /dev/loop0 -a ! -b /dev/loop/0 -a ! -b /dev/loop1 ]
        !            48: then
        !            49:        echo -n "No loopback device found - create? [Y/n]: "
        !            50:        read A
        !            51:        if [ "$A" = "y" -o "$A" = "Y" ]
        !            52:        then
        !            53:                for I in 0 1 2 3 4 5 6 7
        !            54:                do
        !            55:                        mknod -m 600 /dev/loop$I b 7 $I
        !            56:                done
        !            57:        fi
        !            58: fi
        !            59: 
        !            60: rmmod truecrypt >&- 2>&-
        !            61: if grep -q "^truecrypt " /proc/modules
        !            62: then
        !            63:        error "Please dismount all mounted TrueCrypt volumes first."
        !            64:        exit 1
        !            65: fi
        !            66: 
        !            67: 
        !            68: # Build
        !            69: 
        !            70: if [ ! -f Kernel/truecrypt.ko -o ! -f Cli/truecrypt ]
        !            71: then
        !            72:        ./build.sh
        !            73:        [ $? -ne -0 ] && error "Build failed - installation aborted" && exit 1
        !            74: fi
        !            75: 
        !            76: 
        !            77: # Test
        !            78: 
        !            79: echo -n "Testing truecrypt... "
        !            80: ./Cli/truecrypt --test >/dev/null 2>/dev/null
        !            81: [ $? -ne -0 ] && echo "FAILED" && exit 1
        !            82: echo Done.
        !            83: 
        !            84: 
        !            85: # Installation
        !            86: 
        !            87: echo
        !            88: echo -n "Install binaries to [$BIN_DIR]: "
        !            89: read A
        !            90: [ "$A" ] && BIN_DIR=$A
        !            91: [ ! -d $BIN_DIR ] && error "$BIN_DIR does not exist" && exit 1
        !            92: 
        !            93: echo -n "Install man page to [$MAN_DIR]: "
        !            94: read A
        !            95: [ "$A" ] && MAN_DIR=$A
        !            96: [ ! -d $MAN_DIR/man1 ] && error "$MAN_DIR/man1 does not exist" && exit 1
        !            97: MAN_DIR=$MAN_DIR/man1
        !            98: 
        !            99: echo -n "Allow non-admin users to run TrueCrypt [y/N]: "
        !           100: read A
        !           101: [ "$A" = "y" ] && BIN_PERM=4755
        !           102: 
        !           103: echo -n "Installing kernel module... "
        !           104: # make "KERNEL_SRC=$KERNEL_SRC" install >/dev/null
        !           105: mkdir $MOD_DIR 2>&-  # some distributions omit extra directory
        !           106: cp Kernel/truecrypt.ko $MOD_DIR && chmod 600 $MOD_DIR/truecrypt.ko && depmod -a
        !           107: [ $? -ne 0 ] && error "Failed to install kernel module" && exit 1
        !           108: echo Done.
        !           109: 
        !           110: echo -n "Installing truecrypt to $BIN_DIR... "
        !           111: cp Cli/truecrypt "$BIN_DIR" && chown root:root "$BIN_DIR/truecrypt" && chmod $BIN_PERM "$BIN_DIR/truecrypt"
        !           112: [ $? -ne 0 ] && error "Failed to install truecrypt" && exit 1
        !           113: echo Done.
        !           114: 
        !           115: echo -n "Installing truecrypt man page to $MAN_DIR... "
        !           116: cp Cli/Man/truecrypt.1 "$MAN_DIR" && chown root:root "$MAN_DIR/truecrypt.1" && chmod 644 "$MAN_DIR/truecrypt.1"
        !           117: [ $? -ne 0 ] && error "Failed to install truecrypt man page" && exit 1
        !           118: echo Done.
        !           119: 
        !           120: exit 0

unix.superglobalmegacorp.com

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