diff options
-rw-r--r-- | packageinstall.sh | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packageinstall.sh b/packageinstall.sh index 03e96b9..3e899a1 100644 --- a/packageinstall.sh +++ b/packageinstall.sh @@ -1,7 +1,7 @@ CHAPTER="$1" PACKAGE="$2" -if [ -f "${LFS_SRC}/chapter${CHAPTER}/${PACKAGE}" ]; then +if [ -f "${LFS}/sources/chapter${CHAPTER}/${PACKAGE}" ]; then echo -e "${GRN}Package ${YLW}${PACKAGE} ${GRN}already built and installed for ${YLW}Chapter ${CHAPTER}.${RST}" else @@ -16,14 +16,20 @@ else fi mkdir -p "${DIRNAME}" - echo -ne "${BLU}Extracting ${YLW}${CACHEFILE}... " - tar -xf "${CACHEFILE}" -C "${DIRNAME}" & pid=$! + echo -ne "${IBLU}Extracting ${YLW}${CACHEFILE}... " + tar xf "${CACHEFILE}" -C "${DIRNAME}" >/dev/null 2>&1 & pid=$! spinner "$pid" + retval=$? + if [ "$retval" -ne 0 ]; then + echo -e "${GRN}Extraction ${RED}FAILED!${RST}" + return $retval + fi + #TOPLEVELDIR = "tar -tf ${CACHEFILE} | sed -e 's@/.*@@' | uniq" pushd "${DIRNAME}" > /dev/null if [ "$(ls -1A | wc -l)" == "1" ]; then - mv $(ls -1A)/* ./ + find */ -mindepth 1 -maxdepth 1 -exec mv -t ./ -- {} + fi echo -ne "\n${CYN}Compiling ${YLW}${PACKAGE}${RST}... " |