blob: a6495974607bfbc722cc90046f13ae8ee7d8b0e3 (
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#!/bin/sh
# $NetBSD: mkbinarykit,v 1.12 2005/02/18 00:26:07 xtraeme Exp $
#
# Make a binary bootstrap kit and place it in targetdir (or current
# working directory if not specified). The mk.conf.example file is
# copied to /etc/mk.conf (or /etc/mk.conf.example on systems which
# may already have a /etc/mk.conf file) or to the location specified
# by using --mkconf. Run this program from the pkgsrc/bootstrap
# directory.
usage="Usage: $0 "'
[ --force ] [ --targetdir=<tar target dir> ] [ --mkconf=<target> ]
[ --no-build ] [ --workdir=<work dir> ] [ bootstrap script arguments ]'
opsys=`uname -s`
osrev=`uname -r`
ospro=`uname -p`
date=`date +%Y%m%d`
prefix=/usr/pkg
sysconfdir=/etc
pkgdbdir=/var/db/pkg
mkfile=$sysconfdir/mk.conf
ignorecasecheck=no
ignoreusercheck=no
force=no
build=yes
targetdir=`pwd`
wrkdir=work # default: relative to pkgsrc/bootstrap
sedprog="sed"
case "$opsys" in
AIX)
syscondir=$prefix/etc
mkfile=$sysconfdir/mk.conf
pkgdbdir=$prefix/pkgdb
;;
DragonFly)
# Don't use the ports /var/db/pkg
pkgdbdir=$prefix/pkgdb
;;
FreeBSD)
# Don't use the ports /var/db/pkg
pkgdbdir=$prefix/pkgdb
;;
Interix)
mkfile=$sysconfdir/mk.conf.example
# Don't use the interopsystems.com package dir
pkgdbdir=$prefix/pkgdb
ospro=i386
;;
NetBSD)
# Don't overwrite the system's mk.conf
mkfile=$sysconfdir/mk.conf.example
;;
OpenBSD)
# Don't overwrite the system's mk.conf
mkfile=$sysconfdir/mk.conf.example
# Don't use the ports /var/db/pkg
pkgdbdir=$prefix/pkgdb
# Use "arch -s" instead of uname -p
ospro=`arch -s`
;;
SunOS)
sedprog=/usr/xpg4/bin/sed
;;
esac
while [ $# -gt 0 ]; do
case $1 in
--force) force=yes ;;
--no-build) build=no ;;
--targetdir=*) targetdir=`echo $1 | $sedprog -e 's|--targetdir=||'` ;;
--prefix=*) prefix=`echo $1 | $sedprog -e 's|--prefix=||'` ;;
--mkconf=*) mkfile=`echo $1 | $sedprog -e 's|--mkconf=||'` ;;
--pkgdbdir=*) pkgdbdir=`echo $1 | $sedprog -e 's|--pkgdbdir=||'` ;;
--ignore-case-check) ignorecasecheck=yes ;;
--ignore-user-check) ignoreusercheck=yes ;;
--workdir=*) wrkdir=`echo $1 | $sedprog -e 's|--workdir=||'` ;;
--*) echo "$usage"; exit 1 ;;
esac
shift
done
if [ "$build" = "yes" ] && [ "$force" != "yes" ]; then
if [ -d "$prefix" ] || [ -d "$pkgdbdir" ]; then
echo "Some pkgsrc infrastructure exists on this system already."
echo "Use --force to move it out of the way."
exit 1
fi
elif [ "$build" = "yes" ]; then
mv -f "$prefix" "$prefix.$$"
mv -f "$pkgdbdir" "$pkgdbdir.$$"
mv -f "$mkfile" "$mkfile.$$"
fi
if [ "$build" != "no" ]; then
# Bootstrap
bootstrap_flags="--prefix=$prefix --pkgdbdir=$pkgdbdir --workdir=$wrkdir"
if [ "$ignorecasecheck" = "yes" ]; then
bootstrap_flags="$bootstrap_flags --ignore-case-check"
fi
if [ "$ignoreusercheck" = "yes" ]; then
bootstrap_flags="$bootstrap_flags --ignore-user-check"
fi
echo "Making bootstrap kit with"
echo "prefix = $prefix"
echo "pkgdbdir = $pkgdbdir"
echo "mk.conf.example will be copied to $mkfile"
echo ""
./cleanup $wrkdir
./bootstrap $bootstrap_flags
if [ $? != "0" ]; then
echo "Bootstrap error."
exit 1;
fi
fi
# Make a tar ball
strip=strip
if [ -x /usr/ccs/bin/strip ]; then
strip=/usr/ccs/bin/strip
fi
echo "Stripping binaries..."
$strip "$prefix/"bin/*
$strip "$prefix/"sbin/*
echo "Making binary kit."
PATH="$prefix/bin:$PATH"; export PATH # in case tar was built by bootstrap
[ ! -d $sysconfdir ] && mkdir -p $sysconfdir
cp ${wrkdir}/mk.conf.example $mkfile && \
cd / && \
tar -hcf "$targetdir/bootstrap-pkgsrc-$opsys-$osrev-$ospro-$date.tar" \
.$prefix .$pkgdbdir .$mkfile && \
ls -l "$targetdir/bootstrap-pkgsrc-$opsys-$osrev-$ospro-$date.tar"
|