build-deb.sh 2.39 KB
Newer Older
Max Beckett's avatar
Max Beckett committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env sh
#
# Copyright 2017-2018 Amazon.com, Inc. and its affiliates. All Rights Reserved.
#
# Licensed under the MIT License. See the LICENSE accompanying this file
# for the specific language governing permissions and limitations under
# the License.
#

set -ex

BASE_DIR=$(pwd)
BUILD_ROOT=${BASE_DIR}/build/debbuild
14
VERSION=1.30.1
15
RELEASE=1
16
DEB_SYSTEM_RELEASE_PATH=/etc/os-release
Max Beckett's avatar
Max Beckett committed
17
18
19
20
21
22
23
24
25
26
27
28

echo 'Cleaning deb build workspace'
rm -rf ${BUILD_ROOT}
mkdir -p ${BUILD_ROOT}

echo 'Creating application directories'
mkdir -p ${BUILD_ROOT}/etc/amazon/efs
mkdir -p ${BUILD_ROOT}/etc/init/
mkdir -p ${BUILD_ROOT}/etc/systemd/system
mkdir -p ${BUILD_ROOT}/sbin
mkdir -p ${BUILD_ROOT}/usr/bin
mkdir -p ${BUILD_ROOT}/var/log/amazon/efs
29
mkdir -p ${BUILD_ROOT}/usr/share/man/man8
Max Beckett's avatar
Max Beckett committed
30
31
32
33

echo 'Copying application files'
install -p -m 644 dist/amazon-efs-mount-watchdog.conf ${BUILD_ROOT}/etc/init
install -p -m 644 dist/amazon-efs-mount-watchdog.service ${BUILD_ROOT}/etc/systemd/system
Ian Patel's avatar
Ian Patel committed
34
install -p -m 444 dist/efs-utils.crt ${BUILD_ROOT}/etc/amazon/efs
Max Beckett's avatar
Max Beckett committed
35
36
37
38
39
40
41
42
43
44
45
46
install -p -m 644 dist/efs-utils.conf ${BUILD_ROOT}/etc/amazon/efs
install -p -m 755 src/mount_efs/__init__.py ${BUILD_ROOT}/sbin/mount.efs
install -p -m 755 src/watchdog/__init__.py ${BUILD_ROOT}/usr/bin/amazon-efs-mount-watchdog

echo 'Copying install scripts'
install -p -m 755 dist/scriptlets/after-install-upgrade ${BUILD_ROOT}/postinst
install -p -m 755 dist/scriptlets/before-remove ${BUILD_ROOT}/prerm
install -p -m 755 dist/scriptlets/after-remove ${BUILD_ROOT}/postrm

echo 'Copying control file'
install -p -m 644 dist/amazon-efs-utils.control ${BUILD_ROOT}/control

Ian Patel's avatar
Ian Patel committed
47
48
49
echo 'Copying conffiles'
install -p -m 644 dist/amazon-efs-utils.conffiles ${BUILD_ROOT}/conffiles

50
51
52
echo 'Copying manpages'
install -p -m 644 man/mount.efs.8 ${BUILD_ROOT}/usr/share/man/man8/mount.efs.8

Max Beckett's avatar
Max Beckett committed
53
54
55
56
57
58
59
60
echo 'Creating deb binary file'
echo '2.0'> ${BUILD_ROOT}/debian-binary

echo 'Setting permissions'
find ${BUILD_ROOT} -type d | xargs chmod 755;

echo 'Creating tar'
cd ${BUILD_ROOT}
Ian Patel's avatar
Ian Patel committed
61
tar czf control.tar.gz control conffiles postinst prerm postrm --owner=0 --group=0
Max Beckett's avatar
Max Beckett committed
62
63
64
65
tar czf data.tar.gz etc sbin usr var --owner=0 --group=0
cd ${BASE_DIR}

echo 'Building deb'
66
DEB=${BUILD_ROOT}/amazon-efs-utils-${VERSION}-${RELEASE}_all.deb
Max Beckett's avatar
Max Beckett committed
67
68
69
70
71
72
ar r ${DEB} ${BUILD_ROOT}/debian-binary
ar r ${DEB} ${BUILD_ROOT}/control.tar.gz
ar r ${DEB} ${BUILD_ROOT}/data.tar.gz

echo 'Copying deb to output directory'
cp ${BUILD_ROOT}/amazon-efs-utils*deb build/