From d14b8b86f6ee002876fd6bfc85bb2960b064b452 Mon Sep 17 00:00:00 2001 From: emmett1 Date: Sun, 24 Sep 2017 01:03:08 +0800 Subject: [PATCH] updated --- installpkg | 36 ++++++++++++++++++------------------ scratch | 16 ---------------- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/installpkg b/installpkg index 6ebea54..456ce32 100755 --- a/installpkg +++ b/installpkg @@ -70,11 +70,11 @@ installpkg() { if [ $? != 0 ]; then msgerr "Failed install ${color_red}$packagename${color_reset}." - pushd $ROOT_DIR while IFS=' ' read -r line; do - rm_silent "$line" || rmdir_silent --ignore-fail-on-non-empty "$line" + 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) - popd spkglock exit 1 fi @@ -199,13 +199,13 @@ checkpkgconflict() { checkconflict() { - pushd $ROOT_DIR - while IFS=' ' read -r line; do - if [ -e "$line" ]; then - fileconflict+=(${line}) - fi - done < <(tar -tf "$PKGNAME" --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} | grep -v '/$') - popd + while IFS=' ' read -r line; do + pushd $ROOT_DIR + if [ -e "$line" ]; then + fileconflict+=(${line}) + fi + popd + done < <(tar -tf "$PKGNAME" --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} | grep -v '/$') if [ "${#fileconflict[@]}" -gt 0 ]; then msgerr "File conflict found:" @@ -219,15 +219,15 @@ checkconflict() { upcheckconflict() { - pushd $ROOT_DIR - while IFS=' ' read -r line; do - if [ -e "$line" ]; then - if [ ! "$(grep -Fx "$line" "$INDEX_DIR/$name/.files")" ]; then - fileconflict+=(${line}) - fi + while IFS=' ' read -r line; do + pushd $ROOT_DIR + if [ -e "$line" ]; then + if [ ! "$(grep -Fx "$line" "$INDEX_DIR/$name/.files")" ]; then + fileconflict+=(${line}) fi - done < <(tar -tf "$PKGNAME" --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} | grep -v '/$') - popd + fi + popd + done < <(tar -tf "$PKGNAME" --exclude=.pkginfo --exclude=.pkginstall --exclude=.pkgreadme ${excludefile[@]} | grep -v '/$') if [ "${#fileconflict[@]}" -gt 0 ]; then msgerr "File conflict found:" diff --git a/scratch b/scratch index db2853a..7951f45 100755 --- a/scratch +++ b/scratch @@ -523,14 +523,6 @@ parse_options() { OUTPUT_PKG="$2" shift ;; - --root) - if [ ! "$2" ]; then - msg "Option '$1' require an argument (root path)." - exit 1 - fi - ROOT="$2" - shift - ;; *) msg "Option invalid!" exit 1 @@ -554,14 +546,6 @@ main() { loadconfigfile - # CHANGE ROOT PATH ### - if [ "$ROOT" ]; then - ROOT_DIR="$ROOT" - INDEX_DIR="$ROOT_DIR$INDEX_DIR" - BACKUP_DIR="$ROOT_DIR$BACKUP_DIR" - REJECTED_DIR="$ROOT_DIR$REJECTED_DIR" - fi - ### SHOW PORT PATH ### if [ $PORT_PATH ]; then showportpath