forked from Drive-Trust-Alliance/sedutil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathManualBuild.sh
executable file
·69 lines (54 loc) · 1.73 KB
/
ManualBuild.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
#!/bin/bash
set -euxo pipefail
WORKSPACE=$(pwd)
WORKDIRS=("${WORKSPACE}/LinuxPBA" "${WORKSPACE}/linux/CLI")
VERSION="Release_x86_64"
OPAL_UNIT=sed-opal.service
EXEDIR=/usr/sbin
MAN_PAGE=sedutil-cli.8
MAN_DIR=/usr/share/man/man8
USR_SYSTEMD=/etc/systemd/system
PKGDIR=debian
export LDFLAGS=-static
COMMIT=$(git rev-parse --short HEAD)
PKG_VERSION=$(git describe HEAD)
#FIXME Cleanup
for WRKDIR in "${WORKDIRS[@]}"; do
make -j8 -C "$WRKDIR" CONF="${VERSION}" clean
done
rm -rf "*.deb"
sudo rm -rf "${PKGDIR}"
mkdir "${PKGDIR}"
mkdir -p "${PKGDIR}/${EXEDIR}"
mkdir -p "${PKGDIR}/${USR_SYSTEMD}"
mkdir -p "${PKGDIR}/${MAN_DIR}"
cp -rp DEBIAN "${PKGDIR}"
cat > "$PKGDIR/DEBIAN/control" <<EOF
Package: sedutil
Section: utils
Version: $PKG_VERSION
Architecture: amd64
Maintainer: [email protected]
Homepage: https://github.com/kentik/sedutil
Description: Forked and locally-modified DTA sedutil-cli package. Statically compiled, should be good for all modern distros. Built from commit $COMMIT.
EOF
for DIR in "${WORKDIRS[@]}"; do
( make -j8 -C "$DIR" CONF="${VERSION}" clean ; make -j8 -C "$DIR" CONF="${VERSION}" ) 2>&1 | tee logfile.txt
done
for DIR in "${WORKDIRS[@]}"; do
cp "${DIR}/dist/${VERSION}/GNU-Linux/"* "${PKGDIR}/${EXEDIR}"
done
cp docs/"${MAN_PAGE}" "${PKGDIR}/${MAN_DIR}"
gzip -9 "${PKGDIR}/${MAN_DIR}/${MAN_PAGE}"
cp "Contrib/${OPAL_UNIT}" "${PKGDIR}/${USR_SYSTEMD}"
chmod 0644 "${PKGDIR}/${USR_SYSTEMD}/${OPAL_UNIT}"
sudo find "${PKGDIR}" -execdir chown 0:0 '{}' +;
dpkg-deb --build "${PKGDIR}"
pkg_ver_arch=$(dpkg-deb --info debian.deb \
| grep -E 'Package|Version|Architecture' \
| tr -d ' ' \
| tr ':' '=')
for var in "${pkg_ver_arch[@]}"; do
eval "$var"
done
mv debian.deb "${Package}_${Version}_${Architecture}.deb"