-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_build.sh
executable file
·92 lines (68 loc) · 1.6 KB
/
local_build.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
86
87
88
89
90
91
92
#!/bin/sh
build_root=$PWD
echo "Build Root: ${build_root}"
cd workspace-repo
apt update
apt install -y libssl-dev
apt install -y libpcre3-dev
apt install -y automake
apt install -y checkinstall
./bootstrap.sh
builddate=$(date --utc +%Y-%m-%d)
./configure \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--datadir=/usr/lib \
--libdir=/usr/lib/ \
--sysconfdir=/etc/ \
--program-prefix=yen- \
--program-suffix=-$builddate \
--with-openssl \
--enable-agent
make
VERSION=$(date -u +"%Y%m%d%H%S")
echo $VERSION
cat <<EOF > description-pak
EOF
cat <<'EOF' > preinstall-pak
EOF
cat preinstall-pak
cat <<'EOF' > postinstall-pak
EOF
cat postinstall-pak
cat <<'EOF' > preremove-pak
EOF
cat preremove-pak
cat <<'EOF' > postremove-pak
EOF
cat postremove-pak
checkinstall \
--install=no \
--fstrans=no \
--pkgname=test-agent \
--pkgversion="$VERSION" \
--requires="adduser" \
--docdir="/usr/share/doc" \
--default
mkdir test-agent_$VERSION-1_amd64
dpkg-deb -R test-agent_$VERSION-1_amd64.deb test-agent_$VERSION-1_amd64
cd test-agent_$VERSION-1_amd64
mkdir -p lib/systemd/system
cd lib/systemd/system
cat <<EOF > test-agent.service
[Unit]
Description=Test Agent
Documentation=man:test_agentd
After=network.target
[Service]
Type=simple
User=test
Group=test
ExecStart=/usr/sbin/yen-test_agentd-$builddate --foreground
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
EOF
cd ../../../..
mv test-agent_$VERSION-1_amd64.deb test-agent_$VERSION-1_amd64.deb.old
dpkg-deb --build test-agent_$VERSION-1_amd64