From 64d2cf01286880ed088453bdbe934f316b1e505c Mon Sep 17 00:00:00 2001 From: emmett1 Date: Sun, 24 Dec 2017 00:27:52 +0800 Subject: [PATCH] updated --- installpkg | 34 ++++++++++++++++++++-------------- scratch | 2 +- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/installpkg b/installpkg index b9201a9..af2a707 100755 --- a/installpkg +++ b/installpkg @@ -65,23 +65,29 @@ installpkg() { fi #installing package into system - msg2 "Extracting package..." - if [ "$VERBOSE_INSTALL" ]; then - tar --keep-directory-symlink --no-overwrite-dir -p -x -v -f $PKGNAME -C $ROOT_DIR --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} + if [[ $(tar -tf "$PKGNAME") ]]; then + msg2 "Extracting package..." + if [ "$VERBOSE_INSTALL" ]; then + tar --keep-directory-symlink --no-overwrite-dir -p -x -v -f $PKGNAME -C $ROOT_DIR --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} + else + tar --keep-directory-symlink --no-overwrite-dir -p -x -f $PKGNAME -C $ROOT_DIR --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} + fi else - tar --keep-directory-symlink --no-overwrite-dir -p -x -f $PKGNAME -C $ROOT_DIR --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} + msgerr "Package is corrupted. Aborted!" + spkglock + exit 1 fi - if [ $? != 0 ]; then - msgerr "Failed install ${color_red}$packagename${color_reset}." - while IFS=' ' read -r line; do - pushd $ROOT_DIR - rm_silent "$line" || rmdir_silent --ignore-fail-on-non-empty "$line" - popd - done < <(tar -tf "$PKGNAME" --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} | tac) - spkglock - exit 1 - fi + if [ $? != 0 ]; then + msgerr "Failed install ${color_red}$packagename${color_reset}." + while IFS=' ' read -r line; do + pushd $ROOT_DIR + rm_silent "$line" || rmdir_silent --ignore-fail-on-non-empty "$line" + popd + done < <(tar -tf "$PKGNAME" --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} | tac) + spkglock + exit 1 + fi if [ "$UPGRADE_PKG" ] || [ "$REINSTALL_PKG" ]; then removeoldfiles diff --git a/scratch b/scratch index e11ded4..3849750 100755 --- a/scratch +++ b/scratch @@ -91,7 +91,7 @@ searchpkg() { popd if [ ! -z "$name" ] && [ ! -z "$version" ] && [ ! -z "$release" ]; then portname=$(basename $port) - search_result="${color_gray}($portname)${color_reset} ${color_purple}$name${color_reset} ${color_cyan}$version-$release${color_reset}" + search_result="${color_blue}($portname)${color_reset} ${color_purple}$name${color_reset} ${color_cyan}$version-$release${color_reset}" if [ -d $INDEX_DIR/$name ]; then getinstalledname $name if [ "$name-$version-$release" = "$installedname" ]; then