summaryrefslogtreecommitdiff
path: root/mk/bulk/pre-build
blob: 588f7217409f69f54ecd48b1a5e4b5bb56a45bfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
# $NetBSD: pre-build,v 1.6 2000/12/15 23:08:42 hubertf Exp $
#
# Clean up system to be ready for bulk pkg build
#
# (c) 2000 Hubert Feyrer, All Rights Reserved.
#

#set -v		# Debug

# Pull in USR_PKGSRC, CVS_USER:
if [ -f "$BULK_BUILD_CONF" ]; then
    . $BULK_BUILD_CONF
else
    . `dirname $0`/build.conf
fi


#
# Install cvs package and do a cvs update here
#
if [ "$CVS_USER" != "" ]; then
	if [ ! -f /usr/bin/cvs ]; then
		echo Installing required cvs pkgs for CVS update
		( cd ${USR_PKGSRC}/devel/cvs ; make bulk-install )
	fi
	if [ ! -f /usr/bin/ssh ]; then
		echo Installing required ssh pkgs for CVS update
		( cd ${USR_PKGSRC}/security/ssh ; make bulk-install )
	fi
	echo Performing CVS update - this will take some time
	su - ${CVS_USER} -c 'stty sane ; cd '${USR_PKGSRC}' ; cvs -q update -Pd'
	echo CVS update done.
fi

#
# Remove old/broken distfiles and binary packages
#
echo Removing old/broken distfiles and binary packages
( cd ${USR_PKGSRC}/pkgtools/pkglint ; make bulk-install )
lintpkgsrc -r -P${USR_PKGSRC}
echo done.

#
# Clean out everything and it's mother
#
echo Removing all installed packages 
mount -o async -u /usr

if [ -d /var/db/pkg ]; then
	cd /var/db/pkg
	for pkg in *
	do
		echo pkg_delete -rR $pkg
		pkg_delete -rR $pkg
	done
	for pkg in *
	do
		echo pkg_delete -rR $pkg
		pkg_delete -rR -f $pkg
	done
	
	# We've tried our best to get rid of the pkgs, now do it the hard way
	# If it wasn't for stuff in $X11BASE, I wouldn't have hard feelings
	# about this!
	rm -fr *
fi
	
# General cleanout - easy!
cd /usr/pkg
rm -fr *
rm -fr .??*

# Stuff known to be broken
rm -fr /usr/X11R6/share/gimp
rm -fr /usr/X11R6/share/gnome
rm -fr /usr/X11R6/share/kde
rm -fr /usr/X11R6/share/netscape
rm -fr /var/tmp/inst*
rm -fr /usr/X11R6/lib/libgimp*	# gimp doesn't build with old libs around
rm -fr /nonexistant		# broken useradd on pop3d


# Clean up state files
cd ${USR_PKGSRC}
rm -f .broken* */*/.broken*
rm -f .make* */*/.make*
rm -f .start*

mount -o noasync -u /usr

touch .start.${arch}