From 100fcb554d53a36e60b61a16d7c3b3d20e828dda Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sat, 15 Sep 2018 11:16:24 +0200 Subject: [PATCH] Implemented rpkg. --- src/rpkg | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/rpkg b/src/rpkg index bde2317..6d390fc 100755 --- a/src/rpkg +++ b/src/rpkg @@ -1,4 +1,35 @@ #!/bin/bash -echo "Not yet implemented" -exit 1 +DESTDIR="${FPKG_ROOT}/" +RC=0 + +if [ $# -ne 1 ] +then + echo "Did not specify exactly one argument" + exit 1 +fi + +files=$(lpkg "$1" | tac -) +if [ $? -ne 0 ] +then + echo $files + exit 1 +fi + +cd "$DESTDIR" +for file in $files +do + if [ -d "$file" ] + then + out=$(rmdir -v "$file" 2>&1) + [ $? -eq 0 ] && echo $out + elif [ -e "$file" ] + then + rm -vf "$file" + else + echo "File $file not found." + RC=1 + fi +done + +exit $RC