forked from 45Drives/cockpit-zfs-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-deb.sh
38 lines (29 loc) · 1.01 KB
/
package-deb.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
#!/usr/bin/env bash
# fill this in with a name unique to the software package
PACKAGE_NAME=cockpit-zfs-manager
# check that docker is installed
command -v docker > /dev/null 2>&1 || {
echo "Please install docker.";
exit 1;
}
# if docker image DNE, build it (keep container tag name unique to software package)
if [[ "$(docker images -q $PACKAGE_NAME-ubuntu-builder 2> /dev/null)" == "" ]]; then
docker build -t $PACKAGE_NAME-ubuntu-builder - < docker/ubuntu # pass in path to docker file
res=$?
if [ $res -ne 0 ]; then
echo "Building docker image failed."
exit $res
fi
fi
make clean
mkdir -p dist/ubuntu
# mirror current directory to working directory in container, and mirror dist/ubuntu to .. for deb output
docker run -u $(id -u):$(id -g) -w /home/deb/build -it -v$(pwd):/home/deb/build -v$(pwd)/dist/ubuntu:/home/deb --rm $PACKAGE_NAME-ubuntu-builder dpkg-buildpackage -us -uc -b
res=$?
if [ $res -ne 0 ]; then
echo "Packaging failed."
exit $res
fi
rmdir dist/ubuntu/build
echo "deb is in dist/ubuntu/"
exit 0