-
Notifications
You must be signed in to change notification settings - Fork 1
/
mkpkg.sh
54 lines (38 loc) · 1.24 KB
/
mkpkg.sh
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
#!/bin/sh
# Create makesbld package
# if VERSION file not there, then quit
[ ! -r VERSION ] && exit 1
PKGNAME=makesbld
VERSION=`cat VERSION|grep VERSION|cut -d= -f2`
COPYRIGHTDATE=`cat VERSION|grep COPYRIGHTDATE|cut -d= -f2`
REV=`cat VERSION|grep REV|cut -d= -f2`
PKGDIR=$PWD/../
TMPDIR=/tmp
BUILDDIR=${TMPDIR}/${PKGNAME}
# copy files over to temp
[ -d $BUILDDIR ] && rm -fr $BUILDDIR
mkdir -p $BUILDDIR
cp -va install etc usr $BUILDDIR
# use sed to install version in needed files
cd $BUILDDIR
for file in "install/slack-desc" "usr/bin/makesbld-d.sh" "usr/man/man1/makesbld.1" \
"usr/man/man5/makesbld.inc.5" "usr/man/man5/makesbld.conf.5" \
"usr/lib/makesbld/makesbld.inc" "etc/makesbld/makesbld.conf"
do
sed -i -e "s^%%ver%%^$VERSION^" \
-e "s^%%date%%^$COPYRIGHTDATE^" $file
done
for file in mirrors.conf makesbld.conf
do
(cd etc/makesbld; mv $file $file.new)
done
# delete any backup files
find . -type f -name '*~' -print0 | xargs -0r rm
# rename doc dir
mv -v usr/doc/${PKGNAME} usr/doc/${PKGNAME}-${VERSION}
# gzip everything in man and doc
gzip -v9 usr/doc/*/*
gzip -v9 usr/man/*/*
# make package
/sbin/makepkg -c n -l n ${PKGDIR}/${PKGNAME}-${VERSION}-noarch-${REV}.txz
echo "Package $PKGNAME-$VERSION has been stored in $PKGDIR."