diff options
author | chinsan <chinsan@FreeBSD.org> | 2007-07-03 22:17:22 +0800 |
---|---|---|
committer | chinsan <chinsan@FreeBSD.org> | 2007-07-03 22:17:22 +0800 |
commit | 82895ad8886104a381fcc132f97f4db47552474b (patch) | |
tree | ece21015a20f03edee5a32d2281b37d35f686ffc /ports-mgmt | |
parent | 36a7a9e96e961bf304f16f5a996a7b299b62c8ce (diff) | |
download | freebsd-ports-gnome-82895ad8886104a381fcc132f97f4db47552474b.tar.gz freebsd-ports-gnome-82895ad8886104a381fcc132f97f4db47552474b.tar.zst freebsd-ports-gnome-82895ad8886104a381fcc132f97f4db47552474b.zip |
Add bpkg 1.0, simple tool for managing FreeBSD packages/ports.
PR: ports/114064
Submitted by: Andy Kosela <andy.kosela at gmail.com>
Apporved by: rafan (mentor)
Diffstat (limited to 'ports-mgmt')
-rw-r--r-- | ports-mgmt/bpkg/Makefile | 33 | ||||
-rw-r--r-- | ports-mgmt/bpkg/files/bpkg.8 | 147 | ||||
-rw-r--r-- | ports-mgmt/bpkg/files/bpkg.sh.in | 702 | ||||
-rw-r--r-- | ports-mgmt/bpkg/pkg-descr | 7 |
4 files changed, 889 insertions, 0 deletions
diff --git a/ports-mgmt/bpkg/Makefile b/ports-mgmt/bpkg/Makefile new file mode 100644 index 000000000000..a70721763e5b --- /dev/null +++ b/ports-mgmt/bpkg/Makefile @@ -0,0 +1,33 @@ +# New ports collection makefile for: bpkg +# Date created: 24 June 2007 +# Whom: Andy Kosela <andy.kosela@gmail.com> +# +# $FreeBSD$ +# +# This port is self contained in the files directory. +# + +PORTNAME= bpkg +PORTVERSION= 1.0 +CATEGORIES= ports-mgmt +MASTER_SITES= # none +DISTFILES= # none + +MAINTAINER= andy.kosela@gmail.com +COMMENT= Simple tool for managing FreeBSD packages/ports + +NO_BUILD= yes +SUB_FILES= bpkg.sh + +PLIST_FILES= sbin/bpkg + +MAN8= bpkg.8 + +do-fetch: + @${DO_NADA} + +do-install: + ${INSTALL_SCRIPT} ${WRKDIR}/bpkg.sh ${PREFIX}/sbin/bpkg + ${INSTALL_MAN} ${FILESDIR}/bpkg.8 ${MAN8PREFIX}/man/man8 + +.include <bsd.port.mk> diff --git a/ports-mgmt/bpkg/files/bpkg.8 b/ports-mgmt/bpkg/files/bpkg.8 new file mode 100644 index 000000000000..8350920aab68 --- /dev/null +++ b/ports-mgmt/bpkg/files/bpkg.8 @@ -0,0 +1,147 @@ +.\" Copyright (c) 2007 Andy Kosela <andy.kosela@gmail.com> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd June 24, 2007 +.Dt BPKG 8 +.Os +.Sh NAME +.Nm bpkg +.Nd a simple tool for managing FreeBSD packages/ports. +.Sh SYNOPSIS +.Nm +.Op Fl dDeEfgiIkLmnNoOprsSw +.Ar pkg-name ... +.Nm +.Op Fl aAcCFhlv +.Pp +.Sh DESCRIPTION +.Nm +is a simple tool written in sh(1) for managing FreeBSD packages/ports. It is a +wrapper around base system utilities manipulating the FreeBSD Ports Collection. +The main goal of this project is to provide one universal tool for +packages/ports management. +.Sh TERMINOLOGY +.An Nm Port +- a software ready to be compiled from source using the Ports Collection +infrastructure. +.Pp +.An Nm Package +- an installed software (from binary package or port) or a binary package file +in .tbz format made from a port. +.Sh OPTIONS +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. +.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 c +clean all distfiles in /usr/ports/distfiles/* [no arguments] +.It Fl C +clean all distfiles in /usr/ports/distfiles/* and also all working directories +of the ports tree /usr/ports/*/*/work/ [no arguments] +.It Fl d +delete the specified installed packages. +.It Fl D +display description of the package/port. +.It Fl e +configure options for the specified package/port using dialog(1). +.It Fl E +compile and install any dependencies of the specified package/port and then +compile and install the port itself. +.It Fl f +show the packing list instructions for the package/port. +.It Fl F +ftp to FreeBSD packages repository and check the latest available package +version. [no arguments] +.It Fl g +show files that do not match the recorded checksum in the specified installed +package. +.It Fl h +display help. [no arguments] +.It Fl i +display info about the package/port. +.It Fl I +display short info about the package/port. +It Fl k +show the deinstall script (if any) for the installed package. +.It Fl l +display short info about all installed packages. [no arguments] +.It Fl L +show the files within the installed package. +.It Fl m +display port's Makefile. +.It Fl n +do not actually install a package/port, just report the steps that would be +taken if it was. +.It Fl N +perform non-interactive installation of the 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 ports' name and display its path. +.It Fl r +show the list of dependencies and also the list of installed packages which +require specified package. +.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. +.It Fl w +which installed package owns the specified file. +.It Fl v +list all installed packages, and search for upgrades for them using ports. [no arguments] +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +The following is an example of a typical usage +of the +.Nm +command: +.Pp +.Dl Nm "bpkg foo" +.Pp +Upgrade or install a package/port named foo. +.Pp +.Dl Nm "bpkg -i 'foo1 foo2'" +.Pp +Display info about packages/ports foo1 and foo2. +.Pp +.Dl Nm "bpkg -S ^foo" +.Pp +Display ports that start with foo string. +.Sh SEE ALSO +.Xr pkg_add 1 , +.Xr pkg_delete 1 , +.Xr pkg_info 1 , +.Xr pkg_version 1 , +.Xr ports 7 +.Sh AUTHORS +.An Andy Kosela <andy.kosela@gmail.com> diff --git a/ports-mgmt/bpkg/files/bpkg.sh.in b/ports-mgmt/bpkg/files/bpkg.sh.in new file mode 100644 index 000000000000..6ef30593bbce --- /dev/null +++ b/ports-mgmt/bpkg/files/bpkg.sh.in @@ -0,0 +1,702 @@ +#!/bin/sh +# $FreeBSD$ + +# Copyright (c) 2007 Andy Kosela <andy.kosela@gmail.com> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +trap trap_exit 2 + +pkg=$@ + +root() { + if [ `id -u` != 0 ]; then + echo "Access denied. Root privileges required." + exit 0 + fi +} + +trap_exit() { + echo -e "\n*** SIGINT detected ***" + exit 1 +} + +installed() { + a=pkg_installed +} + +missing() { + echo "It seems you typed the port which is not available in /usr/ports/" + echo "Check your port's name and try again." + exit 0 +} + +init_check() { + pkg_chk=`pkg_info -xoq $pkg 2>/dev/null` + [ ! -z "$pkg_chk" ] && installed + + if [ -z "$a" ]; then + port_chk=`whereis -sq $pkg` + [ -z "$port_chk" ] && missing + fi +} + +main() { + root + if [ -z "$pkg" ]; then + echo "bpkg: you didn't specify any package to install/upgrade." + exit 0 + fi + + init_check + + if [ -z "$a" ]; then + pkg_install=`whereis -sq $pkg | cut -d/ -f5 | awk '{ORS=" " ; print}'` + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + echo -n "Do you want to install "$pkg_install"using binary packages [y] " + read key + case $key in + n) echo "Installing new port(s):" + for e in `whereis -sq $pkg`; do + echo -n "Do you want to set config options recursively? [y] " + read key2 + case $key2 in + n) for e in `whereis -sq $pkg`; do + cd $e && make install clean + done + exit 0;; + *) for e in `whereis -sq $pkg`; do + cd $e && make config-conditional + cd $e && make install clean + done + exit 0;; + esac + done + exit 0;; + *) echo "Installing new package(s):" + pkg_add -r $pkg_install + exit 0;; + esac + fi + + pkg_install=`pkg_info -xoq $pkg | cut -d/ -f2 | awk '{ORS=" " ; print}'` + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo -n "Do you want to upgrade "$pkg_install"using binary packages? [y] " + read key + + case $key in + n) echo "Upgrading port(s):" + for e in `pkg_info -xoq $pkg`; do + c=`echo $e | cut -d/ -f2` + pkg_delete -rix $c + if [ ! -z `pkg_info -xoq $c 2>/dev/null` ]; then + echo "*** cannot proceed without first removing the package ***" + exit 0 + fi + + echo -n "Do you want to explicitly set config options? [n] " + read key2 + case $key2 in + y) for e in `pkg_info -xoq $pkg`; do + cd /usr/ports/$e && make config + cd /usr/ports/$e && make install clean + done + exit 0;; + *) for e in `pkg_info -xoq $pkg`; do + cd /usr/ports/$e && make install clean + done + exit 0;; + esac + done + exit 0;; + *) echo "Upgrading package(s):" + pkg_delete -fix $pkg_install && pkg_add -r $pkg_install + exit 0;; + esac +} + +simulation() { + root + init_check + + if [ -z "$a" ]; then + pkg_install=`whereis -sq $pkg | cut -d/ -f5 | awk '{ORS=" " ; print}'` + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + echo -n "Do you want to install "$pkg_install"using binary packages (simulation mode) [y] " + read key + case $key in + n) echo "Installing new port(s): $pkg_install" + exit 0;; + *) echo "Installing new package(s):" + pkg_add -rn $pkg_install + exit 0;; + esac + fi + + pkg_install=`pkg_info -xoq $pkg | cut -d/ -f2 | awk '{ORS=" " ; print}'` + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo -n "Do you want to upgrade "$pkg_install"using binary packages? (simulation mode) [y] " + read key + + case $key in + n) echo "Upgrading port(s): $pkg_install" + exit 0;; + *) echo "Upgrading package(s):" + pkg_delete -ixn $pkg_install && pkg_add -rn $pkg_install + exit 0;; + esac +} + +non-interactive() { + root + init_check + + if [ -z "$a" ]; then + pkg_install=`whereis -sq $pkg | cut -d/ -f5 | awk '{ORS=" " ; print}'` + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + echo "Installing new package(s):" + pkg_add -r $pkg_install + exit 0 + fi + + pkg_install=`pkg_info -xoq $pkg | cut -d/ -f2 | awk '{ORS=" " ; print}'` + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo "Upgrading package(s):" + pkg_delete -fx $pkg_install && pkg_add -r $pkg_install + exit 0 +} + +all() { + root + echo "" + echo -n "Do you want to upgrade all installed packages using binary packages? (interactive mode) [y] " + read key + + case $key in + n) echo "Upgrading all ports:" + for e in `pkg_info -aoq`; do + c=`echo "$e" | cut -d/ -f2` + pkg_delete -rix $c + cd /usr/ports/$e && make install clean + done + exit 0;; + *) echo "Upgrading all packages:" + all=`ls -l /var/db/pkg/ | awk '{print $9}' | sed 's/\(.*\)-.*/\1/g' | awk '{ORS=" " ;print}'` + pkg_delete -ifa && pkg_add -r $all + exit 0;; + esac +} + +all_non-interactive() { + root + echo "" + echo -n "Do you want to upgrade all installed packages using binary packages? (non-interactive mode) [y] " + read key + + case $key in + n) echo "Upgrading all ports:" + for e in `pkg_info -aoq $pkg`; do + c=`echo $e | cut -d/ -f2` + pkg_delete -rx $c + cd /usr/ports/$e && make install clean + done + exit 0;; + *) echo "Upgrading all packages:" + all=`ls -l /var/db/pkg/ | awk '{print $9}' | sed 's/\(.*\)-.*/\1/g' | awk '{ORS=" " ;print}'` + pkg_delete -fa && pkg_add -r $all + exit 0;; + esac +} + +pkg_info-xI() { + init_check + if [ -z "$a" ]; then + echo -e "\033[33m*** not installed ***\033[0m" + path=`whereis -sq $pkg` + echo "$path: `cat $path/Makefile | grep COMMENT | cut -d= -f2`" + else + echo -e "\033[33m*** installed ***\033[0m" + pkg_info -xI $pkg + fi + + exit 0 +} + +pkg_info-xL() { + z=`pkg_info -xL $pkg 2>/dev/null` + + if [ -z "$z" ]; then + echo "bpkg: no installed packages match pattern(s)" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo "$z" + fi + + exit 0 +} + +pkg_inf() { + pkg_info + echo "" + echo "***`pkg_info | wc -l` packages installed ***" + exit 0 +} + +pkg_info-xs() { + z=`pkg_info -xs $pkg 2>/dev/null` + + if [ -z "$z" ]; then + echo "bpkg: no installed packages match pattern(s)" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo "$z" + fi + + exit 0 +} + +pkg_info-xr() { + init_check + if [ -z "$a" ]; then + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + for e in $pkg; do + path=`whereis -sq $e` + echo "$pkg: `cat $path/Makefile | grep COMMENT | cut -d= -f2`" + cd /usr/ports && make search name=^$e-[0-9] | grep .*-deps + echo "" + done + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + pkg_info -xrR $pkg + fi + + exit 0 +} + +pkg_info-xg() { + z=`pkg_info -xg $pkg 2>/dev/null` + + if [ -z "$z" ]; then + echo "bpkg: no installed packages match pattern(s)" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo "$z" + fi + + exit 0 +} + +pkg_info-xf() { + init_check + if [ -z "$a" ]; then + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + for e in $pkg; do + path=`whereis -sq $e` + echo "$pkg: `cat $path/Makefile | grep COMMENT | cut -d= -f2`" + echo "" + cat $path/pkg-plist + echo "" + done + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + pkg_info -xf $pkg + fi + + exit 0 +} + +pkg_info-xk() { + z=`pkg_info -xk $pkg 2>/dev/null` + + if [ -z "$z" ]; then + echo "bpkg: no installed packages match pattern(s)" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo "$z" + fi + + exit 0 +} + +pkg_info-x() { + init_check + + if [ -z "$a" ]; then + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + path=`whereis -sq $pkg` + echo "$pkg: `cat $path/Makefile | grep COMMENT | cut -d= -f2`" + echo "" + echo "Description:" + echo "`cat $path/pkg-descr`" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + pkg_info -x $pkg + fi + + exit 0 +} + +pkg_ver() { + pkg_version -Iv + echo "" + echo "***`pkg_info | wc -l` packages installed ***" + exit 0 +} + +pkg_path() { + for e in `ls -l /usr/ports/*/ | grep $pkg | awk '{print $9}'`; do + path=`whereis -sq $e` + echo "$path" ; cat $path/Makefile | grep COMMENT | cut -d= -f2 + done + + exit 0 +} + +pkg_makefile() { + init_check + path=`whereis -sq $pkg` + less $path/Makefile 2>/dev/null + exit 0 +} + +make_search() { + init_check + if [ -z "$a" ]; then + whereis -sq $pkg + echo -e "\033[33m*** not installed ***\033[0m" + echo "" + for e in $pkg; do + cd /usr/ports && make search name=^$e + done + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo -e "\033[33m*** installed ***\033[0m" + echo "" + for e in $pkg; do + name=`pkg_info -xoq $e` + for i in $name; do + cd /usr/ports && make search path=$i$ + done + done + fi + + exit 0 +} + +make_search_w() { + cd /usr/ports && make search name=$pkg + exit 0 +} + +pkg_find() { + arch=`uname -m` + sys=`uname -r | cut -d- -f1,2 | tr '[:upper:]' '[:lower:]'` + ftp -4Va ftp://ftp.freebsd.org/pub/FreeBSD/ports/$arch/packages-$sys/Latest/ + exit 0 +} + +pkg_delete-xr() { + root + z=`pkg_info -xoQ $pkg 2>/dev/null` + + if [ -z "$z" ]; then + echo "bpkg: no installed packages match pattern(s)" + exit 0 + fi + + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo -n "Do you want to use recursive removal? [y] " + read key + + case $key in + n) echo -n "Do you want to use force removal? [n] " + read key2 + case $key2 in + y) pkg_delete -xf $pkg + exit 0;; + *) pkg_delete -x $pkg + exit 0;; + esac;; + *) echo -n "Do you want to use force removal? [n] " + read key2 + case $key2 in + y) pkg_delete -xrfi $pkg + exit 0;; + *) pkg_delete -xri $pkg + exit 0;; + esac;; + esac +} + +pkg_clean() { + root + echo "Cleaning /usr/ports/distfiles/*" + rm -rf /usr/ports/distfiles/* 1>/dev/null 2>&1 + echo "Done." + exit 0 +} + +pkg_clean2() { + root + echo "Cleaning /usr/ports/distfiles/* and /usr/ports/*/*/work/" + rm -rf /usr/ports/distfiles/* 1>/dev/null 2>&1 ; rm -rf /usr/ports/*/*/work/ 1>/dev/null 2>&1 + echo "Done." + exit 0 +} + +pkg_which-() { + grep "$pkg"$ /var/db/pkg/*/+CONTENTS | awk -F 'pkg/' '{ print $2 }' | \ + sed '/@dirrm/ d ; /@unexec/ d ; /@comment/ d ; s/\/+CONTENTS//g ; s/:@comment .*ORIGIN//g' | \ + awk -F: '{ print $1 ":\t/usr/local/" $2 }' + exit 0 +} + +make_showc() { + init_check + if [ -z "$a" ]; then + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + fi + + echo -n "Do you want to display config options recursively? [n] " + read key + case $key in + y) for e in `whereis -sq $pkg`; do + cd $e && make showconfig-recursive + done + exit 0;; + *) for e in `whereis -sq $pkg`; do + cd $e && make showconfig + done + exit 0;; + esac +} + +make_rmc() { + root + if [ -z "$pkg" ]; then + echo "bpkg: you didn't specify any package/port." + exit 0 + fi + + init_check + if [ -z "$a" ]; then + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + fi + + echo -n "Do you want to remove config options recursively? [n] " + read key + case $key in + y) for e in `whereis -sq $pkg`; do + cd $e && make rmconfig-recursive + done + exit 0;; + *) for e in `whereis -sq $pkg`; do + cd $e && make rmconfig + done + exit 0;; + esac +} + +make_config() { + root + if [ -z "$pkg" ]; then + echo "bpkg: you didn't specify any package/port." + exit 0 + fi + + init_check + if [ -z "$a" ]; then + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + fi + + echo -n "Do you want to set config options recursively? [n] " + read key + case $key in + y) for e in `whereis -sq $pkg`; do + cd $e && make config-recursive + done + exit 0;; + *) for e in `whereis -sq $pkg`; do + cd $e && make config + done + exit 0;; + esac +} + +make_depends() { + root + if [ -z "$pkg" ]; then + echo "bpkg: you didn't specify any port to install/upgrade." + exit 0 + fi + + init_check + if [ -z "$a" ]; then + whereis -sq $pkg + echo "" + echo -e "\033[33m*** not installed ***\033[0m" + echo "Installing new port(s):" + else + pkg_info -xoQ $pkg | awk -F: '{OFS=": " ; print $2, $1}' + echo "" + echo -e "\033[33m*** installed ***\033[0m" + echo "Upgrading port(s):" + fi + + echo -n "Do you want to set config options recursively? [y] " + read key + case $key in + n) for e in `whereis -sq $pkg`; do + cd $e && make config + cd $e && make depends && make install clean + done + exit 0;; + *) for e in `whereis -sq $pkg`; do + cd $e && make config-recursive + cd $e && make depends && make install clean + done + exit 0;; + esac +} + +help() { + echo "bpkg version `pkg_info -xI bpkg | cut -d- -f2 | cut -d' ' -f1`" + echo "" + echo "Usage: bpkg [-dDeEfgiIkLmnNoOprsSw] pkg-name ..." + echo " bpkg [-aAcCFhlv]" + echo "" + echo "Please see the bpkg(8) man page for more information" + echo "" + exit 0 +} + +# End of functions +################################################################################ + +while getopts d:D:e:E:f:g:i:I:k:L:m:n:N:o:O:p:r:s:S:w:aAcCFhlv opts; do + case $opts in + d) pkg=$OPTARG + pkg_delete-xr;; + D) pkg=$OPTARG + pkg_info-x;; + e) pkg=$OPTARG + make_config;; + E) pkg=$OPTARG + make_depends;; + f) pkg=$OPTARG + pkg_info-xf;; + g) pkg=$OPTARG + pkg_info-xg;; + i) pkg=$OPTARG + make_search;; + I) pkg=$OPTARG + pkg_info-xI;; + k) pkg=$OPTARG + pkg_info-xk;; + L) pkg=$OPTARG + pkg_info-xL;; + m) pkg=$OPTARG + pkg_makefile;; + n) pkg=$OPTARG + simulation;; + N) pkg=$OPTARG + non-interactive;; + o) pkg=$OPTARG + make_showc;; + O) pkg=$OPTARG + make_rmc;; + p) pkg=$OPTARG + pkg_path;; + r) pkg=$OPTARG + pkg_info-xr;; + s) pkg=$OPTARG + pkg_info-xs;; + S) pkg=$OPTARG + make_search_w;; + w) pkg=$OPTARG + pkg_which-;; + a) all;; + A) all_non-interactive;; + c) pkg_clean;; + C) pkg_clean2;; + F) pkg_find;; + h) help;; + l) pkg_inf;; + v) pkg_ver;; + *) help;; + esac +done + +main diff --git a/ports-mgmt/bpkg/pkg-descr b/ports-mgmt/bpkg/pkg-descr new file mode 100644 index 000000000000..2a3270bee329 --- /dev/null +++ b/ports-mgmt/bpkg/pkg-descr @@ -0,0 +1,7 @@ +bpkg is a simple tool written in sh(1) for managing FreeBSD packages/ports. It +is a wrapper around base system utilities manipulating the FreeBSD Ports +Collection. The main goal of this project is to provide one universal tool for +packages/ports management. + +-- Andy Kosela +<andy.kosela@gmail.com> |