This file is indexed.

/usr/src/dahdi-2.10.2~dfsg-1ubuntu1/build_tools/dkms-helper is in dahdi-dkms 1:2.10.2~dfsg-1ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash

set -e

DKMS=$(which dkms)

usage() {
    echo "$(basename $0): Helper functions for DKMS (Dynamic Kernel Module Support)"
    echo "Usage: $0 [add|remove|generate_conf]"
    echo "Options:"
    echo "   remove -a  : Remove all versions of DAHDI for all kernels."
    echo ""
    echo "Examples:"
    echo ""
    echo "  build_tools/dkms-helper add"
    echo "            Installs the current version of DAHDI into the DKMS system."
    echo ""
    echo "  build_tools/dkms-helper remove"
    echo "            Removes the current version of DAHDI from all kernels."
    echo ""
    echo "  build_tools/dkms-helper generate_conf > dkms.conf"
    echo "            Create a dkms.conf based on the currently compiled kernel"
    echo "            modules. This is also done as part of add and is not"
    echo "            normally needed as a separate step."
    echo ""
    echo "NOTE: Because firmware files could be different between different"
    echo "versions of DAHDI, and the firmware files are installed into the common"
    echo "/lib/firmware directory, you should remove a given version of DAHDI from all"
    echo "kernels before installing a new version of DAHDI to avoid potential"
    echo "conflicts."
    echo ""
}

generate_configuration() {
    echo 'PACKAGE_NAME="dahdi-linux"'
    echo "PACKAGE_VERSION=\"$(build_tools/make_version .)\""
    echo 'MAKE="make KSRC=/lib/modules/${kernelver}/build"'
    echo 'CLEAN="make clean"'
    echo 'AUTOINSTALL="yes"'
    let "module_number=0" || true
    for file in $(find ./ -type f -name "*.ko"); do
        MODULE_LOCATION=$(dirname $file | cut -d\/ -f 2-)
        echo "BUILT_MODULE_NAME[$module_number]=\"$(basename $file .ko)\""
        echo "BUILT_MODULE_LOCATION[$module_number]=\"$MODULE_LOCATION\""
        echo "DEST_MODULE_LOCATION[$module_number]=\"/kernel/dahdi/$(echo $MODULE_LOCATION | cut -d\/ -f 3-)\""
        let "module_number=${module_number}+1" || true
    done
    if [ $module_number -eq 0 ]; then
        echo "WARNING: You should build the modules before generating a config." >&2
        exit 1
    fi
}

add() {
    GIT=$(which git)
    VERSION="$(build_tools/make_version .)"
    if [ $(id -u) != "0" ]; then
        echo "You must run $0 as root."
        exit 1
    fi
    echo "Building for version ${VERSION}"
    make > /dev/null
    echo "Copying to /usr/src/dahdi-linux-${VERSION}"
    if [ ! -d /usr/src/dahdi-linux-${VERSION} ]; then
        if [ -d .git ]; then
            ${GIT} checkout-index -a --prefix=/usr/src/dahdi-linux-${VERSION}/
        else
            cp -f -r * /usr/src/dahdi-linux-${VERSION}/
        fi
    fi
    make -C /usr/src/dahdi-linux-${VERSION} install-firmware firmware-loaders
    build_tools/dkms-helper generate_conf > /usr/src/dahdi-linux-${VERSION}/dkms.conf
    echo $VERSION > /usr/src/dahdi-linux-${VERSION}/.version
    ${DKMS} add -m dahdi-linux -v ${VERSION}
    ${DKMS} build -m dahdi-linux -v ${VERSION}
    ${DKMS} install --force -m dahdi-linux -v ${VERSION}
}

remove() {
    if [ $(id -u) != "0" ]; then
        echo "You must run $0 as root."
        exit 1
    fi
    REMOVE_ALL=false
    shift
    while getopts "a" opt; do
        case $opt in
        a) REMOVE_ALL=true ;;
        *) echo "Unknown option to remove" ; exit 1;;
        esac    
    done
    if [ $REMOVE_ALL == true ]; then
        # Remove all installed dahdi versions for all kernels.
        for version in $(${DKMS} status -m dahdi-linux | cut -d, -f 2 | sed -e "s/^\s\+//"); do
	    echo "Removing version ${version}"
            ${DKMS} remove -m dahdi-linux -v ${version} --all
	    rm -f -r /usr/src/dahdi-linux-${version}
        done
    else
        # Just remove the version for the current tree.
        GIT=$(which git)
        VERSION="$(build_tools/make_version .)"
        ${DKMS} remove -m dahdi-linux -v ${VERSION} --all
        if [ -e /usr/src/dahdi-linux-${VERSION}/dkms.conf ]; then
            rm -f -r /usr/src/dahdi-linux-${VERSION}
        else
            echo "/usr/src/dahdi-linux-${VERSION} not a dkms dir?"
            exit 1
        fi
    fi
}

# Run the command...
shift $(($OPTIND-1))
COMMAND=$1
case $COMMAND in 
    add) add $*; exit $? ;;
    remove) remove $* ; exit $? ;; 
    generate_conf) generate_configuration; exit $? ;;
    *) echo "unknown command $0" ; usage; exit 1;;
esac

exit 0