summaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-05-07 12:29:18 -0500
committerMarc Coquand <marc@mccd.space>2024-05-07 12:29:18 -0500
commitcd5eeeeacd78544203c3e6e65dcaab25ec4a965b (patch)
tree0a757c676a7c68bda6e77b1853acc8865776aa44 /local
parent712d4ac530363ac11f35b6b7b6b2db138ff98ca6 (diff)
downloadrcm-cd5eeeeacd78544203c3e6e65dcaab25ec4a965b.tar.gz
rcm-cd5eeeeacd78544203c3e6e65dcaab25ec4a965b.tar.bz2
rcm-cd5eeeeacd78544203c3e6e65dcaab25ec4a965b.zip
Add xsync script
Diffstat (limited to 'local')
-rwxr-xr-xlocal/bin/xsync24
1 files changed, 24 insertions, 0 deletions
diff --git a/local/bin/xsync b/local/bin/xsync
new file mode 100755
index 0000000..576b733
--- /dev/null
+++ b/local/bin/xsync
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Binary for syncing xbps with a list
+#
+# HOWTO:
+# Make sure to install xtools and that there is a
+# repository.list, which should be initialized with xpkg -m > ~/repository.list
+#
+# Add whatever package you want to install, and run xsync to sync your
+# list of packages with the new list
+
+set -e
+
+xpkg -m | sort > /tmp/xsync-installed
+cat ~/repository.list | sort > /tmp/xsync-spec
+
+echo $INSTALLED
+
+comm /tmp/xsync-spec /tmp/xsync-installed -23 > /tmp/xsync-to-install
+comm /tmp/xsync-spec /tmp/xsync-installed -13 > /tmp/xsync-to-remove
+
+[ -s /tmp/xsync-to-remove ] && sudo xbps-remove $(cat /tmp/xsync-to-remove) || echo "Nothing to remove"
+
+[ -s /tmp/xsync-to-install ] && sudo xbps-install $(cat /tmp/xsync-to-install) || echo "Nothing to install"
+