diff options
-rw-r--r-- | packageinstall.sh | 13 |
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 |