blob: ce1a5821b6cc2fe24730f3b983a68bfc30ee98ae (
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
# Maintainer: Rudi [KittyCash] <rudi@skycoinmail.com>
_projectname=skycoin
pkgname=skywire
_pkgname=${pkgname}
_githuborg=${_projectname}
pkgdesc="Skywire Mainnet Node implementation. Binary Release. Debian package"
#set to native architecture with dpkg
_pkgarch=$(dpkg --print-architecture)
_pkgarches=('armhf' 'arm64' 'amd64')
#leave arch package as any
arch=('any')
#manually version for now
_pkgver='0.5.0'
_tag_ver=v${_pkgver}
pkgver=${_pkgver}
#pkgver='autogenerated'
#pkgrel keeps getting reset when build is run
_pkgrel=1
#pkgrel=1
pkgrel=${_pkgrel}
_pkggopath="github.com/${_githuborg}/${_pkgname}"
url="https://${_pkggopath}"
license=()
#make deps for every architecture are included here..
makedepends=('dpkg') # 'git' 'go' 'musl' 'kernel-headers-musl' 'aarch64-linux-musl' 'arm-linux-gnueabihf-musl') #'aarch64-linux-musl' 'arm-linux-gnueabihf-musl' 'skycoin-keyring')
depends=()
_debdeps=""
#_debdeps=""
_scripts="skywire-deb-scripts"
#source=("git+${url}.git#branch=${BRANCH:-develop}"
#build to needed commit because of develop branch instability
#source=("git+${url}.git" ##branch=${BRANCH:-develop}"
_binarchive=("${_pkgname}-${_tag_ver}-linux")
_release_url=("${url}/releases/download/${_tag_ver}/${_binarchive}")
source=(
"${_release_url}-amd64.tar.gz"
"${_release_url}-arm64.tar.gz"
"${_release_url}-arm.tar.gz"
"${_scripts}.tar.gz"
)
noextract=(
"${_binarchive}-amd64.tar.gz"
"${_binarchive}-arm64.tar.gz"
"${_binarchive}arm.tar.gz"
)
sha256sums=('382e3db67778ab551d05778b75550b114df0b0bd0c91b41aa8e59ff7473a0895'
'98294b08649e76f4e8df4c120cb0a642767cd781b6dee72c9fc72691fab262bb'
'fa7df58d8930e2547341d381283711d068c58ef960a5449427c0babe71257600'
'71f09a7d502e355d2998830a8a84a656f8e438c534a587df833b0eaa78af1944')
build() {
for i in ${_pkgarches[@]}; do
msg2 "_pkgarch=$i"
local _pkgarch=$i
_msg2 'creating the DEBIAN/control files'
#create control file for the debian package
echo "Package: skywire-bin" > ${srcdir}/${_pkgarch}.control
echo "Version: ${_pkgver}-${_pkgrel}" >> ${srcdir}/${_pkgarch}.control
echo "Priority: optional" >> ${srcdir}/${_pkgarch}.control
echo "Section: web" >> ${srcdir}/${_pkgarch}.control
echo "Architecture: ${_pkgarch}" >> ${srcdir}/${_pkgarch}.control
#echo "Depends: ${_debdeps}" >> ${srcdir}/${_pkgarch}.control
echo "Provides: ${pkgname}" >> ${srcdir}/${_pkgarch}.control
echo "Maintainer: the-skycoin-project" >> ${srcdir}/${_pkgarch}.control
echo "Description: ${pkgdesc}" >> ${srcdir}/${_pkgarch}.control
done
}
package() {
for i in ${_pkgarches[@]}; do
msg2 "_pkgarch=${i}"
local _pkgarch=${i}
if [[ $_pkgarch == "amd64" ]] ; then
rm -rf ${srcdir}/skywire-visor ${srcdir}/skywire-cli ${srcdir}/apps
rm -rf ${pkgdir}/test && mkdir -p ${pkgdir}/test && cd ${pkgdir}/test
tar -xf ${srcdir}/${_pkgname}-${_tag_ver}-linux-amd64.tar.gz
fi
if [[ $_pkgarch == "arm64" ]] ; then
rm -rf ${srcdir}/skywire-visor ${srcdir}/skywire-cli ${srcdir}/apps #not sure if it will error here
rm -rf ${pkgdir}/test && mkdir -p ${pkgdir}/test && cd ${pkgdir}/test
tar -xf ${srcdir}/${_pkgname}-${_tag_ver}-linux-arm64.tar.gz
fi
if [[ $_pkgarch == "armhf" ]] ; then
rm -rf ${srcdir}/skywire-visor ${srcdir}/skywire-cli ${srcdir}/apps #not sure if it will error here
rm -rf ${pkgdir}/test && mkdir -p ${pkgdir}/test && cd ${pkgdir}/test
tar -xf ${srcdir}/${_pkgname}-${_tag_ver}-linux-arm.tar.gz
fi
_msg2 'creating dirs'
#set up to create a .deb package
_debpkgdir="${_pkgname}-bin-${pkgver}-${_pkgrel}-${_pkgarch}"
_pkgdir="${pkgdir}/${_debpkgdir}"
_skydir="opt/skywire"
_skyapps="${_skydir}/apps"
_skyscripts="${_skydir}/scripts"
_systemddir="etc/systemd/system"
_skybin="${_skydir}/bin"
[[ -d ${_pkgdir} ]] && rm -rf ${_pkgdir}
mkdir -p ${_pkgdir}/usr/bin ${_pkgdir}/usr/bin/apps
#tls autoconfig
mkdir -p ${_pkgdir}/${_skydir}/ssl
#other dirs must be created or the visor will create them at runtime with weird permissions
mkdir -p ${_pkgdir}/${_skydir}/local
mkdir -p ${_pkgdir}/${_skydir}/dmsgpty
mkdir -p ${_pkgdir}/${_skydir}/${_pkgname} #needed?
#mkdir -p ${_pkgdir}/${_skydir}/skycache #local package repository
mkdir -p ${_pkgdir}/${_skydir}/transport_logs
mkdir -p ${_pkgdir}/${_skydir}/scripts
cd $_pkgdir
#loop to install the binaries
#_skywirebins=$( ls ${srcdir}/go/bin.${_pkgarch} )
#for i in ${_skywirebins}; do
# _msg2 "$i"
#done
_msg3 'skywire-visor'
install -Dm755 ${pkgdir}/test/${_pkgname}-visor ${_pkgdir}/${_skybin}/${_pkgname}-visor
ln -rTsf ${_pkgdir}/${_skybin}/${_pkgname}-visor ${_pkgdir}/usr/bin/${_pkgname}-visor
ln -rTsf ${_pkgdir}/${_skybin}/${_pkgname}-visor ${_pkgdir}/usr/bin/${_pkgname}
chmod +x ${_pkgdir}/usr/bin/${_pkgname}-visor ${_pkgdir}/usr/bin/${_pkgname}
_msg3 'skywire-cli'
install -Dm755 ${pkgdir}/test/${_pkgname}-cli ${_pkgdir}/${_skybin}/${_pkgname}-cli
ln -rTsf ${_pkgdir}/${_skybin}/${_pkgname}-cli ${_pkgdir}/usr/bin/${_pkgname}-cli
chmod +x ${_pkgdir}/usr/bin/${_pkgname}-cli
_msg2 'installing app binaries'
_msg3 'skychat'
install -Dm755 ${pkgdir}/test/apps/skychat ${_pkgdir}/${_skyapps}/skychat
ln -rTsf ${_pkgdir}/${_skyapps}/skychat ${_pkgdir}/usr/bin/apps/skychat
chmod +x ${_pkgdir}/usr/bin/apps/skychat
_msg3 'skysocks'
install -Dm755 ${pkgdir}/test/apps/skysocks ${_pkgdir}/${_skyapps}/skysocks
ln -rTsf ${_pkgdir}/${_skyapps}/skysocks ${_pkgdir}/usr/bin/apps/skysocks
chmod +x ${_pkgdir}/usr/bin/apps/skysocks
_msg3 'skysocks-client'
install -Dm755 ${pkgdir}/test/apps/skysocks-client ${_pkgdir}/${_skyapps}/skysocks-client
ln -rTsf ${_pkgdir}/${_skyapps}/skysocks-client ${_pkgdir}/usr/bin/apps/skysocks-client
chmod +x ${_pkgdir}/usr/bin/apps/skysocks-client
_msg3 'vpn-client'
install -Dm755 ${pkgdir}/test/apps/vpn-client ${_pkgdir}/${_skyapps}/vpn-client
ln -rTsf ${_pkgdir}/${_skyapps}/vpn-client ${_pkgdir}/usr/bin/apps/vpn-client
chmod +x ${_pkgdir}/usr/bin/apps/vpn-client
_msg3 'vpn-server'
install -Dm755 ${pkgdir}/test/apps/vpn-server ${_pkgdir}/${_skyapps}/vpn-server
ln -rTsf ${_pkgdir}/${_skyapps}/vpn-server ${_pkgdir}/usr/bin/apps/vpn-server
chmod +x ${_pkgdir}/usr/bin/apps/vpn-server
_msg2 'installing scripts'
_msg2 'installing scripts'
_skywirescripts=$( ls ${srcdir}/${_scripts}/${_pkgname} )
for i in ${_skywirescripts}; do
_install2 ${srcdir}/${_scripts}/${_pkgname}/${i} ${_skyscripts}
done
_msg2 'Correcting symlink names'
ln -rTsf ${_pkgdir}/${_skybin}/${_pkgname}-visor ${_pkgdir}/usr/bin/${_pkgname}
ln -rTsf ${_pkgdir}/${_skybin}/${_pkgname}-visor ${_pkgdir}/usr/bin/${_pkgname}-hypervisor
#ln -rTsf ${_pkgdir}/${_skyapps}/* ${_pkgdir}/usr/bin/apps/
_msg2 'installing skywire systemd services'
install -Dm644 ${srcdir}/${_scripts}/systemd/${_pkgname}.service ${_pkgdir}/${_systemddir}/${_pkgname}.service
install -Dm644 ${srcdir}/${_scripts}/systemd/${_pkgname}-visor.service ${_pkgdir}/${_systemddir}/${_pkgname}-visor.service
install -Dm644 ${srcdir}/${_scripts}/systemd/${_pkgname}.service ${_pkgdir}/${_systemddir}/${_pkgname}-hypervisor.service
_msg2 'installing tls key and certificate generation scripts'
#install -Dm755 ${srcdir}/${_pkgname}/static/skywire-manager-src/ssl/generate-1.sh ${pkgdir}/${_skydir}/ssl/generate.sh
install -Dm755 ${srcdir}/${_scripts}/ssl/generate.sh ${_pkgdir}/${_skydir}/ssl/generate.sh
ln -rTsf ${_pkgdir}/${_skydir}/ssl/generate.sh ${_pkgdir}/usr/bin/skywire-tls-gen
#install -Dm644 ${srcdir}/${_pkgname}/static/skywire-manager-src/ssl/certificate.cnf ${pkgdir}/${_skydir}/ssl/certificate.cnf
install -Dm644 ${srcdir}/${_scripts}/ssl/certificate.cnf ${_pkgdir}/${_skydir}/ssl/certificate.cnf
_msg2 'installing skywire control file and install scripts'
install -Dm755 ${srcdir}/${_pkgarch}.control ${_pkgdir}/DEBIAN/control
install -Dm755 ${srcdir}/${_scripts}/postinst.sh ${_pkgdir}/DEBIAN/postinst
#install -Dm755 ${srcdir}/${_scripts}/postrm.sh ${_pkgdir}/DEBIAN/postrm
_msg2 'creating the debian package'
#create the debian package!
cd $pkgdir
dpkg-deb --build -z9 ${_debpkgdir}
mv *.deb ../../
done
#exit so the arch package doesn't get built
exit
}
_install2() {
_binname="${1##*/}"
_binname="${_binname%%.*}"
install -Dm755 ${1} ${_pkgdir}/${2}/${_binname}
ln -rTsf ${_pkgdir}/${2}/${_binname} ${_pkgdir}/usr/bin/${_binname}
chmod +x ${_pkgdir}/usr/bin/${_binname}
}
_msg2() {
(( QUIET )) && return
local mesg=$1; shift
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
}
_msg3() {
(( QUIET )) && return
local mesg=$1; shift
printf "${BLUE} -->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
}
|