mirror of
https://github.com/terrapkg/packages.git
synced 2026-06-12 14:40:39 +00:00
592fd5e311
* Attempt to fix sbctl
* debug: enable xtrace in verbosity
* bump package release
* Also add removal script
(cherry picked from commit bbca6283c4)
Co-authored-by: Pornpipat Popum <cappy@cappuchino.xyz>
42 lines
982 B
Bash
42 lines
982 B
Bash
#!/usr/bin/sh
|
|
# This file is part of sbctl.
|
|
# Patched for Fedora, for the Terra repository
|
|
|
|
#shellcheck disable=SC2034
|
|
# Enable xtrace if we're verbose
|
|
if [ "${KERNEL_INSTALL_VERBOSE:-0}" = "1" ]; then
|
|
set -x
|
|
fi
|
|
|
|
ver=${1}
|
|
img=${2}
|
|
|
|
|
|
die() {
|
|
echo -e " ${NOCOLOR-\e[1;31m*\e[0m }${*}" >&2
|
|
exit 1
|
|
}
|
|
|
|
einfo() {
|
|
echo -e " ${NOCOLOR-\e[1;32m*\e[0m }${*}"
|
|
}
|
|
|
|
main() {
|
|
# re-define for subst to work
|
|
[[ -n ${NOCOLOR+yes} ]] && NOCOLOR=
|
|
einfo "Unregistering kernel file from sbctl"
|
|
# do nothing if secureboot key directory doesn't exist
|
|
if ! [ "$(sbctl setup --print-state --json | awk '/installed/ { gsub(/,$/,"",$2); print $2 }')" = "true" ]; then
|
|
einfo "Secureboot key directory doesn't exist, not signing!"
|
|
exit 0
|
|
fi
|
|
|
|
[[ ${EUID} -eq 0 ]] || die "Please run this script as root"
|
|
|
|
einfo "sbctl: Unregistering kernel $img"
|
|
sbctl remove-file $img
|
|
}
|
|
|
|
main
|
|
|