X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/65ebcb39f6c52361b7d10d42a52ae7399dbe5ebe..7c1bd0ffa0fc824d65d33ae5c024c39edd64fbc6:/bin/apkv?ds=sidebyside diff --git a/bin/apkv b/bin/apkv index 7ae7051..2a4d342 100755 --- a/bin/apkv +++ b/bin/apkv @@ -1,5 +1,5 @@ #!/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() { @@ -13,8 +13,9 @@ Usage: $prog del Remove from virtual package . Empty virtual - packages are removed from world. The shorthand '$prog del * ' can - be used to empty . + packages are removed from world. The shorthand '$prog del * ' + can be used to empty , which is equivalent to + 'apk del ', though with special handling of leading dots. $prog list [-o | packages] List virtual packages and their contents. @@ -103,7 +104,7 @@ if [ "$method" = list ]; then # 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 @@ -111,7 +112,7 @@ if [ "$method" = list ]; then 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 )