diff options
author | Rong-En Fan <rafan@FreeBSD.org> | 2007-08-11 10:06:30 +0000 |
---|---|---|
committer | Rong-En Fan <rafan@FreeBSD.org> | 2007-08-11 10:06:30 +0000 |
commit | 5852e7838fb9539245395bb56ca5e759e871bcea (patch) | |
tree | b4f32ff3869360334bf3a00eb501fc60ce5f49b7 /ports-mgmt/bpkg | |
parent | 4fb03f721ba1ad5906302bf246c88ca5409b6920 (diff) | |
download | ports-5852e7838fb9539245395bb56ca5e759e871bcea.tar.gz ports-5852e7838fb9539245395bb56ca5e759e871bcea.zip |
Notes
Diffstat (limited to 'ports-mgmt/bpkg')
-rw-r--r-- | ports-mgmt/bpkg/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/bpkg/files/bpkg.8 | 24 | ||||
-rw-r--r-- | ports-mgmt/bpkg/files/bpkg.sh.in | 261 |
3 files changed, 109 insertions, 178 deletions
diff --git a/ports-mgmt/bpkg/Makefile b/ports-mgmt/bpkg/Makefile index 746857d9d5e4..4a251e05a84c 100644 --- a/ports-mgmt/bpkg/Makefile +++ b/ports-mgmt/bpkg/Makefile @@ -8,7 +8,7 @@ # PORTNAME= bpkg -PORTVERSION= 1.2 +PORTVERSION= 1.3 CATEGORIES= ports-mgmt MASTER_SITES= # none DISTFILES= # none diff --git a/ports-mgmt/bpkg/files/bpkg.8 b/ports-mgmt/bpkg/files/bpkg.8 index 4efe6d1e0160..379cb0ab2b65 100644 --- a/ports-mgmt/bpkg/files/bpkg.8 +++ b/ports-mgmt/bpkg/files/bpkg.8 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" -.Dd July 9, 2007 +.Dd August 7, 2007 .Dt BPKG 8 .Os .Sh NAME @@ -31,7 +31,7 @@ .Nd a simple tool for managing FreeBSD packages/ports. .Sh SYNOPSIS .Nm -.Op Fl bdDeEfFgiIkLmMnNoOprsSwz +.Op Fl bBdDeEfFgiIkLmMnoOprsSwz .Ar pkg-name ... .Nm .Op Fl aAcChltvZ @@ -54,12 +54,14 @@ in .tbz format made from a port. The following command line arguments are supported: .Bl -tag -width F1 .It Ar pkg-name ... -with no additional arguments, upgrade/install the specified packages/ports. +with no additional arguments, upgrade/install the specified packages. .It Fl a upgrade all installed packages (interactive mode). [no arguments] .It Fl A upgrade all installed packages (non-interactive mode). [no arguments] .It Fl b +upgrade/install the specified ports. +.It Fl B create backup package file in /usr/tmp/ from a locally installed package. .It Fl c clean all distfiles in /usr/ports/distfiles/* [no arguments] @@ -85,9 +87,9 @@ package. .It Fl h display help. [no arguments] .It Fl i -display info about the package/port. +display info about the package/port (priority - installed packages). .It Fl I -display short info about the package/port. +display short info about the package/port (priority - installed packages). .It Fl k show the deinstall script (if any) for the installed package. .It Fl l @@ -100,20 +102,18 @@ display package/port's Makefile. show the install-message file for the installed package. .It Fl n simulation mode, do not actually install a package/port. -.It Fl N -perform non-interactive installation of the binary package. .It Fl o display config options for the specified package/port. .It Fl O remove config options for the specified package/port. .It Fl p -search the ports tree for the specified port's name and display its path. +search the ports tree and display short info about the port. .It Fl r show the list of all package/port's dependencies. .It Fl s show the total size occupied by files installed within the package. .It Fl S -search the ports tree for the specified string. +search the ports tree and display info about the port. .It Fl t list all installed packages and dates of their installation. [no arguments] .It Fl w @@ -135,7 +135,11 @@ command: .Pp .Dl Ar "# bpkg foo" .Pp -Upgrade or install a package/port named foo (root privileges required). +Upgrade or install a package named foo (root privileges required). +.Pp +.Dl Ar "# bpkg -b foo" +.Pp +Upgrade or install a port named foo (root privileges required). .Pp .Dl Ar "> bpkg -i 'foo bar'" .Pp diff --git a/ports-mgmt/bpkg/files/bpkg.sh.in b/ports-mgmt/bpkg/files/bpkg.sh.in index de05afcd776d..374a8874ff51 100644 --- a/ports-mgmt/bpkg/files/bpkg.sh.in +++ b/ports-mgmt/bpkg/files/bpkg.sh.in @@ -52,94 +52,51 @@ main() { echo "bpkg: you didn't specify any package to install/upgrade" exit 0 fi - - for e in $pkg; do - [ -z "`cd /usr/ports && make search path=/$e[0-9]*$`" ] && missing - done echo "Available in ports:" for e in $pkg; do - cd /usr/ports && make search path=/$e[0-9]*$ | awk '/Port/ /Path/ { print $0 "\n" }' + cd /usr/ports && make search path=/$e.* | awk '/Port/ /Path/ { print $0 "\n" }' done for z in $pkg; do - pkg_install=`cd /usr/ports && make search path=/$z[0-9]*$ | grep Path | cut -d/ -f4,5` + pkg_install=`cd /usr/ports && make search path=/$z.* | grep Path | cut -d/ -f4,5` for e in $pkg_install; do e_stripped=`echo $e | cut -d/ -f2` - e_installed=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` + e_installed=`grep $e$ /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` if [ -z "$e_installed" ]; then - e_install=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` - echo -n "Do you want to install new $e_install? [y] " + echo -n "Do you want to install new $e? [y] " else echo -n "Do you want to upgrade installed $e_installed? [y] " fi read key case $key in n) ;; - *) echo -n "Fetch binary package? [y] " - read key - + *) if [ ! -z "$e_installed" ]; then echo -n "Creating backup package in /usr/tmp/$e_installed.tbz... " cd /usr/tmp/ && pkg_create -b $e_installed echo "Done." fi - case $key in - - # Install from port (source) - - n) echo "" - if [ ! -z "$e_installed" ]; then - echo "Upgrading installed port:" - pkg_delete -f $e_installed 1>/dev/null 2>&1 - if [ ! -z `pkg_info -oq $e_installed 2>/dev/null` ]; then - echo "*** cannot proceed without first removing the package ***" - exit 0 - fi - else - echo "Installing new port:" - fi + # Fetch and install binary package - echo -n "Do you want to explicitly set config options now? [n] " - read key2 - case $key2 in - y) echo -n "Recursive? [n] " - read key - case $key in - y) cd /usr/ports/$e_install && make config-recursive - cd /usr/ports/$e_install && make install clean - exit 0;; - *) cd /usr/ports/$e_install && make config - cd /usr/ports/$e_install && make install clean - exit 0;; - esac;; - - *) cd /usr/ports/$e_install && make install clean - exit 0;; - esac - exit 0;; - - # Fetch and install binary package - - *) echo "" - if [ ! -z "$e_installed" ]; then - echo "Upgrading installed package:" - pkg_delete -f $e_installed 1>/dev/null 2>&1 - if [ ! -z `pkg_info -oq $e_installed 2>/dev/null` ]; then - echo "*** cannot proceed without first removing the package ***" - exit 0 - fi - pkg_add -r $e_stripped - exit 0 - else - echo "Installing new package:" - pkg_add -r $e_stripped + echo "" + if [ ! -z "$e_installed" ]; then + echo "Upgrading installed package:" + pkg_delete -f $e_installed 1>/dev/null 2>&1 + if [ ! -z `pkg_info -oq $e_installed 2>/dev/null` ]; then + echo "*** cannot proceed without first removing the package ***" exit 0 - fi;; - esac + fi + pkg_add -r $e_stripped + exit 0 + else + echo "Installing new package:" + pkg_add -r $e_stripped + exit 0 + fi;; esac done done @@ -151,149 +108,119 @@ simulation() { echo "bpkg: you didn't specify any package to install/upgrade" exit 0 fi - - for e in $pkg; do - [ -z "`cd /usr/ports && make search name=$e-[0-9]`" ] && missing - done echo "Available in ports:" for e in $pkg; do - cd /usr/ports && make search path=/$e[0-9]*$ | awk '/Port/ /Path/ { print $0 "\n" }' + cd /usr/ports && make search path=/$e.* | awk '/Port/ /Path/ { print $0 "\n" }' done for z in $pkg; do - pkg_install=`cd /usr/ports && make search path=/$z[0-9]*$ | grep Path | cut -d/ -f4,5` + pkg_install=`cd /usr/ports && make search path=/$z.* | grep Path | cut -d/ -f4,5` for e in $pkg_install; do - e_install=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` e_stripped=`echo $e | cut -d/ -f2` - e_installed=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` + e_installed=`grep $e$ /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` if [ -z "$e_installed" ]; then - echo -n "Do you want to install new $e_install? [y] " + echo -n "Do you want to install new $e? [y] " else echo -n "Do you want to upgrade installed $e_installed? [y] " fi read key case $key in n) ;; - *) echo -n "Fetch binary package? [y] " - read key - + *) if [ ! -z "$e_installed" ]; then echo -n "Creating backup package in /usr/tmp/$e_installed.tbz... " + cd /usr/tmp/ && pkg_create -b $e_installed echo "Done." fi - case $key in - - # Install from port (source) - - n) echo "" - if [ ! -z "$e_installed" ]; then - echo "Upgrading installed port:" - pkg_delete -n $e_installed 1>/dev/null 2>&1 - if [ ! -z `pkg_info -oq $e_installed 2>/dev/null` ]; then - echo "*** cannot proceed without first removing the package ***" - exit 0 - fi - else - echo "Installing new port:" - fi + # Fetch and install binary package - echo -n "Do you want to explicitly set config options now? [n] " - read key2 - case $key2 in - y) echo -n "Recursive? [n] " - read key - case $key in - y) exit 0;; - *) exit 0;; - esac;; - - *) exit 0;; - esac - exit 0;; - - # Fetch and install binary package - - *) echo "" - if [ ! -z "$e_installed" ]; then - echo "Upgrading installed package:" - pkg_delete -n $e_installed 1>/dev/null 2>&1 - if [ ! -z `pkg_info -oq $e_installed 2>/dev/null` ]; then - echo "*** cannot proceed without first removing the package ***" - exit 0 - fi - pkg_add -rn $e_stripped - exit 0 - else - echo "Installing new package:" - pkg_add -rn $e_stripped - exit 0 - fi;; - esac + echo "" + if [ ! -z "$e_installed" ]; then + echo "Upgrading installed package:" + pkg_delete -n $e_installed 1>/dev/null 2>&1 + pkg_add -rn $e_stripped + exit 0 + else + echo "Installing new package:" + pkg_add -rn $e_stripped + exit 0 + fi;; esac done done } -non-interactive() { +build_port() { root if [ -z "$pkg" ]; then echo "bpkg: you didn't specify any package to install/upgrade" exit 0 fi - - for e in $pkg; do - [ -z "`cd /usr/ports && make search name=$e-[0-9]`" ] && missing - done echo "Available in ports:" for e in $pkg; do - cd /usr/ports && make search path=/$e[0-9]*$ | awk '/Port/ /Path/ { print $0 "\n" }' + cd /usr/ports && make search path=/$e.* | awk '/Port/ /Path/ { print $0 "\n" }' done for z in $pkg; do - pkg_install=`cd /usr/ports && make search path=/$z[0-9]*$ | grep Path | cut -d/ -f4,5` + pkg_install=`cd /usr/ports && make search path=/$z.* | grep Path | cut -d/ -f4,5` for e in $pkg_install; do - e_install=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` e_stripped=`echo $e | cut -d/ -f2` - e_installed=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` + e_installed=`grep $e$ /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` if [ -z "$e_installed" ]; then - echo -n "Do you want to install new $e_install? [y] " + echo -n "Do you want to install new $e? [y] " else echo -n "Do you want to upgrade installed $e_installed? [y] " fi read key case $key in n) ;; - *) + *) if [ ! -z "$e_installed" ]; then echo -n "Creating backup package in /usr/tmp/$e_installed.tbz... " cd /usr/tmp/ && pkg_create -b $e_installed echo "Done." fi - # Fetch and install binary package + # Install from port (source) echo "" if [ ! -z "$e_installed" ]; then - echo "Upgrading installed package:" + echo "Upgrading installed port:" pkg_delete -f $e_installed 1>/dev/null 2>&1 if [ ! -z `pkg_info -oq $e_installed 2>/dev/null` ]; then echo "*** cannot proceed without first removing the package ***" exit 0 fi - pkg_add -r $e_stripped - exit 0 else - echo "Installing new package:" - pkg_add -r $e_stripped - exit 0 - fi;; + echo "Installing new port:" + fi + + echo -n "Do you want to explicitly set config options now? [n] " + read key2 + case $key2 in + y) echo -n "Recursive? [n] " + read key + case $key in + y) cd /usr/ports/$e && make config-recursive + cd /usr/ports/$e && make install clean + exit 0;; + *) cd /usr/ports/$e && make config + cd /usr/ports/$e && make install clean + exit 0;; + esac;; + + *) cd /usr/ports/$e && make install clean + exit 0;; + esac + exit 0;; + esac done done @@ -407,7 +334,7 @@ pkg_info-xr() { info=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d: -f3` if [ -z "$info" ]; then - path=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` + path=`cd /usr/ports && make search path=/$e.* | grep Path | cut -d/ -f4,5` for i in $path; do echo -e "\033[33m*** not installed ***\033[0m" echo "$i: `cat /usr/ports/$i/Makefile | grep COMMENT | cut -d= -f2`" @@ -456,7 +383,7 @@ pkg_info-xf() { info=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d: -f3` if [ -z "$info" ]; then - path=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` + path=`cd /usr/ports && make search path=/$e.* | grep Path | cut -d/ -f4,5` for i in $path; do echo -e "\033[33m*** not installed ***\033[0m" echo "$i: `cat /usr/ports/$i/Makefile | grep COMMENT | cut -d= -f2`" @@ -518,7 +445,7 @@ pkg_info-x() { info=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d: -f3` if [ -z "$info" ]; then - path=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` + path=`cd /usr/ports && make search path=/$e.* | grep Path | cut -d/ -f4,5` for i in $path; do echo -e "\033[33m*** not installed ***\033[0m" echo "$i: `cat /usr/ports/$i/Makefile | grep COMMENT | cut -d= -f2`" @@ -692,7 +619,7 @@ make_showc() { info=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d: -f3` if [ -z "$info" ]; then - path=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` + path=`cd /usr/ports && make search path=/$e.* | grep Path | cut -d/ -f4,5` for i in $path; do echo -e "\033[33m*** not installed ***\033[0m" echo "$i: `cat /usr/ports/$i/Makefile | grep COMMENT | cut -d= -f2`" @@ -729,7 +656,7 @@ make_rmc() { info=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d: -f3` if [ -z "$info" ]; then - path=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` + path=`cd /usr/ports && make search path=/$e.* | grep Path | cut -d/ -f4,5` for i in $path; do echo -e "\033[33m*** not installed ***\033[0m" echo "$i: `cat /usr/ports/$i/Makefile | grep COMMENT | cut -d= -f2`" @@ -766,7 +693,7 @@ make_config() { info=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d: -f3` if [ -z "$info" ]; then - path=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` + path=`cd /usr/ports && make search path=/$e.* | grep Path | cut -d/ -f4,5` for i in $path; do echo -e "\033[33m*** not installed ***\033[0m" echo "$i: `cat /usr/ports/$i/Makefile | grep COMMENT | cut -d= -f2`" @@ -798,25 +725,26 @@ make_config() { } make_depends() { - for e in $pkg; do - [ -z "`cd /usr/ports && make search path=/$e[0-9]*$`" ] && missing - done + root + if [ -z "$pkg" ]; then + echo "bpkg: you didn't specify any package to install/upgrade" + exit 0 + fi echo "Available in ports:" - for e in $pkg; do - cd /usr/ports && make search path=/$e[0-9]*$ | awk '/Port/ /Path/ { print $0 "\n" }' + for i in $pkg; do + cd /usr/ports && make search path=/$e.* | awk '/Port/ /Path/ { print $0 "\n" }' done for z in $pkg; do - pkg_install=`cd /usr/ports && make search path=/$z[0-9]*$ | grep Path | cut -d/ -f4,5` + pkg_install=`cd /usr/ports && make search path=/$z.* | grep Path | cut -d/ -f4,5` for e in $pkg_install; do e_stripped=`echo $e | cut -d/ -f2` - e_installed=`grep $e /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` + e_installed=`grep $e$ /var/db/pkg/*/+CONTENTS | grep -w ORIGIN | cut -d/ -f5` if [ -z "$e_installed" ]; then - e_install=`cd /usr/ports && make search path=/$e[0-9]*$ | grep Path | cut -d/ -f4,5` - echo -n "Do you want to install new $e_install? [y] " + echo -n "Do you want to install new $e? [y] " else echo -n "Do you want to upgrade installed $e_installed? [y] " fi @@ -825,8 +753,7 @@ make_depends() { n) ;; *) if [ ! -z "$e_installed" ]; then - echo "" - echo "*** Creating backup package in /usr/tmp/$e_installed.tbz ***" + echo -n "Creating backup package in /usr/tmp/$e_installed.tbz... " cd /usr/tmp/ && pkg_create -b $e_installed echo "Done." fi @@ -849,15 +776,15 @@ make_depends() { y) echo -n "Recursive? [n] " read key case $key in - y) cd /usr/ports/$e_install && make config-recursive - cd /usr/ports/$e_install && make depends && make install clean + y) cd /usr/ports/$e && make config-recursive + cd /usr/ports/$e && make depends && make install clean exit 0;; - *) cd /usr/ports/$e_install && make config - cd /usr/ports/$e_install && make depends && make install clean + *) cd /usr/ports/$e && make config + cd /usr/ports/$e && make depends && make install clean exit 0;; esac;; - *) cd /usr/ports/$e_install && make depends && make install clean + *) cd /usr/ports/$e && make depends && make install clean exit 0;; esac exit 0;; @@ -1082,7 +1009,7 @@ make_ldd_all() { help() { echo "bpkg version `pkg_info -xI bpkg | cut -d- -f2 | cut -d' ' -f1`" echo "" - echo "Usage: bpkg [-bdDeEfFgiIkLmMnNoOprsSwz] pkg-name ..." + echo "Usage: bpkg [-bBdDeEfFgiIkLmMnoOprsSwz] pkg-name ..." echo " bpkg [-aAcChltvZ]" echo "" echo "Please see the bpkg(8) man page for more information" @@ -1093,9 +1020,11 @@ help() { # End of functions ################################################################################ -while getopts b:d:D:e:E:f:F:g:i:I:k:L:m:M:n:N:o:O:p:r:s:S:w:z:aAcChltvZ opts; do +while getopts b:B:d:D:e:E:f:F:g:i:I:k:L:m:M:n:o:O:p:r:s:S:w:z:aAcChltvZ opts; do case $opts in b) pkg=$OPTARG + build_port;; + B) pkg=$OPTARG pkg_backup;; d) pkg=$OPTARG pkg_delete-xr;; @@ -1125,8 +1054,6 @@ while getopts b:d:D:e:E:f:F:g:i:I:k:L:m:M:n:N:o:O:p:r:s:S:w:z:aAcChltvZ opts; do pkg_info-xD;; n) pkg=$OPTARG simulation;; - N) pkg=$OPTARG - non-interactive;; o) pkg=$OPTARG make_showc;; O) pkg=$OPTARG |