Files
ports/Mk/Scripts/npm-create-mtree.sh
T
Hiroki Tagato ed6a84c1c9 Mk/Uses/electron.mk: Split fetch- and extract-related codes out to npm.mk
Prefetch and extract functions are not necessarily limited to electron
ports. Those functions can be utilized by any ports which needs an
offline node modules installation.

Previously, non-electron ports wanting to use prefetch and/or extract
functions needs to use USES=electron:env, which is now removed in
favor of USES=npm:<package manager name>.

The following description:
USES=		electron:env
USE_ELECTRON=	npm:npm-name prefetch extract

is simplified to:
USES=		npm:npm-name
2026-06-27 17:37:34 +09:00

35 lines
642 B
Bash

#!/bin/sh
#
# MAINTAINER: tagattie@FreeBSD.org
PATH=/bin:/usr/bin:/usr/sbin
set -e
set -o pipefail
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_NPM_CREATE_MTREE}" ] && set -x
PREFETCH_TIMESTAMP=61171200 # 1971-12-10 00:00:00 GMT
set -u
usage() {
cat <<EOF
Usage: ${0##*/} dirname
EOF
exit 1
}
if [ $# -ne 1 ]; then
usage
fi
mtree -cbnSp "$1" | mtree -C | \
awk -f "${SCRIPTSDIR}/npm-normalize-permissions.awk" | \
sed -e "s/time=[0-9.]*/time=${PREFETCH_TIMESTAMP}.000000000/" \
-e 's/\([gu]id\)=[0-9]*/\1=0/g' \
-e 's/flags=.*/flags=none/' \
-e "s|^\.|$1|" \
-e "s|^${WRKDIR}/||" \
-e '1d'