summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-10-11 11:41:51 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-10-11 11:41:51 +0200
commit3f8f69708248017f49a304ab8d1f57f26a4ccf7e (patch)
tree60877dd3d6d2dcb0cafcbb34df87b8f24fa704eb
parented6f35c113c165617e187d8f7caee8308eb1575e (diff)
Automatically update on upgrade/push
-rwxr-xr-xbin/pkg11
-rw-r--r--man/1/pkg6
-rw-r--r--man/5/pkg.conf25
3 files changed, 29 insertions, 13 deletions
diff --git a/bin/pkg b/bin/pkg
index f8178b4..01e6d6a 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -55,6 +55,7 @@ if [[ -f $HOME/.pkg.conf ]] {
[[ -n $PKG_ROOT ]] || PKG_ROOT="ssh://derf.homelinux.org/home/derf/var/packages_root"
[[ -n $CL_OPTIONS ]] || CL_OPTIONS=(-q)
[[ -n $SILENT ]] || SILENT=0
+[[ -n $AUTOUPDATE ]] || AUTOUPDATE=1
info=$'\e[0;36m'
error=$'\e[0;31m'
reset=$'\e[0m'
@@ -624,13 +625,19 @@ case $1 in
list-all) pkg_list_available ;;
local-update) pkg_update_local ;;
log) pkg_log $2 ;;
- push) wrap pkg_push "$2" "Pushing" ;;
+ push)
+ (( AUTOUPDATE )) && pkg_update
+ wrap pkg_push "$2" "Pushing"
+ ;;
refresh) wrap pkg_refresh "$2" "Refreshing" ;;
remote-update) pkg_update_remote ;;
remove) pkg_remove $2 ;;
status) wrap pkg_status "$2" "Checking package status" ;;
update) pkg_update ;;
- upgrade) wrap pkg_upgrade "$2" "Looking for updates" ;;
+ upgrade)
+ (( AUTOUPDATE )) && pkg_update_remote
+ wrap pkg_upgrade "$2" "Looking for updates"
+ ;;
eval) shift; eval $* ;;
*) die "wait, what?\npkg: unknown action: '$1'\n" ;;
esac
diff --git a/man/1/pkg b/man/1/pkg
index f96b6f7..7733692 100644
--- a/man/1/pkg
+++ b/man/1/pkg
@@ -102,11 +102,13 @@ Please refer to pkg(7)
=item * B<pkg remote-update; pkg upgrade>
-Get new stuff from the packages_root
+Get new stuff from the packages_root.
+Note: If you haven't disabled AUTOUPDATE, B<pkg upgrade> will suffice here
=item * B<pkg local-update; pkg push>
-Push local changes to the packages_root
+Push local changes to the packages_root.
+Note: If you haven't disabled AUTOUPDATE, B<pkg push> will suffice here
=item * B<pkg refresh core>
diff --git a/man/5/pkg.conf b/man/5/pkg.conf
index 78d9df0..4b04166 100644
--- a/man/5/pkg.conf
+++ b/man/5/pkg.conf
@@ -13,26 +13,33 @@ The file consists of multiple lines of the form I<variable>=I<value>.
Normal zsh syntax is allowed, which means everything after '#' will be treated
a comment and that there must be no space between the variable and the content.
+With the exception of B<PKG_ROOT>, all variables are optional as they have
+reasonable (so I hope) defaults.
+
=head1 OPTIONS
=over
=item B<PKG_ROOT>=I<url>
-the package root path.
-Default: ssh://derf.homelinux.org/~/var/packages_root
+the package root path
+
+=item B<PDIR>=I<path> ($HOME/packages)
+
+path for the local package tree
+
+=item B<CL_OPTIONS>=I<options> (-q)
-=item B<PDIR>=I<path>
+Options to invoke L<checklinks>(1) with
-path for the local package tree.
-Default: $HOME/packages
+=item B<SILENT>=I<boolean> (0)
-WARNING: changing this will break everything. Don't do it.
+Operate in silent mode if 1
-=item B<CL_OPTIONS>=I<options>
+=item B<AUTOUPDATE>=I<boolean> (1)
-Options to invoke L<checklinks>(1) with.
-Default: -q
+If 1, automatically execute 'pkg update' before 'pkg push'
+and 'pkg remote-update' before 'pkg upgrade'
=back