Add the comments file, which is a single file containing all the COMMENT
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Add the descrs file, which is a single file containing all the DESCR
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Thanks to Jim Wise for all the work that went into the syspkg sets.
Add the attrs file, which is a single file to which can be added
attributes (like preserve).
Add a regpkg script, which allows a single system package to be
registered, based simply on its setname and syspkg name. All the
information is gleaned from the lists files by means of scripts, no
source tree is needed. The version number for the system package is
calculated automatically, based on the most recent mtime of the files
that constitute a system package.
Add a regpkgset script, to register all the system packages in a set.
The set names recognised are "all", "base", "comp", "etc", "games",
"man", "misc", "text".
2003-06-13 00:04:00 +04:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
2004-01-16 13:05:10 +03:00
|
|
|
# $NetBSD: regpkg,v 1.5 2004/01/16 10:05:10 dyoung Exp $
|
Add the comments file, which is a single file containing all the COMMENT
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Add the descrs file, which is a single file containing all the DESCR
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Thanks to Jim Wise for all the work that went into the syspkg sets.
Add the attrs file, which is a single file to which can be added
attributes (like preserve).
Add a regpkg script, which allows a single system package to be
registered, based simply on its setname and syspkg name. All the
information is gleaned from the lists files by means of scripts, no
source tree is needed. The version number for the system package is
calculated automatically, based on the most recent mtime of the files
that constitute a system package.
Add a regpkgset script, to register all the system packages in a set.
The set names recognised are "all", "base", "comp", "etc", "games",
"man", "misc", "text".
2003-06-13 00:04:00 +04:00
|
|
|
#
|
|
|
|
# Copyright (c) 2003 Alistair G. Crooks. 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.
|
|
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
|
|
# must display the following acknowledgement:
|
|
|
|
# This product includes software developed by Alistair G. Crooks.
|
|
|
|
# for the NetBSD project.
|
|
|
|
# 4. The name of the author may not be used to endorse or promote
|
|
|
|
# products derived from this software without specific prior written
|
|
|
|
# permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Usage: regpkg set pkgname
|
|
|
|
|
|
|
|
SYSPKGROOT=${PKG_DBDIR:-/var/db/pkg}
|
|
|
|
case "${SYSPKG_DBDIR}" in
|
|
|
|
"") ;;
|
|
|
|
*) SYSPKGROOT=${SYSPKG_DBDIR} ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
PLIST=/tmp/.PLIST.$$
|
|
|
|
|
|
|
|
verbose=""
|
|
|
|
while [ $# -gt 2 ]; do
|
|
|
|
case $1 in
|
|
|
|
-v) verbose=$1 ;;
|
|
|
|
*) break ;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
echo "Usage: regpkg set pkgname"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
pkgset=$1
|
|
|
|
|
|
|
|
pkg=$2
|
|
|
|
|
|
|
|
case $verbose in
|
|
|
|
-v) echo "Making PLIST for \"$pkgset\" set and \"$pkg\" package" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# create the skeleton PLIST from the pkgset description
|
|
|
|
./makeplist $pkgset $pkg > $PLIST
|
|
|
|
|
2003-06-13 06:32:26 +04:00
|
|
|
# create the pkg tiny version
|
2003-06-18 14:53:52 +04:00
|
|
|
case "${SYSPKG_DATES}" in
|
|
|
|
"") tinyvers=`awk '$1 ~ '/$pkg/' { print $2 }' versions`
|
|
|
|
case "$tinyvers" in
|
|
|
|
"") tinyvers=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [ -f ../../sys/conf/osrelease.sh ]; then
|
|
|
|
osvers=`sh ../../sys/conf/osrelease.sh`
|
2003-06-23 13:25:34 +04:00
|
|
|
method=osreleases
|
2003-06-18 14:53:52 +04:00
|
|
|
else
|
|
|
|
osvers=`uname -r`
|
|
|
|
method=uname
|
|
|
|
fi
|
|
|
|
t=$osvers.$tinyvers
|
|
|
|
;;
|
|
|
|
*) args=`awk '
|
|
|
|
/^@cwd/ { prefix = $2; next }
|
|
|
|
/^@dirrm/ { next }
|
|
|
|
{ printf("%s%s\n", prefix, $0) }' $PLIST`
|
|
|
|
# first try for any RCS identifiers in the files
|
|
|
|
t=0
|
|
|
|
case "$args" in
|
|
|
|
"") ;;
|
|
|
|
*) t=`ident $args 2>/dev/null | awk '
|
|
|
|
BEGIN { last = 0 }
|
|
|
|
$2 == "crt0.c,v" { next }
|
|
|
|
NF == 8 { t = $4; gsub("/", "", t); if (t > last) last = t; }
|
|
|
|
END { print last }'`
|
|
|
|
method=ident
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
case "$t" in
|
|
|
|
0) # we need the last mtime of the files which make up the package
|
|
|
|
t=`env TZ=UTC LOCALE=C ls -lT $args | awk '
|
|
|
|
BEGIN { newest = 0 }
|
|
|
|
{
|
|
|
|
t = $9 "";
|
|
|
|
if ($6 == "Jan") t = t "01";
|
|
|
|
if ($6 == "Feb") t = t "02";
|
|
|
|
if ($6 == "Mar") t = t "03";
|
|
|
|
if ($6 == "Apr") t = t "04";
|
|
|
|
if ($6 == "May") t = t "05";
|
|
|
|
if ($6 == "Jun") t = t "06";
|
|
|
|
if ($6 == "Jul") t = t "07";
|
|
|
|
if ($6 == "Aug") t = t "08";
|
|
|
|
if ($6 == "Sep") t = t "09";
|
|
|
|
if ($6 == "Oct") t = t "10";
|
|
|
|
if ($6 == "Nov") t = t "11";
|
|
|
|
if ($6 == "Dec") t = t "12";
|
|
|
|
if ($7 < 10) t = t "0";
|
|
|
|
t = t $7;
|
|
|
|
#these next two lines add the 24h clock onto the date
|
|
|
|
#gsub(":", "", $8);
|
|
|
|
#t = sprintf("%s.%4.4s", t, $8);
|
|
|
|
if (t > newest) newest = t;
|
|
|
|
}
|
|
|
|
END { print newest }'`
|
|
|
|
method=ls
|
|
|
|
;;
|
|
|
|
esac
|
2003-06-13 06:32:26 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2003-06-18 14:53:52 +04:00
|
|
|
# print version number that we're using
|
|
|
|
case "$verbose" in
|
|
|
|
-v) echo "$pkg - $t version using $method method" ;;
|
|
|
|
esac
|
Add the comments file, which is a single file containing all the COMMENT
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Add the descrs file, which is a single file containing all the DESCR
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Thanks to Jim Wise for all the work that went into the syspkg sets.
Add the attrs file, which is a single file to which can be added
attributes (like preserve).
Add a regpkg script, which allows a single system package to be
registered, based simply on its setname and syspkg name. All the
information is gleaned from the lists files by means of scripts, no
source tree is needed. The version number for the system package is
calculated automatically, based on the most recent mtime of the files
that constitute a system package.
Add a regpkgset script, to register all the system packages in a set.
The set names recognised are "all", "base", "comp", "etc", "games",
"man", "misc", "text".
2003-06-13 00:04:00 +04:00
|
|
|
|
|
|
|
# create the directory and minimal contents
|
|
|
|
SYSPKGDIR=${SYSPKGROOT}/$pkg-$t
|
|
|
|
if [ -d ${SYSPKGDIR} ]; then
|
|
|
|
echo "There is already a $pkg-$t package installed (${SYSPKGDIR})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p ${SYSPKGDIR}
|
|
|
|
|
2003-06-23 13:25:34 +04:00
|
|
|
# add the dependencies
|
|
|
|
awk '$1 ~ '/$pkg/' { print $2 }' deps | sort | \
|
|
|
|
awk '{ print "@pkgdep " $1 "-[0-9]*" }' >> $PLIST
|
|
|
|
|
Add the comments file, which is a single file containing all the COMMENT
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Add the descrs file, which is a single file containing all the DESCR
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Thanks to Jim Wise for all the work that went into the syspkg sets.
Add the attrs file, which is a single file to which can be added
attributes (like preserve).
Add a regpkg script, which allows a single system package to be
registered, based simply on its setname and syspkg name. All the
information is gleaned from the lists files by means of scripts, no
source tree is needed. The version number for the system package is
calculated automatically, based on the most recent mtime of the files
that constitute a system package.
Add a regpkgset script, to register all the system packages in a set.
The set names recognised are "all", "base", "comp", "etc", "games",
"man", "misc", "text".
2003-06-13 00:04:00 +04:00
|
|
|
# create the comment
|
|
|
|
comment=`awk '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' comments`
|
|
|
|
case "$comment" in
|
|
|
|
"") echo "***WARNING ***: no comment for \"$pkg\"" 2>&1
|
|
|
|
comment="System package for $pkg"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "$comment" > ${SYSPKGDIR}/+COMMENT
|
|
|
|
|
|
|
|
# create the description
|
|
|
|
descr=`awk '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' descrs`
|
|
|
|
case "$descr" in
|
|
|
|
"") echo "***WARNING ***: no description for \"$pkg\"" 2>&1
|
|
|
|
descr="System package for $pkg"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "$descr" > ${SYSPKGDIR}/+DESC
|
|
|
|
printf "\nHomepage:\nhttp://www.NetBSD.org/\n" >> ${SYSPKGDIR}/+DESC
|
|
|
|
|
|
|
|
# create the build information
|
2004-01-16 13:05:10 +03:00
|
|
|
if [ x${BUILD_INFO_CACHE} = x ]; then
|
|
|
|
{
|
|
|
|
echo "OPSYS=`uname -s`"
|
|
|
|
echo "OS_VERSION=`uname -r`"
|
|
|
|
make -f- all <<EOF
|
2003-06-23 13:25:34 +04:00
|
|
|
.include <bsd.own.mk>
|
|
|
|
all:
|
|
|
|
@echo OBJECT_FMT=${OBJECT_FMT}
|
|
|
|
@echo MACHINE_ARCH=${MACHINE_ARCH}
|
|
|
|
@echo MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH}
|
|
|
|
EOF
|
2004-01-16 13:05:10 +03:00
|
|
|
echo "_PKGTOOLS_VER=`pkg_create -V`"
|
|
|
|
} > ${SYSPKGDIR}/+BUILD_INFO
|
|
|
|
else
|
|
|
|
cp ${BUILD_INFO_CACHE} ${SYSPKGDIR}/+BUILD_INFO
|
|
|
|
fi
|
Add the comments file, which is a single file containing all the COMMENT
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Add the descrs file, which is a single file containing all the DESCR
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Thanks to Jim Wise for all the work that went into the syspkg sets.
Add the attrs file, which is a single file to which can be added
attributes (like preserve).
Add a regpkg script, which allows a single system package to be
registered, based simply on its setname and syspkg name. All the
information is gleaned from the lists files by means of scripts, no
source tree is needed. The version number for the system package is
calculated automatically, based on the most recent mtime of the files
that constitute a system package.
Add a regpkgset script, to register all the system packages in a set.
The set names recognised are "all", "base", "comp", "etc", "games",
"man", "misc", "text".
2003-06-13 00:04:00 +04:00
|
|
|
|
|
|
|
# test for attributes
|
|
|
|
args=""
|
|
|
|
attrs=`awk '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' attrs`
|
|
|
|
for a in "$attrs"; do
|
|
|
|
case "$attrs" in
|
|
|
|
"") ;;
|
|
|
|
preserve) echo "$pkg-$t" > ${SYSPKGDIR}/+PRESERVE
|
|
|
|
args="$args -n ${SYSPKGDIR}/+PRESERVE"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
pkg_create -v -c ${SYSPKGDIR}/+COMMENT \
|
|
|
|
-d ${SYSPKGDIR}/+DESC \
|
|
|
|
$args \
|
|
|
|
-f $PLIST -l -b /dev/null -B ${SYSPKGDIR}/+BUILD_INFO \
|
2004-01-16 13:05:10 +03:00
|
|
|
-s /dev/null -S /dev/null -O $pkg-$t.tgz \
|
Add the comments file, which is a single file containing all the COMMENT
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Add the descrs file, which is a single file containing all the DESCR
file entries from the syspkg hierarchy, brought up to date to include some
that had been missed out.
Thanks to Jim Wise for all the work that went into the syspkg sets.
Add the attrs file, which is a single file to which can be added
attributes (like preserve).
Add a regpkg script, which allows a single system package to be
registered, based simply on its setname and syspkg name. All the
information is gleaned from the lists files by means of scripts, no
source tree is needed. The version number for the system package is
calculated automatically, based on the most recent mtime of the files
that constitute a system package.
Add a regpkgset script, to register all the system packages in a set.
The set names recognised are "all", "base", "comp", "etc", "games",
"man", "misc", "text".
2003-06-13 00:04:00 +04:00
|
|
|
> ${SYSPKGDIR}/+CONTENTS
|
|
|
|
|
2003-06-23 13:25:34 +04:00
|
|
|
rm $PLIST
|