Skip to content

Commit

Permalink
Added check_gcc_config_and_reset_if_necessary function,
Browse files Browse the repository at this point in the history
since the gcc-config not being set correctly (or getting
unset after an @world upgrade / depclean) appears to cause
quite a lot of hard-to-track-down problems.
  • Loading branch information
sakaki- committed Nov 4, 2014
1 parent cb73887 commit 24d69eb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
27 changes: 26 additions & 1 deletion buildkernel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ shopt -s nullglob
# ********************** variables *********************
PROGNAME="$(basename "${0}")"
CONFFILE="/etc/${PROGNAME}.conf"
VERSION="1.0.8"
VERSION="1.0.9"
ETCPROFILE="/etc/profile"
DEFAULTEFIBOOTFILE="bootx64.efi"
EFIBOOTFILE="${DEFAULTEFIBOOTFILE}"
NEWVERSION="$(basename $(realpath "/usr/src/linux"))"
Expand Down Expand Up @@ -227,6 +228,29 @@ check_file_exists() {
die "File '${1}' does not exist"
fi
}
check_gcc_config_and_reset_if_necessary() {
# check if gcc-config exists with an error - if it does, then
# attempt to set one based on the current gcc version number
if ! gcc-config --get-current-profile >/dev/null 2>&1; then
# unset or invalid, attempt to force this to the current gcc
# version
local GCC_VERSION="$(gcc --version | head -n 1 | sed 's/^.* //')"
if gcc-config "${GCC_VERSION}"; then
warning "gcc configuration was reset"
if [ -s "${ETCPROFILE}" ]; then
set +e
set +u
shopt -u nullglob
source "${ETCPROFILE}"
shopt -s nullglob
set -e
set -u
fi
else
die "failed to set gcc configuration"
fi
fi
}
mount_and_remember() {
local DEVPATH="${1}"
local MOUNTPOINT="${2}"
Expand Down Expand Up @@ -1932,6 +1956,7 @@ source_etc_conf_file
process_command_line_options "${@}"
ask_whether_to_proceed

check_gcc_config_and_reset_if_necessary
if_option_unset "ARG_STAGEONLY" ensure_efi_partition_mounted
if ((ARG_COPYFROMSTAGING==0)); then
enter_build_directory
Expand Down
2 changes: 1 addition & 1 deletion buildkernel.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH BUILDKERNEL 8 "Version 1.0.8: November 2014"
.TH BUILDKERNEL 8 "Version 1.0.9: November 2014"
.SH NAME
buildkernel \- build secure boot kernel, save to EFI system partition
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion buildkernel.conf.5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH BUILDKERNEL 5 "Version 1.0.8: November 2014"
.TH BUILDKERNEL 5 "Version 1.0.9: November 2014"
.SH NAME
buildkernel.conf \- a configuration file for \fBbuildkernel\fR(8)
.SH SYNOPSIS
Expand Down

0 comments on commit 24d69eb

Please sign in to comment.