up to 0.3
clean some TODOes subst forced pkgsrc variables (PKGSRC,PKGDB and PREFIX) add manpage indentation fixes drop dupped code
This commit is contained in:
parent
514eea7a1c
commit
879e9278a1
4 changed files with 41 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
|||
# $NetBSD: Makefile,v 1.4 2005/09/13 01:26:26 poppnk Exp $
|
||||
# $NetBSD: Makefile,v 1.5 2005/09/17 02:08:09 poppnk Exp $
|
||||
|
||||
DISTNAME= pkg_fake-0.2
|
||||
DISTNAME= pkg_fake-0.3
|
||||
CATEGORIES= pkgtools
|
||||
MASTER_SITES= # empty
|
||||
DISTFILES= # empty
|
||||
|
@ -16,9 +16,14 @@ DEPENDS+= pkg_alternatives>=1.3:../../pkgtools/pkg_alternatives/
|
|||
DEPENDS+= pkgfind>=20050804:../../pkgtools/pkgfind/
|
||||
|
||||
do-extract:
|
||||
@${CP} -R ${FILESDIR} ${WRKSRC}
|
||||
mkdir ${WRKSRC}
|
||||
${CAT} ${FILESDIR}/pkg_fake | ${SED} -e 's,@PREFIX@,${PREFIX},g' \
|
||||
-e 's,@PKGDB@,${PKG_DBDIR},g' \
|
||||
-e 's,@PKGSRC@,${PKGSRCDIR},g' > ${WRKSRC}/pkg_fake
|
||||
${CP} ${FILESDIR}/pkg_fake.1 ${WRKSRC}/
|
||||
|
||||
do-install:
|
||||
${INSTALL_SCRIPT} ${WRKSRC}/pkg_fake ${PREFIX}/sbin/pkg_fake
|
||||
${INSTALL_SCRIPT} ${WRKSRC}/pkg_fake ${PREFIX}/sbin/
|
||||
${INSTALL_MAN} ${WRKSRC}/pkg_fake.1 ${PREFIX}/man/man1/
|
||||
|
||||
.include "../../mk/bsd.pkg.mk"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
@comment $NetBSD: PLIST,v 1.1.1.1 2005/04/21 14:54:41 poppnk Exp $
|
||||
@comment $NetBSD: PLIST,v 1.2 2005/09/17 02:08:10 poppnk Exp $
|
||||
sbin/pkg_fake
|
||||
man/man1/pkg_fake.1
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
add manpage
|
||||
rename to pkg_hack ??
|
||||
add support for rehash binaries (pkg_admin check/rebuild) ??
|
||||
subst hardcoded tags like PREFIX, PKGDB, ...
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# pancake@phreaker.net
|
||||
# author: pancake@phreaker.net
|
||||
#
|
||||
# installs or removes fake packages
|
||||
# into pkgsrc database
|
||||
# installs or removes fake packages into the pkgsrc database.
|
||||
# creates and manages fake alternatives on pkgsrc.
|
||||
# allows to hide and show packages from the pkgsrc database.
|
||||
|
||||
PREFIX=/usr/pkg
|
||||
PKGDB=/var/db/pkg
|
||||
PKGSRC=/usr/pkgsrc
|
||||
# variable initialization #
|
||||
PREFIX=@PREFIX@
|
||||
PKGDB=@PKGDB@
|
||||
PKGSRC=@PKGSRC@
|
||||
PKGHIDE=${PKGDB}/../pkg_hide
|
||||
if [ -z "${EDITOR}" ]; then
|
||||
EDITOR=vi
|
||||
fi
|
||||
|
||||
# help functions #
|
||||
show_help()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: pkg_fake [-aAclLprRihH] [pkgname]
|
||||
Version: 0.2
|
||||
Version: 0.3
|
||||
|
||||
fake packages:
|
||||
-a : append files to the target fake package PLIST.
|
||||
|
@ -122,6 +125,14 @@ clear_contents()
|
|||
echo "@cwd ${PREFIX}" >> ${PKGDB}/${PKG}/+CONTENTS
|
||||
}
|
||||
|
||||
print_plist()
|
||||
{
|
||||
PKGDIR=$1
|
||||
cd ${PKGSRC}/${PKG}
|
||||
`bmake show-var VARNAME=_GENERATE_PLIST | sed -e 's,; true;,,'` | eval awk `bmake show-var VARNAME=_PLIST_AWK_SCRIPT`
|
||||
}
|
||||
|
||||
# main #
|
||||
if [ -z "${1}" ]; then
|
||||
show_help
|
||||
exit 1
|
||||
|
@ -185,24 +196,20 @@ case $1 in
|
|||
echo "This package does not exists."
|
||||
exit 1
|
||||
fi
|
||||
# TODO dupped code
|
||||
cd ${PKGSRC}/${PKG}
|
||||
`bmake show-var VARNAME=_GENERATE_PLIST | sed -e 's,; true;,,'` | eval awk `bmake show-var VARNAME=_PLIST_AWK_SCRIPT`
|
||||
print_plist ${PKGSRC}/${PKG}
|
||||
else
|
||||
PKG=`package_autocompletion "${2}" "${PKGDB}"`
|
||||
if [ -z "${PKG}" ]; then
|
||||
echo "Package not installed. looking in the pkgsrc tree." > /dev/stderr
|
||||
PKG=`pkgfind -qxn1 "${2}"`
|
||||
if [ -z "${PKG}" ]; then
|
||||
echo "No target package found." >/dev/stderr
|
||||
exit 1
|
||||
echo "Package not installed. looking in the pkgsrc tree." > /dev/stderr
|
||||
PKG=`pkgfind -qxn1 "${2}"`
|
||||
if [ -z "${PKG}" ]; then
|
||||
echo "No target package found." >/dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
print_plist ${PKGSRC}/${PKG}
|
||||
else
|
||||
cat ${PKGDB}/${PKG}/+CONTENTS
|
||||
fi
|
||||
# TODO dupped code
|
||||
cd ${PKGSRC}/${PKG}
|
||||
`bmake show-var VARNAME=_GENERATE_PLIST | sed -e 's,; true;,,'` | eval awk `bmake show-var VARNAME=_PLIST_AWK_SCRIPT`
|
||||
else
|
||||
cat ${PKGDB}/${PKG}/+CONTENTS
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
"-i") # install new fake package
|
||||
|
@ -243,7 +250,7 @@ case $1 in
|
|||
if [ -e "${PKGDB}/${PKG}/+FAKE_ALT" ]; then
|
||||
edit_alternatives ${PKG}
|
||||
else
|
||||
echo "This is not a valid fake alternatives package."
|
||||
echo "This is not a valid fake alternatives package (already have a valid ALTERNATIVES)."
|
||||
fi
|
||||
else
|
||||
:> "${PKGDB}/${PKG}/+FAKE_ALT"
|
||||
|
|
Loading…
Reference in a new issue