| 1 | #!/bin/bash |
| 2 | |
| 3 | # module-assistant and dkms nowadays automatically want to sign the module |
| 4 | # this has to be prepared, so /usr/share/modass/module-assistant-autopkgtest |
| 5 | # can not be called directly anymore |
| 6 | |
| 7 | ls -l /usr/src |
| 8 | HEADERDIR=/usr/src/`ls -1 /usr/src/|grep linux-headers|grep -v common` |
| 9 | echo "I: HEADERDIR=$HEADERDIR" |
| 10 | |
| 11 | # these two directories are expected |
| 12 | mkdir -p $HEADERDIR/certs |
| 13 | mkdir -p $HEADERDIR/output |
| 14 | |
| 15 | echo -e "[ req ] \n\ |
| 16 | default_bits = 4096 \n\ |
| 17 | distinguished_name = debian-autopkgtest \n\ |
| 18 | prompt = no \n\ |
| 19 | x509_extensions = myexts \n\ |
| 20 | \n\ |
| 21 | [ debian-autopkgtest ] \n\ |
| 22 | CN = Modules \n\ |
| 23 | \n\ |
| 24 | [ myexts ] \n\ |
| 25 | basicConstraints=critical,CA:FALSE \n\ |
| 26 | keyUsage=digitalSignature \n\ |
| 27 | subjectKeyIdentifier=hash \n\ |
| 28 | authorityKeyIdentifier=keyid" > x509.genkey |
| 29 | |
| 30 | /usr/bin/openssl req -new -nodes -utf8 -sha512 -days 36500 -batch -x509 -config x509.genkey -outform DER -out signing_key.x509 -keyout signing_key.pem |
| 31 | |
| 32 | # I have no idea why the key has to be in both, but this is working now |
| 33 | cp signing_key.pem signing_key.x509 $HEADERDIR/output |
| 34 | mv signing_key.pem signing_key.x509 $HEADERDIR/certs |
| 35 | |
| 36 | /usr/share/modass/module-assistant-autopkgtest dahdi |
| 37 | |
| 38 | exit 0 |