From 63effa3927bac7ea54057186d2b8ab61fbdc6b9f Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 11 Sep 2021 17:06:48 +0200 Subject: [PATCH] kernel.sh: Add fileExist helper function --- kernel.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel.sh b/kernel.sh index e036e8b..4de1ffe 100755 --- a/kernel.sh +++ b/kernel.sh @@ -53,6 +53,14 @@ cdSafe() fi } +fileExist() +{ + if [ ! -f "$1" ] ; then + echo "${b}${red}Error:${n} no such file or directory: $1" >&2 + exit 1 + fi +} + checkDependencies() { dependencies=" @@ -76,14 +84,14 @@ build() rm -rf "./linux" asp update linux asp export linux - [ -f linux/config ] && mv linux/config . - [ -f linux/PKGBUILD ] && mv linux/PKGBUILD . + fileExist linux/config && mv linux/config . + fileExist linux/PKGBUILD && mv linux/PKGBUILD . rm -rf "./linux" patch --forward --strip=1 config < ../patch/config.patch patch --forward --strip=1 PKGBUILD < ../patch/pkgbuild.patch - ln -s ../patch/i2c-hid-disable-incomplete-reports.patch . + ln -s ../patch/i2c-hid-disable-incomplete-reports.patch . 2> /dev/null updpkgsums