Skip to content

Commit

Permalink
feat[close #6] Handle desktop entries exports on apt install/apt remove
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin committed Dec 21, 2023
1 parent dee3734 commit a9cc841
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions includes.container/etc/apt/apt.conf.d/99-vso-post
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DPkg::Post-Invoke {"/usr/share/vso/hooks/apt-post"}
2 changes: 2 additions & 0 deletions includes.container/etc/apt/apt.conf.d/99-vso-pre
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DPkg::Pre-Install-Pkgs {"/usr/share/vso/hooks/apt-pre"}
Dpkg::Tools::Options::/usr/share/vso/hooks/apt-pre::Version "1";
11 changes: 11 additions & 0 deletions includes.container/usr/share/vso/hooks/apt-post
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

package="$(cat /tmp/vso-transaction)"

if [ -n "$SUDO_USER" ]; then
username=$SUDO_USER
else
echo "VSO does not work with root privileges, no programs will be exported. Use 'vso export -a $package' to manually export it."
fi

su -c "/usr/bin/vso export -a $package" $username
6 changes: 6 additions & 0 deletions includes.container/usr/share/vso/hooks/apt-pre
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/bash
read line
while read pack
do
echo "$pack" > /tmp/vso-transaction
done < <( (echo "$line"; cat ) | xargs -d '\n' dpkg-deb --show --showformat='${Package}\n')

0 comments on commit a9cc841

Please sign in to comment.