From 141021826ecf04295a1fc1c1e38e1bad2b9a1be7 Mon Sep 17 00:00:00 2001 From: Jaden Weiss Date: Sun, 12 Nov 2017 22:53:18 -0500 Subject: [PATCH] fix LPKGDIR not set warning and fix removal process --- lpkg.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lpkg.sh b/lpkg.sh index 20c91d6..32754f4 100755 --- a/lpkg.sh +++ b/lpkg.sh @@ -206,6 +206,7 @@ setup() { fail "lpkg.conf is missing" 3 fi . "$LPKGDIR/lpkg.conf" + export LPKGDIR tmpdir=$(mktemp -d) || return 2 } @@ -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 @@ -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