Skip to content

Commit

Permalink
fix LPKGDIR not set warning and fix removal process
Browse files Browse the repository at this point in the history
  • Loading branch information
niaow committed Nov 13, 2017
1 parent af9e951 commit 1410218
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ setup() {
fail "lpkg.conf is missing" 3
fi
. "$LPKGDIR/lpkg.conf"
export LPKGDIR
tmpdir=$(mktemp -d) || return 2
}

Expand Down Expand Up @@ -242,6 +243,7 @@ elif [ "$1" == "update" ]; then
transact $pins || fail "Transaction failed" 3
tmpcleanup
elif [ "$1" == "remove" ]; then
setup || fail "Failed to create temporary directory" 2
opins=$(cat "$LPKGDIR/pins.list") || fail "Failed to read pin list" 2
for i in $@; do
if ! contains $i $opins; then
Expand All @@ -255,9 +257,13 @@ elif [ "$1" == "remove" ]; then
pins="$pins $i"
fi
done
setup || fail "Failed to create temporary directory" 2
transact $pins || fail "Transaction failed" 3
tmpcleanup
(
for i in $pins; do
echo $i
done
) > "$LPKGDIR/pins.list"
elif [ "$1" == "bootstrap" ]; then
if [ $# -lt 5 ]; then
echo "Missing arguments" >&2
Expand Down

0 comments on commit 1410218

Please sign in to comment.