Skip to content

Commit

Permalink
Add script to build Debian package
Browse files Browse the repository at this point in the history
  • Loading branch information
marek22k committed Dec 21, 2023
1 parent 3eff649 commit 0b3c6d7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# cmake
build/

# Debian package
deb/package/
deb/libtuntap-dev.deb
32 changes: 32 additions & 0 deletions deb/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

die () {
>&2 echo "$1"
exit 1
}


(
rm -rf package || die "Failed to remove old packages"
)

(
mkdir ../build
cd ../build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. || die "Failed to configure project"
make -j "$(nproc)" || die "Failed to build project"
make DESTDIR="../deb/package/" install || die "Failed to install project into package directory"
)

mkdir -p package/DEBIAN/
VERSION="$(git describe --long | sed 's/^libtuntap-//')"
sed "s/%VERSION%/$VERSION/" control.template >> package/DEBIAN/control

mkdir -p package/usr/share/doc/libtuntap-dev/
cp copyright package/usr/share/doc/libtuntap-dev/copyright

echo "Building package..."
dpkg-deb --root-owner-group --build package libtuntap-dev.deb || die "Failed to build package"

echo "Package $(dpkg-deb --show libtuntap-dev.deb | sed "s/\t/ /") successful builded!"

25 changes: 25 additions & 0 deletions deb/control.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Package: libtuntap-dev
Version: %VERSION%
Architecture: any
Section: libdevel
Priority: optional
Homepage: https://github.com/LaKabane/libtuntap
Maintainer: LaKabane <[email protected]>
Description: Portable Tun/Tap devices configuration utility/library
TUN and TAP are virtual networking devices which allow userland applications
to receive packets sent to it. The userland applications can also send their
own packets to the devices and they will be forwarded to the kernel.
This is useful for developping tunnels, private networks or virtualisation
systems.
Supported Features
- Creation of TUN and TAP devices;
- Autodetection of available TUN or TAP devices;
- Setting and getting the MAC address of the device;
- Setting and getting the MTU of the device;
- Setting the status of the device (up/down);
- Setting the IPv4 address and netmask of the device;
- Setting the persistence mode of the device;
- Setting the name of the device (Linux only);
- Setting the description of the device (OpenBSD and FreeBSD only);
- Wrapper libraries for C++.

13 changes: 13 additions & 0 deletions deb/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/LaKabane/libtuntap#license
Upstream-Name: libtuntap
Upstream-Contact: LaKabane <[email protected]>

Files: *
Copyright: LaKabane <[email protected]>
License: ISC

License: ISC
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
.
THE SOFTWARE IS PROVIDED “AS IS” AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

0 comments on commit 0b3c6d7

Please sign in to comment.