-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathbuild.sh
executable file
·37 lines (29 loc) · 1.14 KB
/
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
#!/usr/bin/env bash
echo "Preparing dist directory..."
rm -rf dist
mkdir -p dist
cp -r src/** dist/
cd dist
CODENAME=$(grep ^UBUNTU_CODENAME= /etc/os-release | cut -f2 -d=)
export VERSION=$(grep ^VERSION= bin/aws-rotate-iam-keys | head -n1 | cut -f2 -d= | tr -d \"\')
echo "Building version $VERSION..."
echo "Updating Debian changelog..."
DEBEMAIL="Adam Link <[email protected]>" DEBFULLNAME="Adam Link" \
debchange -v $VERSION --distribution $CODENAME --force-distribution "See release notes on GitHub"
echo "Building Debian binary package..."
# tmp dir for case-insensitive filesystems - cannot rename debian to DEBIAN
mkdir tmp
cp -Rp debian tmp/DEBIAN
cd tmp
envsubst '$VERSION' < DEBIAN/control-debian > DEBIAN/control
dpkg-deb --build . ../../aws-rotate-iam-keys.${VERSION}.deb
cd ../
rm -rf tmp
echo "Building Ubuntu source package..."
envsubst '$VERSION' < debian/control-ubuntu > debian/control
DEBEMAIL="Adam Link <[email protected]>" DEBFULLNAME="Adam Link" debuild -S -sa -us -uc
echo "Copying changelog back to src..."
cd ..
cp dist/debian/changelog src/debian/changelog
echo "Deleting dist directory..."
rm -rf dist