-
Notifications
You must be signed in to change notification settings - Fork 4
/
create-deb.sh
executable file
·86 lines (69 loc) · 1.65 KB
/
create-deb.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
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
#!/bin/sh
set -e
if [ ! "`whoami`" = "root" ]; then
echo "This script must be run as root or with fakeroot!"
exit
fi
VERSION=`grep PSPSDK_VERSION= toolchain.sh|cut -d= -f2`
MACHINE=$(uname -m)
if [ "$MACHINE" = "i386" ]; then
ARCH=i386
fi
if [ "$MACHINE" = "i686" ]; then
ARCH=i386
fi
if [ "$MACHINE" = "x86_64" ]; then
ARCH=amd64
fi
rm -Rf minpspw-$VERSION || true
mkdir minpspw-$VERSION
chown root:root minpspw-$VERSION
cd minpspw-$VERSION
# create basic debian-binary
echo 2.0 > debian-binary
# create the data package
mkdir -p opt
cp -Rf $(pwd)/../../pspsdk opt
chown -R root:root ./opt
tar -cf data.tar ./opt
lzma --best data.tar
# create control file
cat >> control <<EOF
Package: minpspw-pspsdk
Version: $VERSION
Maintainer: Paulo Lopes <pmlopes@gmail.com>
Provides: pspsdk
Conflicts: pspsdk
Replaces: pspsdk
Installed-Size: `du -ks opt|cut -f 1`
Priority: optional
Architecture: $ARCH
Section: devel
Homepage: http://www.jetdrone.com/
Description: PSP Homebrew Development Kit $VERSION
The MinPSPW is a development environment for building applications,
games, and components targetting the Playstation Portable.
EOF
cat >> preinst <<EOF
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
exit 0
EOF
chmod a+x preinst
cat >> postrm <<EOF
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
exit 0
EOF
chmod a+x postrm
GZIP=--best tar czf control.tar.gz control preinst postrm
# create deb
ar -r ../minpspw_$VERSION-1ubuntu0_$ARCH.deb debian-binary control.tar.gz data.tar.lzma
# for convenience save the tar
cp data.tar.lzma ../minpspw_$VERSION-$ARCH.tar.lzma
cd ..
# convert to rpm
alien -r -k minpspw_$VERSION-1ubuntu0_$ARCH.deb
rm -Rf minpspw-$VERSION