-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-deb.sh
executable file
·47 lines (33 loc) · 1.36 KB
/
build-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
39
40
41
42
43
44
45
46
47
set -e -x
NAME=fanctl
VERSION=0.1.2
TMP_PACKAGE_DIR=.debian
TMP_PACKAGE_DEB_DIR=$TMP_PACKAGE_DIR/DEBIAN
rm -rf $TMP_PACKAGE_DIR
mkdir -p $TMP_PACKAGE_DEB_DIR
CONTROL=$TMP_PACKAGE_DEB_DIR/control
CONFFILES=$TMP_PACKAGE_DEB_DIR/conffiles
ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
PACKAGE_FILENAME=${NAME}_${VERSION}_${ARCH}.deb
echo "Package: $NAME" >> $CONTROL
echo "Version: $VERSION" >> $CONTROL
echo "Priority: optional" >> $CONTROL
echo "Architecture: $ARCH" >> $CONTROL
echo "Maintainer: Ivan Safonov <[email protected]>" >> $CONTROL
echo "Description: Fan control service" >> $CONTROL
echo "Homepage: https://github.com/IvanSafonov/fanctl" >> $CONTROL
cp ./debian/* $TMP_PACKAGE_DEB_DIR/
mkdir -p $TMP_PACKAGE_DIR/usr/sbin
go build -o $TMP_PACKAGE_DIR/usr/sbin/fanctl ./cmd/fanctl
strip $TMP_PACKAGE_DIR/usr/sbin/fanctl
mkdir -p $TMP_PACKAGE_DIR/etc
cp ./conf/fanctl.yaml $TMP_PACKAGE_DIR/etc/fanctl.yaml
echo "/etc/fanctl.yaml" >> $CONFFILES
mkdir -p $TMP_PACKAGE_DIR/lib/systemd/system
cp ./systemd/*.service $TMP_PACKAGE_DIR/lib/systemd/system/
mkdir -p $TMP_PACKAGE_DIR/usr/local/share/doc/fanctl/examples
cp ./conf/*.yaml $TMP_PACKAGE_DIR/usr/local/share/doc/fanctl/examples/
echo -n "Installed-Size: " >> $CONTROL
du -sx --exclude DEBIAN $TMP_PACKAGE_DIR | grep -o -E ^[0-9]+ >> $CONTROL
dpkg-deb --build $TMP_PACKAGE_DIR $PACKAGE_FILENAME
rm -rf $TMP_PACKAGE_DIR