#!/bin/sh
-# TODO: add duplicate checker to seeif a pkg is in multiple virtual pkgs
+# TODO: add duplicate checker to see if a pkg is in multiple virtual pkgs
prog=$(basename $0)
usage() {
$prog del <packages> <virtual>
Remove <packages> from virtual package <virtual>. Empty virtual
- packages are removed from world. The shorthand '$prog del * <virtual>' can
- be used to empty <virtual>.
+ packages are removed from world. The shorthand '$prog del * <virtual>'
+ can be used to empty <virtual>, which is equivalent to
+ 'apk del <virtual>', though with special handling of leading dots.
$prog list [-o | packages]
List virtual packages and their contents.
# replacing chars may result in variable collision—but
# official apk repos do not have any package names that
# would cause issues
- eval "__$(echo $c | tr -s '.:-' _)=1"
+ eval "__$(echo $c | tr -s '.:+-' _ | tr -s '<=~>@' "\n" | head -1)=1"
done
done
# check world against owned packages
orphans=$(
for x in $(cat /etc/apk/world | grep -v '^\.'); do
eval "[ \${__$(
- echo $x | tr -s '.:-' _ | tr -s '<=~>@' "\n" | head -1
+ echo $x | tr -s '.:+-' _ | tr -s '<=~>@' "\n" | head -1
)-0} -eq 0 ]" && echo $x
done
)