Skip to content

Commit

Permalink
add remove command
Browse files Browse the repository at this point in the history
  • Loading branch information
niaow committed Nov 8, 2017
1 parent 91fef53 commit fb1ff20
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,23 @@ elif [ "$1" == "update" ]; then
pins=$(cat "$LPKGDIR/pins.list") || fail "Failed to read pin list" 2
transact $pins || fail "Transaction failed" 3
tmpcleanup
elif [ "$1" == "remove" ]; then
opins=$(cat "$LPKGDIR/pins.list") || fail "Failed to read pin list" 2
for i in $@; do
if ! contains $i $opins; then
tmpcleanup
fail "$i is not pinned" 1
fi
done
pins=
for i in $opins; do
if ! contains $i $@; then
pins="$pins $i"
fi
done
setup || fail "Failed to create temporary directory" 2
transact $pins || fail "Transaction failed" 3
tmpcleanup
elif [ "$1" == "bootstrap" ]; then
if [ $# -lt 5 ]; then
echo "Missing arguments" >&2
Expand Down

0 comments on commit fb1ff20

Please sign in to comment.