Skip to content

Commit

Permalink
fix some scripts.
Browse files Browse the repository at this point in the history
mark some things deprecated.
  • Loading branch information
laffer1 committed Mar 9, 2025
1 parent 5ede837 commit e366195
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
42 changes: 22 additions & 20 deletions tools/tools/nanobsd/fill_pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
#
#
# Usage:
# $0 PACKAGE_DUMP NANO_PACKAGE_DIR /usr/ports/foo/bar [package.txz]...
# $0 [-cv] PACKAGE_DUMP NANO_PACKAGE_DIR /usr/mports/foo/bar [package.mport]...
#
# Will symlink the packages listed, including their runtime dependencies,
# Will symlink/copy the packages listed, including their runtime dependencies,
# from the PACKAGE_DUMP to the NANO_PACKAGE_DIR.
#

: ${PORTSDIR:=/usr/ports}

usage () {
echo "Usage: $0 [-v] package-dump-dir nano-package-dir port-dir-or-pkg ..." 1>&2
echo "Usage: $0 [-cv] package-dump-dir nano-package-dir port-dir-or-mport ..." 1>&2
exit 2
}

Expand All @@ -53,29 +53,29 @@ ports_recurse() (
for p do
if [ -d "$p" -a -f "$p/Makefile" ] ; then
msg 3 "$p: full path to port"
pkgname=`cd "$p" && make -V pkgname`
pkgname=`cd "$p" && make package-name`
type=port
fullpath=$p
elif [ -d "${PORTSDIR}/$p" -a -f "${PORTSDIR}/$p/Makefile" ] ; then
msg 3 "$p: path to port relative to ${PORTSDIR}}"
pkgname=`cd "${PORTSDIR}/$p" && make -V pkgname`
pkgname=`cd "${PORTSDIR}/$p" && make package-name`
type=port
fullpath=${PORTSDIR}/$p
elif [ "${p%.txz}" != "$p" -a -f "$p" ] && pkg info -F "$p" > /dev/null 2>&1 ; then
elif [ "${p%.mport}" != "$p" -a -f "$p" ] && mport info -F "$p" > /dev/null 2>&1 ; then
msg 3 "$p: full package file name"
pkgname=`basename "$p" | sed 's/\.txz$//I'`
type=pkg
pkgname=`basename "$p" | sed 's/\.mport$//I'`
type=mport
fullpath=$p
elif [ "${p%.txz}" != "$p" -a -f "$dumpdir/$p" ] && pkg info -F "$dumpdir/$p" > /dev/null 2>&1 ; then
elif [ "${p%.mport}" != "$p" -a -f "$dumpdir/$p" ] && mport info -F "$dumpdir/$p" > /dev/null 2>&1 ; then
msg 3 "$p: package file name relative to $dumpdir"
pkgname=`basename "$p" | sed 's/\.txz$//I'`
type=pkg
pkgname=`basename "$p" | sed 's/\.mport$//I'`
type=mport
fullpath=$dumpdir/$p
elif [ -f "$dumpdir/$p.txz" ] && pkg info -F "$dumpdir/$p.txz" > /dev/null 2>&1 ; then
elif [ -f "$dumpdir/$p.mport" ] && mport info -F "$dumpdir/$p.mport" > /dev/null 2>&1 ; then
msg 3 "$p: package name relative to $dumpdir"
pkgname=`basename "$p"`
type=pkg
fullpath=$dumpdir/$p.txz
type=mport
fullpath=$dumpdir/$p.mport
else
echo "Missing port or package $p" 1>&2
exit 2
Expand Down Expand Up @@ -104,9 +104,9 @@ ports_recurse() (
else
dir=${dir}/
fi
deps=`pkg info -dF "$fullpath" | grep -v "$pkgname:"`
deps=`mport info -dF "$fullpath" | grep -v "$pkgname:"`
for dep in $deps ; do
arg=`echo $dep | sed -e "s|^|$dir|" -e 's/$/.txz/'`
arg=`echo $dep | sed -e "s|^|$dir|" -e 's/$/.mport/'`
msg 2 "Check $arg as requirement for package $pkgname"
ports_recurse "$outputfile" "$dumpdir" "$arg"
done
Expand All @@ -116,10 +116,12 @@ ports_recurse() (
done
)

COPY="ln -s"
VERBOSE=0

while getopts v opt ; do
while getopts cv opt ; do
case "$opt" in
c) COPY="cp -p" ;;
v) VERBOSE=$(($VERBOSE + 1)) ;;
[?]) usage ;;
esac
Expand Down Expand Up @@ -155,10 +157,10 @@ for p do
done

for i in `cat "$PL"` ; do
if [ -f "$NANO_PKG_DUMP/$i.txz" ] ; then
ln -s "$NANO_PKG_DUMP/$i.txz" "$NANO_PKG_DIR"
if [ -f "$NANO_PKG_DUMP/$i.mport" ] ; then
$COPY "$NANO_PKG_DUMP/$i.mport" "$NANO_PKG_DIR"
else
echo "Package $i misssing in $NANO_PKG_DUMP" 1>&2
echo "Package $i missing in $NANO_PKG_DUMP" 1>&2
exit 1
fi
done
Expand Down
18 changes: 9 additions & 9 deletions tools/tools/nanobsd/legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,30 @@ calculate_partitioning ( ) (
}
# First image partition start at second track
print $3, isl * cs - $3
print $3, isl * cs - $3, 1
c = isl * cs;
# Second image partition (if any) also starts offset one
# track to keep them identical.
if ($2 > 1) {
print $3 + c, isl * cs - $3
print $3 + c, isl * cs - $3, 2
c += isl * cs;
}
# Config partition starts at cylinder boundary.
print c, csl * cs
print c, csl * cs, 3
c += csl * cs
# Data partition (if any) starts at cylinder boundary.
if ($7 > 0) {
print c, dsl * cs
print c, dsl * cs, 4
} else if ($7 < 0 && $1 > c) {
print c, $1 - c
print c, $1 - c, 4
} else if ($1 < c) {
print "Disk space overcommitted by", \
c - $1, "sectors" > "/dev/stderr"
exit 2
}
}
' > ${NANO_LOG}/_.partitioning
)
Expand Down Expand Up @@ -116,14 +115,15 @@ create_code_slice ( ) (

trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT

bsdlabel -w ${MD}
gpart create -s bsd "${MD}"
gpart add -t mnbsd-ufs -b 16 "${MD}"
if [ -f ${NANO_WORLDDIR}/boot/boot ]; then
echo "Making bootable partition"
gpart bootcode -b ${NANO_WORLDDIR}/boot/boot ${MD}
else
echo "Partition will not be bootable"
fi
bsdlabel ${MD}
gpart list ${MD}

# Create first image
populate_slice /dev/${MD}${NANO_PARTITION_ROOT} ${NANO_WORLDDIR} ${MNT} "${NANO_ROOT}"
Expand Down Expand Up @@ -173,7 +173,7 @@ create_diskimage ( ) (
}
{
# Make partition
print "gpart add -t freebsd -b ", $1, " -s ", $2, " $1"
print "gpart add -t midnightbsd -b ", $1, " -s ", $2, " -i ", $3, " $1"
}
END {
# Force slice 1 to be marked active. This is necessary
Expand Down
2 changes: 1 addition & 1 deletion tools/tools/nanobsd/mtree-dedup.awk
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function mtree_from_kvs(path, kvs)
return lv;
}

# Parse the mtree line into path + KVs. Use a sentinal value
# Parse the mtree line into path + KVs. Use a sentinel value
# for a bare keyword, which is extremely unlikely to be used
# for real.
function line2kv(kvs, str)
Expand Down
4 changes: 0 additions & 4 deletions tools/tools/nanobsd/nanobsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ if [ ! -d "${NANO_TOOLS}" ]; then
exit 1
fi

if ! $do_clean; then
NANO_PMAKE="${NANO_PMAKE} -DNO_CLEAN"
fi

pprint 1 "NanoBSD image ${NANO_NAME} build starting"

run_early_customize
Expand Down
1 change: 1 addition & 0 deletions usr.bin/keylogout/keylogout.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ main(int argc, char **argv)
{
static char secret[HEXKEYBYTES + 1];

fprintf(stderr, "keylogin is deprecated and will be removed.\n");
if (geteuid() == 0) {
if ((argc != 2 ) || (strcmp(argv[1], "-f") != 0)) {
fprintf(stderr,
Expand Down
1 change: 1 addition & 0 deletions usr.bin/newkey/newkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ main(int argc, char *argv[])
struct hostent *h;
#endif

fprintf(stderr, "newkey is deprecated and will be removed.\n");
if (argc != 3 || !(strcmp(argv[1], "-u") == 0 ||
strcmp(argv[1], "-h") == 0)) {
usage();
Expand Down
2 changes: 1 addition & 1 deletion usr.bin/proccontrol/proccontrol.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Copyright (c) 2019 The FreeBSD Foundation, Inc.
.\" Copyright (c) 2019 The FreeBSD Foundation
.\"
.\" This documentation was written by
.\" Konstantin Belousov <[email protected]> under sponsorship
Expand Down

0 comments on commit e366195

Please sign in to comment.