5 # makesrctars srcdir setdir
6 # Create source tarballs in setdir from the source under srcdir.
10 rundir
="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
11 .
"${rundir}/sets.subr"
23 Usage: ${prog} [-N password/group dir] [-q] [-x xsrcdir] [-y extsrcsrcdir] srcdir setdir
24 -N dir location which contains master.passwd and group files
25 (defaults to \${srcdir}/etc)
27 -x xsrcdir build xsrc.tgz from xsrcdir
28 -y extsrcsrcdir build extsrc.tgz from extsrcsrcdir
29 srcdir location of sources
30 setdir where to write the .tgz files to
42 while getopts N
:qx
:y
: ch
; do
51 extsrcsrcdir
="${OPTARG}"
61 shift $
((${OPTIND} - 1))
68 : ${PASSWD:="${srcdir}/etc"}
70 if [ ! -d "${setdir}" ]; then
71 echo >&2 "${prog}: ${setdir} is not a directory"
83 if [ "${dir}" != "." ]; then
85 srcprefix
="${srcprefix}/${dir}"
87 # Gets rid of any obj dirs and things below it
88 echo "obj" > "${intmp}"
90 if [ "${egrep}" = "" ]; then
94 ${MTREE} -c -X "${intmp}" | ${MTREE} -CS -k type | \
95 ${EGREP} -v 'type=link' | ${EGREP} ${egrep} | \
96 ${SED} -e 's:type=file:& mode=0664:' \
97 -e 's:type=dir:& mode=0775:' \
98 -e 's:$: uname=root gname=wsrc:' \
99 -e '/\/move-if-change /s:\(mode\)=[0-9]*:\1=0775:' \
100 -e '/^\.\/build.sh /s:\(mode\)=[0-9]*:\1=0775:' | \
101 ${PAX} -M -N "${PASSWD}" -w -d -s'|^\.|'"${srcprefix}"'|' | \
102 ${GZIP_CMD} > "${setdir}/${set}"
107 # create (base)src sets
110 if ! cd "${srcdir}"; then
111 echo >&2 "${prog}: can't chdir to ${srcdir}"
116 export setdir MTREE PAX CKSUM GZIP PASSWD srcprefix
118 makeset src .
-v '^\.\/gnu|^\.\/share|^\.\/sys|^\.\/usr\.bin\/config|^\.\/common'
122 makeset syssrc .
-e '^\..type=dir|^\.\/sys|^\.\/usr\.bin.type=dir|^\.\/usr\.bin\/config|^\.\/common'
124 makeset sharesrc share
129 if [ -n "${xsrcdir}" ]; then
130 if ! cd "${xsrcdir}"; then
131 echo >&2 "${prog}: can't chdir to ${xsrcdir}"
141 if [ -n "${extsrcsrcdir}" ]; then
142 if ! cd "${extsrcsrcdir}"; then
143 echo >&2 "${prog}: can't chdir to ${extsrcsrcdir}"
151 msg
"Creating checksum files"
153 ${CKSUM} -a md5
*.tgz
> MD5
154 ${CKSUM} -a sha512
*.tgz
> SHA512