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
|
# Maintainer: Markus Heidelberg <markus dot heidelberg at web dot de>
pkgname=microchip-libraries-for-applications-legacy
pkgver=v2013_06_15
pkgrel=4
pkgdesc="Microchip Libraries for Applications (Legacy)"
arch=('i686' 'x86_64')
url="http://www.microchip.com/MLA"
license=('custom')
optdepends=('java-runtime: Graphics and TCP/IP utilities support')
makedepends=('fakechroot')
makedepends_x86_64=('lib32-fakechroot' 'lib32-fakeroot')
depends_x86_64=('lib32-glibc')
options=(!strip libtool staticlibs emptydirs !zipman)
install=$pkgname.install
_instdir=/opt/microchip_solutions
_installer=${pkgname//-legacy/}-${pkgver//_/-}-linux-installer.run
source=(http://ww1.microchip.com/downloads/en/softwarelibrary/$_installer
LICENSE)
md5sums=('d3d6597c7aebe122325dd491b41022d6'
'dd2eec20ed33d2924fa301cea78467fa')
package() {
cd "$srcdir"
mkdir -p "$pkgdir"/{bin,etc,usr/{bin,lib,local/lib},tmp}
ln -s /bin/bash "$pkgdir/bin/"
echo "root:x:0:0:root:/root:/bin/bash" > "$pkgdir/etc/passwd"
echo "root:x:0:root" > "$pkgdir/etc/group"
cp "$srcdir/$_installer" "$pkgdir/"
chmod 0755 "$pkgdir/$_installer"
# 10x enter: read license
# 1x y + enter: accept license [y/n]
# 1x enter: accept installation directory
# 13x enter: select components [Y/n]
# 1x enter: confirm selection [Y/n]
# 1x enter: start installation [Y/n]
# 1x enter: continue
# 1x n + enter: download JRE [Y/n]
# 1x n + enter: open ReadMe [Y/n]
echo -e "\n\n\n\n\n\n\n\n\n\ny\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nn\nn" > "$pkgdir/inst_input"
# do not use $pkgdir$_instdir as installation directory because of the fakechroot environment
echo "#!/bin/bash
./$_installer --prefix "$_instdir" --mode text < inst_input &> /dev/null || true"> "$pkgdir/chroot_input.sh"
chmod 0755 "$pkgdir/chroot_input.sh"
echo -e "Creating the Package\n Please wait..."
fakechroot chroot "$pkgdir" ./chroot_input.sh
rm "$pkgdir"/{chroot_input.sh,inst_input,$_installer,etc/{group,passwd}}
rm -r "$pkgdir"/{bin,tmp}
# remove unwanted files created by the installer, already available in package "microchip-mplabx-bin"
rm -r "$pkgdir"/{etc,usr/{bin,lib,local}}
rm "$pkgdir$_instdir"/Uninstall*
# fix totally messed up file permissions
find "$pkgdir$_instdir" -type d -exec chmod 0755 '{}' \; -exec chmod ug-s '{}' \;
find "$pkgdir$_instdir" -type f -exec chmod 0644 '{}' \;
install -Dm644 "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# executable files
install -d "$pkgdir/usr/bin"
# Graphics Resource Converter
cat << EOF > "$pkgdir/usr/bin/grc-legacy"
#!/bin/sh
java -jar "$_instdir/Microchip/Graphics/bin/grc/grc.jar" "\$@"
EOF
chmod 755 "$pkgdir/usr/bin/grc-legacy"
# External Memory Programmer
cat << EOF > "$pkgdir/usr/bin/memory_programmer-legacy"
#!/bin/sh
java -jar "$_instdir/Microchip/Graphics/bin/memory_programmer/memory_programmer.jar" "\$@"
EOF
chmod 755 "$pkgdir/usr/bin/memory_programmer-legacy"
# Microchip 2 Binary Information Base
cat << EOF > "$pkgdir/usr/bin/mib2bib"
#!/bin/sh
java -jar "$_instdir/Microchip/TCPIP Stack/Utilities/mib2bib.jar" "\$@"
EOF
chmod 755 "$pkgdir/usr/bin/mib2bib"
# Microchip MPFS Generator
cat << EOF > "$pkgdir/usr/bin/mpfs2"
#!/bin/sh
java -jar "$_instdir/Microchip/TCPIP Stack/Utilities/MPFS2.jar" "\$@"
EOF
chmod 755 "$pkgdir/usr/bin/mpfs2"
# Microchip Hash Table Filter Entry Calculator"
cat << EOF > "$pkgdir/usr/bin/hash_calculator"
#!/bin/sh
java -jar "$_instdir/Microchip/TCPIP Stack/Utilities/Hash Calculator.jar"
EOF
chmod 755 "$pkgdir/usr/bin/hash_calculator"
# Microchip TCPIP Discoverer
cat << EOF > "$pkgdir/usr/bin/tcpip_discoverer"
#!/bin/sh
java -jar "$_instdir/Microchip/TCPIP Stack/Utilities/TCPIP Discoverer.jar"
EOF
chmod 755 "$pkgdir/usr/bin/tcpip_discoverer"
}
|