aboutsummaryrefslogtreecommitdiff
path: root/aptmeta
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2024-03-13 09:57:00 +0000
committerNat Lasseter <user@4574.co.uk>2024-03-13 09:57:00 +0000
commit85bf60d6a9bf2694a540cc00ca6e72dccde5b26b (patch)
tree2d6c09d410729aac7b91b8ad36348d43ef4b3c0b /aptmeta
parent4583098c1e98a49091bed36fb7f31ad828bd3d16 (diff)
add enmeta and sort README
Diffstat (limited to 'aptmeta')
-rwxr-xr-xaptmeta/demeta36
-rwxr-xr-xaptmeta/enmeta36
2 files changed, 72 insertions, 0 deletions
diff --git a/aptmeta/demeta b/aptmeta/demeta
new file mode 100755
index 0000000..a21b9f0
--- /dev/null
+++ b/aptmeta/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
diff --git a/aptmeta/enmeta b/aptmeta/enmeta
new file mode 100755
index 0000000..14fdfdb
--- /dev/null
+++ b/aptmeta/enmeta
@@ -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 install:
+echo $PKG
+echo
+echo Will set as automatically installed:
+echo $DEPS
+
+echo
+echo -n 'Type y to continue: '
+read LINE
+if [ "z$LINE" == "zy" ]; then
+ sudo apt-get install $PKG
+ sudo apt-mark auto $DEPS
+else
+ echo Abandoned.
+fi
+
+popd >/dev/null
+rm -rf $WDIR