Skip to content

Commit

Permalink
add kernel sign
Browse files Browse the repository at this point in the history
  • Loading branch information
henglinli committed May 17, 2018
1 parent 2364548 commit 701aa2a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions etc/kernel/install.d/98-sbsign.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

COMMAND="$1"
KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"

if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
exit 0
fi

if ! [[ -d "$BOOT_DIR_ABS" ]]; then
exit 0
fi

MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID

BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}

LINUX="$BOOT_DIR_ABS/linux"

if [[ $COMMAND == remove ]]; then
exit 0
fi

if ! [[ $COMMAND == add ]]; then
exit 1
fi

if ! [[ $KERNEL_IMAGE ]]; then
exit 1
fi


if [[ -f .config ]]; then
echo "sbsign $LINUX"
sbsign --key /etc/efikeys/db.key --cert /etc/efikeys/db.crt --output $LINUX $LINUX
fi

exit 0

0 comments on commit 701aa2a

Please sign in to comment.