Make shellcheck happy

This commit is contained in:
JeremyStar™ 2024-03-11 00:34:20 +01:00
parent 338835c2e8
commit 075b11ae42
3 changed files with 21 additions and 13 deletions

View file

@ -1,3 +1,6 @@
#!/bin/bash
# shellcheck disable=SC2034 disable=SC2154 disable=SC2155 disable=SC2048 disable=SC2086 disable=SC2295
# ^^^^^ These have been deliberately disabled throughout this entire PKGBUILD, please don't remove them :)
# Maintainer: JeremyStarTM <jeremystartm@staropensource.de>
# Maintainer: Josip Ponjavic <josipponjavic at gmail dot com>
@ -127,7 +130,7 @@ export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EP
prepare() {
echo ":: prepare: prepare() called"
echo ":: prepare: cding into \"${_srcname}\""
cd ${_srcname}
cd "${_srcname}" || exit 1
### Add upstream patches
echo ":: prepare: adding upstream patches"
@ -140,8 +143,8 @@ prepare() {
### Add Clear Linux patches
echo ":: prepare: patching kernel with Clear Linux patches"
for i in $(grep '^Patch' ${srcdir}/cl-linux/linux.spec |\
grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
# shellcheck disable=SC2013
for i in $(grep '^Patch' "${srcdir}"/cl-linux/linux.spec | grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
if [ -n "$_use_llvm_lto" ]; then
if [ "${i}" == "0162-extra-optmization-flags.patch" ] ; then
continue
@ -236,7 +239,7 @@ prepare() {
build() {
echo ":: build: build() called"
echo ":: build: cding into \"${_srcname}\""
cd ${_srcname}
cd "${_srcname}" || exit 1
echo ":: build: starting compilation (make ${BUILD_FLAGS[*]} all)"
make ${BUILD_FLAGS[*]} all
echo ":: build: build() finished"
@ -254,7 +257,7 @@ _package() {
install=linux.install
echo ":: _package: cding into \"${_srcname}\""
cd $_srcname
cd "$_srcname" || exit 1
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
@ -283,7 +286,7 @@ _package-headers() {
depends=(pahole)
echo ":: _package-headers: cding into \"${_srcname}\""
cd ${_srcname}
cd "${_srcname}" || exit 1
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo ":: _package-headers: installing build files"

View file

@ -1,3 +1,6 @@
#!/bin/bash
# shellcheck disable=SC2034 disable=SC2154 disable=SC2155 disable=SC2048 disable=SC2086 disable=SC2295
# ^^^^^ These have been deliberately disabled throughout this entire PKGBUILD, please don't remove them :)
# Maintainer: JeremyStarTM <jeremystartm@staropensource.de>
# Maintainer: Josip Ponjavic <josipponjavic at gmail dot com>
@ -43,7 +46,7 @@ export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EP
prepare() {
echo ":: prepare: prepare() called"
echo ":: prepare: cding into \"${_srcname}\""
cd ${_srcname}
cd "${_srcname}" || exit 1
### Add upstream patches
echo ":: prepare: adding upstream patches"
@ -56,8 +59,8 @@ prepare() {
### Add Clear Linux patches
echo ":: prepare: patching kernel with Clear Linux patches"
for i in $(grep '^Patch' ${srcdir}/cl-linux/linux.spec |\
grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
# shellcheck disable=SC2013
for i in $(grep '^Patch' "${srcdir}"/cl-linux/linux.spec | grep -Ev '^Patch0132|^Patch0118|^Patch0113|^Patch0138|^Patch0139' | sed -n 's/.*: //p'); do
if [ -n "$_use_llvm_lto" ]; then
if [ "${i}" == "0162-extra-optmization-flags.patch" ] ; then
continue
@ -152,7 +155,7 @@ prepare() {
build() {
echo ":: build: build() called"
echo ":: build: cding into \"${_srcname}\""
cd ${_srcname}
cd "${_srcname}" || exit 1
echo ":: build: starting compilation (make ${BUILD_FLAGS[*]} all)"
make ${BUILD_FLAGS[*]} all
echo ":: build: build() finished"
@ -170,7 +173,7 @@ _package() {
install=linux.install
echo ":: _package: cding into \"${_srcname}\""
cd $_srcname
cd "$_srcname" || exit 1
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
@ -199,7 +202,7 @@ _package-headers() {
depends=(pahole)
echo ":: _package-headers: cding into \"${_srcname}\""
cd ${_srcname}
cd "${_srcname}" || exit 1
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo ":: _package-headers: installing build files"

View file

@ -339,6 +339,7 @@ ask_clonedir_conflictresolution
# Pre-building
## Install dependencies
infoh "Installing dependencies"
# shellcheck disable=SC2086
if ! sudo pacman -Syu --asdeps --needed ${BUILDTOOL_PACKAGES}; then
errorh "Installing dependencies failed: pacman returned with non-zero exit code"
exit 1
@ -378,12 +379,13 @@ if [ -n "${BUILDTOOL_DEBUG}" ]; then
echo "+++ env +++"
env|grep "BUILDTOOL_"|sort
echo "+++ env +++"
echo "build cmdline: ${BUILDTOOL_BUILDCMDLINE} "${BUILDTOOL_PKGBUILD_XCONFIG}" "${BUILDTOOL_PKGBUILD_NCONFIG}" "${BUILDTOOL_PKGBUILD_CPFINALCONFIG}" "${BUILDTOOL_PKGBUILD_MODPROBEDDB}" "${BUILDTOOL_PKGBUILD_SUBARCHITECTURE}" "${BUILDTOOL_PKGBUILD_DEBUG}" makepkg --syncdeps -p PKGBUILD.buildtool"
echo "build cmdline: ${BUILDTOOL_BUILDCMDLINE} ${BUILDTOOL_PKGBUILD_XCONFIG} ${BUILDTOOL_PKGBUILD_NCONFIG} ${BUILDTOOL_PKGBUILD_CPFINALCONFIG} ${BUILDTOOL_PKGBUILD_MODPROBEDDB} ${BUILDTOOL_PKGBUILD_SUBARCHITECTURE} ${BUILDTOOL_PKGBUILD_DEBUG} makepkg --syncdeps -p PKGBUILD.buildtool"
echo "cwd: $(pwd)"
fi
# Build package
infoh "Building package"
# shellcheck disable=SC2086
if ! ${BUILDTOOL_BUILDCMDLINE} "${BUILDTOOL_PKGBUILD_XCONFIG}" "${BUILDTOOL_PKGBUILD_NCONFIG}" "${BUILDTOOL_PKGBUILD_CPFINALCONFIG}" "${BUILDTOOL_PKGBUILD_MODPROBEDDB}" "${BUILDTOOL_PKGBUILD_SUBARCHITECTURE}" "${BUILDTOOL_PKGBUILD_DEBUG}" makepkg --syncdeps${BUILDTOOL_MAKEPKG_REUSE} -p PKGBUILD.buildtool; then
errorh "Failed package compilation: makepkg returned with non-zero exit code"
errore "Please report this at \"${BUILDTOOL_ISSUETRACKER}\""