summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/pkg13
-rwxr-xr-xinclude/pkglist24
2 files changed, 29 insertions, 8 deletions
diff --git a/bin/pkg b/bin/pkg
index 84f1c98..97b039b 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -1,6 +1,5 @@
#!/usr/bin/env zsh
# pkg - /home package manager and zsh playground
-
typeset -a -U triggers
##
@@ -199,9 +198,17 @@ list_type_local () {
list_update_remote () {
if [[ $PKG_PROTO = 'ssh' ]] {
- scp -q $PKG_HOST:$PKG_PATH/.list .list-remote
+ ssh $PKG_HOST "$PKG_PATH/core/include/pkglist $PKG_PATH" > .list-remote
+ if (( newmode == 0 )) {
+ scp -q $PKG_HOST:$PKG_PATH/.list .list-remote
+ warn "The pkglist version on your packages_root is outdated, please update\n"
+ }
} elif [[ $PKG_PROTO = 'file' ]] {
- cp $PKG_ROOT/.list .list-remote
+ $PKG_PATH/core/include/pkglist $PKG_PATH > .list-remote
+ if (( newmode == 0 )) {
+ cp $PKG_ROOT/.list .list-remote
+ warn "The pkglist version on your packages_root is outdated, please update\n"
+ }
}
}
diff --git a/include/pkglist b/include/pkglist
index 2af4d4a..f4474ff 100755
--- a/include/pkglist
+++ b/include/pkglist
@@ -1,14 +1,28 @@
#!/usr/bin/env zsh
-cd $1 || exit 100
+# Some backwards-compatibility foobar...
+# XXX: Remove this as soon as everyone should have the new version
+typeset -g -i newmode=0
+[[ -n $PDIR ]] && newmode=1
+(( newmode )) || cd $1 || exit 100
+(( newmode )) && cd /${(j:/:)${(s:/:)0}[1,-4]}
-rm -f .list
+(( newmode )) || rm -f .list
for i in *(/,@); {
if [[ -d $i/.git ]] {
- echo -n "$i git " >> .list
- git --git-dir=$i/.git log | fgrep commit | head -n 1 | cut -d ' ' -f 2 >> .list
+ if (( newmode )) {
+ echo -n "$i git "
+ git --git-dir=$i/.git log | fgrep commit | head -n 1 | cut -d ' ' -f 2
+ } else {
+ echo -n "$i git " >> .list
+ git --git-dir=$i/.git log | fgrep commit | head -n 1 | cut -d ' ' -f 2 >> .list
+ }
} else {
- echo "Unsupported package: $i" >&2
+ echo "$i: Unsupported or no repository" >&2
}
}
+
+if (( newmode == 0 )) {
+ echo "Running pkglist manually or via cron is no longer neccessary and therefore depracated" >&2
+}