~ubuntu-branches/ubuntu/lucid/dkms/lucid

« back to all changes in this revision

Viewing changes to dkms_autoinstaller

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello, Mario Limonciello, Thomas Chenault
  • Date: 2010-01-25 17:42:40 UTC
  • mfrom: (1.3.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100125174240-nje85ia001tc6ltg
Tags: 2.1.1.1-0ubuntu1
[ Mario Limonciello ]
* dkms_common.postinst: Add some missing quotes around strings used in comparisons
  to make sure that this is safe on more shells.
* Makefile, debian/rules: Only copy the init script in for redhat targets.
* kernel_postinst.d: Make sure that dkms_autoinstaller is executable (LP: #480055)
* Move the architecture mapping logic out of the DKMS template and into
  common.postinst for Ubuntu only. (LP: #497149)
* template-dkms-mkdeb/debian/control: Build-depends on dkms (LP: #506959)

[ Thomas Chenault ]
* Fix parsing in find_external_dependencies(). The existing code behaves improperly 
  when a driver disk module has more than two dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    local exitval=0
35
35
    local exitval_file=`mktemp /tmp/dkms.XXXXXX`
36
36
    if [ "$3" = background ] && [ -z "$verbose" ]; then
37
 
    (eval $1 >/dev/null 2>&1; echo "exitval=$?" >> "$exitval_file") &
38
 
    while [ -e "$exitval_file" ] && ! [ -s "$exitval_file" ]; do
39
 
        sleep 3
40
 
    done
41
 
    . "$exitval_file"
 
37
        (eval $1 >/dev/null 2>&1; echo "exitval=$?" >> "$exitval_file") &
 
38
        while [ -e "$exitval_file" ] && ! [ -s "$exitval_file" ]; do
 
39
            sleep 3
 
40
        done
 
41
        . "$exitval_file"
42
42
    else
43
 
    eval $1; exitval=$?
 
43
        eval $1; exitval=$?
44
44
    fi
45
45
    [ $exitval -gt 0 ] && logger -t dkms_autoinstaller "(bad exit status: $exitval)"
46
46
    rm -f "$exitval_file"
47
47
    return $exitval
48
48
}
49
49
 
50
 
emit_module_status ()
51
 
{
52
 
    #$1 is the signal to emit (successful|failed)
53
 
    #$2 is the module name in question
54
 
    if [ -x /sbin/initctl ]; then
55
 
        initctl emit build-$1 MODULE=$2 2>/dev/null
56
 
    fi
57
 
}
58
 
 
59
50
# Set Variables
60
51
uname=`uname -mr`
61
52
[ -n "$2" ] && kernel=$2
67
58
# See how we were called.
68
59
case "$1" in
69
60
  start)
70
 
    if [ -z "$kernel" ]
71
 
    then
72
 
      if [ -L /vmlinuz -a -e /vmlinuz ]
73
 
      then
74
 
        linktarget="$(basename "$(readlink /vmlinuz)")"
75
 
        kernel="${linktarget##vmlinuz-}"
76
 
      else
77
 
        kernel=${uname% *}
78
 
      fi
79
 
    fi
80
 
 
81
61
    log_daemon_msg "Running DKMS auto installation service for kernel $kernel"
82
62
 
 
63
    if [ -z "$kernel" ]; then
 
64
        if [ -L /vmlinuz -a -e /vmlinuz ]; then
 
65
            linktarget="$(basename "$(readlink /vmlinuz)")"
 
66
            kernel="${linktarget##vmlinuz-}"
 
67
        else
 
68
            kernel=${uname% *}
 
69
        fi
 
70
    fi
 
71
 
83
72
    # Iterate over the modules
84
73
    for modulepath in $(find "$dkms_tree" -maxdepth 1 -mindepth 1 -type d); do
85
74
 
116
105
            log_action_end_msg 1
117
106
            continue
118
107
        elif [ -n "$already_installed" ]; then
119
 
            emit_module_status successful $module_in_tree
120
108
            log_action_end_msg 0
121
109
        elif [ -z "$do_autoinstall" ]; then
122
110
            logger -t dkms_autoinstaller "$module_in_tree ($version_in_tree): AUTOINSTALL not set in its dkms.conf."
123
111
            log_action_end_msg 0
124
112
        elif [ -n "$do_autoinstall" ] && [ "$version_count" -gt 1 ]; then
125
113
            logger -t dkms_autoinstaller "$module_in_tree: Multiple versions in DKMS. Unsure what to do. Resolve manually."
126
 
            emit_module_status failed $module_in_tree
127
114
            log_action_end_msg 1
128
115
        else
129
116
            logger -t dkms_autoinstaller "$module_in_tree ($version_in_tree): Installing module on kernel $kernel."
143
130
                fi
144
131
                if [ "$return_status" -eq 0 ]; then
145
132
                    invoke_command "dkms install -m $module_in_tree -v $version_in_tree -k $kernel -a $arch" "." background
146
 
                    emit_module_status successful $module_in_tree
147
133
                    log_action_end_msg 0
148
134
                else
149
135
                    logger -t dkms_autoinstaller "  Build failed.  Installation skipped."
150
 
                    emit_module_status failed $module_in_tree
151
136
                    log_action_end_msg 1
152
137
                fi
153
138
            else
154
139
                invoke_command "dkms install -m $module_in_tree -v $version_in_tree -k $kernel -a $arch -q" "." background
155
140
                return_status=$?
156
141
                if [ "$return_status" -eq 0 ]; then
157
 
                    emit_module_status successful $module_in_tree
158
142
                elif [ "$return_status" -eq 101 ]; then
159
143
                    logger -t dkms_autoinstaller "  A newer module version than this already exists in kernel."
160
144
                    logger -t dkms_autoinstaller "  Skipping install... (you can manually install later with --force)"
161
 
                    emit_module_status successful $module_in_tree
162
145
                elif [ "$return_status" -ne 0 ]; then
163
146
                    logger -t dkms_autoinstaller "  Installation failed!"
164
 
                    emit_module_status failed $module_in_tree
165
147
                fi
166
148
            fi
167
149
        fi