aboutsummaryrefslogtreecommitdiffstats
path: root/packageinstall.sh
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2021-04-05 20:54:52 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2021-04-05 20:54:52 -0500
commit75830a5018d98c55dd7157507cc18fc3c2aa774d (patch)
treecfcbb40bc560c230ad1d12cffdfe7ab4710361f7 /packageinstall.sh
parent56dbd9d14e01fc4e4d4987a047f952ffa57f7777 (diff)
Add a block to exit if package does not exist in packages.csv.
Diffstat (limited to 'packageinstall.sh')
-rw-r--r--packageinstall.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/packageinstall.sh b/packageinstall.sh
index a277e6c..88876ac 100644
--- a/packageinstall.sh
+++ b/packageinstall.sh
@@ -3,16 +3,24 @@
CHAPTER="$1"
PACKAGE="$2"
+if ! grep "^${PACKAGE}" packages.csv; then
+ printf "%b" " ${IRED}PACKAGE ${IYLW}${PACKAGE} ${IRED}DOES NOT EXIST!${RST}\n"
+ exit 1
+fi
+
if [[ -f "${LFS}/sources/chapter${CHAPTER}/${PACKAGE}" ]]; then
printf "%b" "${GRN}Package ${YLW}${PACKAGE} ${GRN}already built and installed${RST}\n"
else
grep -i "^${PACKAGE}" packages.csv | grep -i -v "\.patch;" | while read -r line; do
- VERSION="$(echo "$line" | cut -d\, -f2)"
- URL="$(echo "$line" | cut -d\, -f3 | sed "s/@/${VERSION}/g")"
+ VERSION="$(echo "${line}" | cut -d\, -f2)"
+ URL="$(echo "${line}" | cut -d\, -f3 | sed "s/@/${VERSION}/g")"
CACHEFILE="$(basename "${URL}")"
DIRNAME="$(tar -tf "${CACHEFILE}" | sed -e 's@/.*@@' | uniq)"
+ echo $NAME
+ exit 1
+
# Remove existing if exists
rm -rf "${DIRNAME}"
@@ -48,4 +56,5 @@ else
popd > /dev/null || return 1
done
+
fi