aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rwxr-xr-xdemeta36
2 files changed, 38 insertions, 0 deletions
diff --git a/README b/README
index 5ed20e2..7762e15 100644
--- a/README
+++ b/README
@@ -1,5 +1,7 @@
scan.sh:
Batch scanning script
+demeta:
+ Mark all dependencies as manually installed then purge an apt metapackage.
digits.rb:
Digit combinations for target sum
gen_object/:
diff --git a/demeta b/demeta
new file mode 100755
index 0000000..a21b9f0
--- /dev/null
+++ b/demeta
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+PKG=$1
+
+if [ -z $PKG ]; then
+ echo "Specify package" >&2
+ exit 1
+fi
+
+WDIR=$(mktemp --tmpdir -d demeta.XXXXXXXXXX)
+pushd $WDIR >/dev/null
+
+FILE=$(apt-get download $PKG --print-uris | cut -d\ -f2)
+apt-get -qq download $PKG
+
+CNTRL=$(ar p $FILE control.tar.xz | unxz | tar -x ./control)
+DEPS=$(cat control | grep ^Depends | cut -d: -f2 | tr -d ,)
+
+echo Will set as manually installed:
+echo $DEPS
+echo
+echo Will remove:
+echo $PKG
+
+echo
+echo -n 'Type y to continue: '
+read LINE
+if [ "z$LINE" == "zy" ]; then
+ sudo apt-mark manual $DEPS
+ sudo apt-get purge $PKG
+else
+ echo Abandoned.
+fi
+
+popd >/dev/null
+rm -rf $WDIR