Skip to content

Commit

Permalink
Added Ubuntu support
Browse files Browse the repository at this point in the history
  • Loading branch information
lelegard committed Apr 12, 2017
1 parent cc09914 commit aeccfed
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 1 deletion.
22 changes: 22 additions & 0 deletions build-dektec-dkms
Original file line number Diff line number Diff line change
Expand Up @@ -340,5 +340,27 @@ if $RPM_DISTRO; then
"$PKGDIR"
fi
# Build DEB distro.
if $DEB_DISTRO; then
verbose "building DEB package"
# Root of .deb package build.
DEBDIR="$TMPDIR/deb"
rm -rf "$DEBDIR"
# Build file structure of the package.
mkdir -p -m 0755 "$DEBDIR/DEBIAN" "$DEBDIR/usr/src" "$DEBDIR/etc/udev/rules.d" "$DEBDIR/usr/share/doc/dektec-dkms"
for f in control postinst prerm; do
sed -e "s/{{VERSION}}/$VERSION/g" $f.template >"$DEBDIR/DEBIAN/$f"
done
chmod 755 "$DEBDIR/DEBIAN/postinst" "$DEBDIR/DEBIAN/prerm"
cp -rp "$SRCDIR/dektec-$VERSION" "$DEBDIR/usr/src"
install -m 644 "$SRCDIR/51-dta.rules" "$SRCDIR/51-dtu.rules" "$DEBDIR/etc/udev/rules.d"
install -m 644 "$SRCDIR/Readme" "$SRCDIR/License" "$DEBDIR/usr/share/doc/dektec-dkms"
# Build the binary package
dpkg --build "$DEBDIR" "$PKGDIR"
fi
# Final cleanup.
cleanexit 0
17 changes: 17 additions & 0 deletions control.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Package: dektec-dkms
Version: {{VERSION}}
Architecture: all
Maintainer: DekTec Digital Video B.V. <[email protected]>
Section: free/kernel
Priority: optional
Depends: dkms
Description: Source code and DKMS setup for the Dektec device drivers.
This package installs the source code and DKMS setup for the kernel modules
of the Dektec device drivers. Each time the kernel is upgraded, the Dektec
modules are automatically recompiled. The provided drivers are Dta, DtaNw, Dtu.
.
Dektec is a manufacturer of PC add-on cards, USB devices, IP converters and
software for the professional digital-television market. Their products are
used for test and measurement and to build broadcast infrastructure.
.
This is an independent packaging of the Dektec original drivers.
2 changes: 1 addition & 1 deletion dektec-dkms.spec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cp -r dektec-%{version} $RPM_BUILD_ROOT/usr/src
install -m 644 51-dta.rules 51-dtu.rules $RPM_BUILD_ROOT/etc/udev/rules.d

%post
[[ -n $(/usr/sbin/dkms status | grep dektec | grep "%{version}" | wc -l) ]] && /usr/sbin/dkms add -m dektec -v "%{version}"
[[ $(/usr/sbin/dkms status | grep dektec | grep "%{version}" | wc -l) -eq 0 ]] && /usr/sbin/dkms add -m dektec -v "%{version}"
/usr/sbin/dkms build -m dektec -v "%{version}"
/usr/sbin/dkms install -m dektec -v "%{version}"
exit 0
Expand Down
18 changes: 18 additions & 0 deletions postinst.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# QtlMovie post-installation script on Ubuntu and Debian systems.

if [[ "$1" = "configure" ]]; then
# Fix file permissions and ownership.
chown -R root:root /usr/src/dektec-{{VERSION}} /etc/udev/rules.d/51-dta.rules /etc/udev/rules.d/51-dtu.rules /usr/share/doc/dektec-dkms
find /usr/src/dektec-{{VERSION}} -type f -print0 | xargs -0 chmod 644
find /usr/src/dektec-{{VERSION}} -type d -print0 | xargs -0 chmod 755
chmod 755 /usr/share/doc/dektec-dkms
chmod 644 /etc/udev/rules.d/51-dta.rules /etc/udev/rules.d/51-dtu.rules /usr/share/doc/dektec-dkms/*

# Build the initial version of the driver.
[[ $(/usr/sbin/dkms status | grep dektec | grep "{{VERSION}}" | wc -l) -eq 0 ]] && /usr/sbin/dkms add -m dektec -v "{{VERSION}}"
/usr/sbin/dkms build -m dektec -v "{{VERSION}}"
/usr/sbin/dkms install -m dektec -v "{{VERSION}}"
fi

exit 0
8 changes: 8 additions & 0 deletions prerm.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# Dektec DKMS pre-uninstallation script on Ubuntu and Debian systems.

if [[ "$1" = "remove" || "$1" = "deconfigure" ]]; then
[[ $(/usr/sbin/dkms status | grep dektec | grep "{{VERSION}}" | wc -l) -gt 0 ]] && /usr/sbin/dkms remove -m dektec -v "{{VERSION}}" --all
fi

exit 0

0 comments on commit aeccfed

Please sign in to comment.