From 3f8f69708248017f49a304ab8d1f57f26a4ccf7e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 11 Oct 2008 11:41:51 +0200 Subject: Automatically update on upgrade/push --- bin/pkg | 11 +++++++++-- man/1/pkg | 6 ++++-- man/5/pkg.conf | 25 ++++++++++++++++--------- 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 -Get new stuff from the packages_root +Get new stuff from the packages_root. +Note: If you haven't disabled AUTOUPDATE, B will suffice here =item * B -Push local changes to the packages_root +Push local changes to the packages_root. +Note: If you haven't disabled AUTOUPDATE, B will suffice here =item * B 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=I. 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, all variables are optional as they have +reasonable (so I hope) defaults. + =head1 OPTIONS =over =item B=I -the package root path. -Default: ssh://derf.homelinux.org/~/var/packages_root +the package root path + +=item B=I ($HOME/packages) + +path for the local package tree + +=item B=I (-q) -=item B=I +Options to invoke L(1) with -path for the local package tree. -Default: $HOME/packages +=item B=I (0) -WARNING: changing this will break everything. Don't do it. +Operate in silent mode if 1 -=item B=I +=item B=I (1) -Options to invoke L(1) with. -Default: -q +If 1, automatically execute 'pkg update' before 'pkg push' +and 'pkg remote-update' before 'pkg upgrade' =back -- cgit v1.2.3