1998-12-28 13:27:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2000-05-08 07:37:28 +00:00
|
|
|
# usage: $0 DIRNAME PHASE
|
|
|
|
# PHASE is 1 (checksum) or 2 (package)
|
1998-12-28 13:27:27 +00:00
|
|
|
|
|
|
|
dir=$1
|
2000-05-08 07:37:28 +00:00
|
|
|
phase=$2
|
1998-12-28 13:27:27 +00:00
|
|
|
|
2000-05-08 07:37:28 +00:00
|
|
|
if [ $phase = 1 ]; then
|
1998-12-28 13:27:27 +00:00
|
|
|
|
2000-05-08 07:37:28 +00:00
|
|
|
cd $dir || exit 1
|
|
|
|
echo "maintained by: $(make maintainer)"
|
|
|
|
echo "build started at $(date)"
|
|
|
|
|
|
|
|
cd /tmp/depends
|
|
|
|
if [ "$(echo $(/bin/ls | wc -c))" != 0 ]; then
|
|
|
|
echo "adding dependencies"
|
|
|
|
for i in *.tgz; do
|
|
|
|
echo "pkg_add -f $i"
|
2000-09-27 00:09:10 +00:00
|
|
|
base=$(basename $i .tgz)
|
|
|
|
if pkg_info -q -e $base; then
|
|
|
|
echo "skipping $base, already added"
|
|
|
|
else
|
|
|
|
if ! pkg_add -f $i; then
|
|
|
|
echo "error in dependency $i, exiting"
|
|
|
|
echo "1" > /tmp/status
|
|
|
|
exit 1
|
|
|
|
fi
|
2000-05-08 07:37:28 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $dir || exit 1
|
2000-09-27 00:09:10 +00:00
|
|
|
pkgname=$(make package-name)
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "================================================================"
|
|
|
|
echo "====================<phase 1: make checksum>===================="
|
|
|
|
|
2000-09-27 00:09:10 +00:00
|
|
|
if /pnohang $TIMEOUT /tmp/make.log1 ${pkgname} make checksum; then
|
|
|
|
cat /tmp/make.log1
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "0" > /tmp/status
|
|
|
|
else
|
2000-09-27 00:09:10 +00:00
|
|
|
cat /tmp/make.log1
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "1" > /tmp/status
|
|
|
|
echo "================================================================"
|
|
|
|
echo -n "build ended at "
|
|
|
|
date
|
|
|
|
fi
|
1999-09-22 00:57:02 +00:00
|
|
|
|
1998-12-28 13:27:27 +00:00
|
|
|
else
|
|
|
|
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "====================<phase 2: make package>====================="
|
|
|
|
xvfb=0
|
|
|
|
if which -s Xvfb; then
|
|
|
|
xvfb=1
|
|
|
|
pid=$(echo $$ % 32768 | bc)
|
|
|
|
X11BASE=$(which Xvfb | sed -e 's./bin/Xvfb..')
|
|
|
|
Xvfb :${pid} -fp ${X11BASE}/lib/X11/fonts/misc &
|
|
|
|
DISPLAY=:${pid}
|
|
|
|
export DISPLAY
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $dir || exit 1
|
2000-09-27 00:09:10 +00:00
|
|
|
pkgname=$(make package-name)
|
|
|
|
if /pnohang $TIMEOUT /tmp/make.log2 ${pkgname} make package; then
|
|
|
|
cat /tmp/make.log2
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "0" > /tmp/status
|
|
|
|
prefix=$(make -V PREFIX)
|
|
|
|
mtreefile=$(make -V MTREE_FILE)
|
|
|
|
echo "================================================================"
|
|
|
|
echo "checking installed files"
|
2000-08-29 08:22:39 +00:00
|
|
|
find ${prefix} \( \( -perm -4000 -o -perm -2000 -a \! -type d \) -o \( -perm -0002 -o -perm -0020 \) \) -a \! -type l -ls | sort > /tmp/list1
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "pkg_delete ${pkgname}"
|
|
|
|
pkg_delete ${pkgname}
|
2000-08-29 08:22:39 +00:00
|
|
|
find ${prefix} \( \( -perm -4000 -o -perm -2000 -a \! -type d \) -o \( -perm -0002 -o -perm -0020 \) \) -a \! -type l -ls | sort > /tmp/list2
|
2000-05-08 07:37:28 +00:00
|
|
|
if ! diff -qb /tmp/list1 /tmp/list2 2>/dev/null; then
|
|
|
|
echo "================================================================"
|
|
|
|
echo "found set[ug]id or world-writable files and directories"
|
|
|
|
diff -b /tmp/list2 /tmp/list1 | grep '^>'
|
|
|
|
fi
|
|
|
|
cd /var/db/pkg
|
|
|
|
if [ $(echo $(echo * | wc -c)) != 2 ]; then
|
|
|
|
echo "================================================================"
|
|
|
|
echo "deleting dependencies"
|
|
|
|
prevlist=""
|
|
|
|
count=1
|
|
|
|
while [ $(echo $(echo * | wc -c)) != 2 -a $(echo $(echo * | wc -c)) != $(echo $(echo $prevlist | wc -c)) ]; do
|
|
|
|
echo "== phase $count =="
|
|
|
|
prevlist="$(echo *)"
|
|
|
|
for i in *; do
|
|
|
|
echo "pkg_delete $i"
|
|
|
|
pkg_delete $i
|
|
|
|
done
|
|
|
|
count=$(($count + 1))
|
|
|
|
done
|
|
|
|
if [ $(echo $(echo * | wc -c)) != 2 ]; then
|
|
|
|
echo "leftover packages:" *
|
|
|
|
# for i in *; do
|
|
|
|
# echo "pkg_delete -f $i"
|
|
|
|
# pkg_delete -f $i
|
|
|
|
# done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
cd /var/db/pkg
|
|
|
|
if [ "x${mtreefile}" != "x" ]; then
|
|
|
|
mtree -f ${mtreefile} -p ${prefix} > /tmp/list3
|
|
|
|
if [ -s /tmp/list3 ]; then
|
2000-07-02 09:32:30 +00:00
|
|
|
if [ "x${NOPLISTCHECK}" = "x" ]; then
|
2000-07-05 17:49:46 +00:00
|
|
|
echo "1" > /tmp/status
|
2000-07-02 09:32:30 +00:00
|
|
|
fi
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "================================================================"
|
|
|
|
echo "list of extra files and directories in ${prefix}"
|
|
|
|
cat /tmp/list3
|
|
|
|
echo "list of all files and directories in ${prefix}"
|
|
|
|
cd ${prefix}
|
|
|
|
find . -exec echo -n 'path: ' \; -exec ls -1d \{} \; | sort
|
2000-07-02 09:32:30 +00:00
|
|
|
echo "ls -alR ${prefix}"
|
|
|
|
ls -alR ${prefix}
|
2000-05-08 07:37:28 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
2000-09-27 00:09:10 +00:00
|
|
|
cat /tmp/make.log2
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "1" > /tmp/status
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${xvfb} = 1 ]; then
|
|
|
|
kill $(jobid %1)
|
|
|
|
fi
|
1999-09-22 00:57:02 +00:00
|
|
|
|
2000-05-08 07:37:28 +00:00
|
|
|
echo "================================================================"
|
|
|
|
echo -n "build ended at "
|
|
|
|
date
|
|
|
|
|
|
|
|
fi
|
1999-06-22 10:13:23 +00:00
|
|
|
|
1998-12-28 13:27:27 +00:00
|
|
|
exit 0
|