Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ while [ $# -gt 0 ]; do
done

# provide defaults, then pass everything else as-is
. ./eng/linux/package.sh -o "${output}" -c "${config}" "${options[@]}"
. ./eng/linux/package.sh -o "${output}" -c "${config}" "${options[@]}" --generate-rules false
31 changes: 11 additions & 20 deletions eng/linux/BinaryTarBall/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,21 @@ PKG_FILE="${OTD_LNAME}-${OTD_VERSION}-x64.tar.gz"

output="${1}"

move_to_nested "${output}" "${output}/lib/opentabletdriver"
move_to_nested "${output}" "${output}/build"

echo "Copying generic files..."
cp -R "${GENERIC_FILES}"/* "${output}/"
mkdir -p "${output}/etc/"
mv "${output}/usr/lib"/* "${output}/etc/"

echo "Patching wrapper scripts to point to '/lib/opentabletdriver'..."
mkdir -p "${output}/bin"
for exe in "${output}/usr/bin"/*; do
sed -i "s|#!/usr/bin/env sh|#!/bin/sh|" "${exe}"
sed -i "s|/usr/lib|/lib|" "${exe}"
mv "${exe}" "${output}/bin/${exe##*/}"
done
env DESTDIR="${output}/usr/local" OTD_BUILD_DIR="${output}/build" "${GENERIC_FILES}/install.sh"
rm -r "${output}/build"

echo "Removing unused directories..."
rmdir "${output}/usr/bin"
rmdir "${output}/usr/lib"
rmdir "${output}/usr"
echo "Patching wrapper scripts to point to '/usr/local/lib/opentabletdriver'..."
for exe in "${output}/usr/local/bin"/*; do
sed -i "s|/usr/lib|/usr/local/lib|" "${exe}"
done

generate_rules "${output}/etc/udev/rules.d/99-opentabletdriver.rules"
generate_desktop_file "${output}/share/applications/opentabletdriver.desktop"
sed -i "s|/usr/share|/share|" "${output}/share/applications/opentabletdriver.desktop"
copy_pixmap_assets "${output}/share/pixmaps"
mkdir -p "${output}/etc/udev/rules.d/"
mv "${output}/usr/local/lib/udev/rules.d/99-opentabletdriver.rules" "${output}/etc/udev/rules.d/99-opentabletdriver.rules"
rm -r "${output}/usr/local/lib/udev/"
sed -i "s|/usr/share|/usr/local/share|" "${output}/usr/local/share/applications/opentabletdriver.desktop"

echo "Creating binary tarball '${output}/${PKG_FILE}'..."

Expand Down
23 changes: 0 additions & 23 deletions eng/linux/Debian/DEBIAN/postinst

This file was deleted.

1 change: 1 addition & 0 deletions eng/linux/Debian/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
12 changes: 12 additions & 0 deletions eng/linux/Debian/debian/opentabletdriver.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
usr/bin/otd
usr/bin/otd-daemon
usr/bin/otd-gui
usr/lib/modprobe.d/99-opentabletdriver.conf
usr/lib/opentabletdriver/*
usr/lib/systemd/user/opentabletdriver.service
usr/lib/udev/rules.d/99-opentabletdriver.rules
usr/share/applications/opentabletdriver.desktop
usr/share/man/man8/opentabletdriver.8.gz
usr/share/doc/opentabletdriver/LICENSE
usr/share/pixmaps/otd.ico
usr/share/pixmaps/otd.png
11 changes: 11 additions & 0 deletions eng/linux/Debian/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/make -f
SHELL=/usr/bin/env bash

%:
dh $@

override_dh_auto_build:
./eng/linux/package.sh -o "bin" -c "Release"

override_dh_auto_install:
DESTDIR=debian/tmp/usr OTD_BUILD_DIR=bin ./eng/linux/Generic/install.sh
1 change: 1 addition & 0 deletions eng/linux/Debian/debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
69 changes: 29 additions & 40 deletions eng/linux/Debian/package.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/usr/bin/env bash

# in the future if we want to be part of official debian repos, we need to
# provide a manpage for the binaries in /usr/bin, and add a source package
# where the binaries could be built from.

# increment this when releasing a new package of the same upstream version
# where the only changes are to the packaging itself
PKG_VER="1"
Expand All @@ -13,54 +9,47 @@ debian_src="$(readlink -f $(dirname "${BASH_SOURCE[0]}"))"

output="${1}"

move_to_nested "${output}" "${output}/usr/lib/opentabletdriver"

echo "Copying generic files..."
cp -R "${GENERIC_FILES}"/* "${output}/"
echo "Copying source files..."
create_source_tarball "${OTD_LNAME}-${OTD_VERSION}" | tar -xf - -C "${output}"

echo "Debianizing..."
mkdir -p "${output}/debian"
touch "${output}/debian/control"

echo "Generating shlibdeps..."
last_cwd="${PWD}"
cd "${output}"
shlibdeps="$(dpkg-shlibdeps -O "usr/lib/opentabletdriver/OpenTabletDriver.Daemon" 2> /dev/null)"
shlibdeps="${shlibdeps#shlibs:Depends=}"
cd "${last_cwd}"
mv "${output}"/{debian,DEBIAN}
cp -R "${debian_src}/debian" "${output}/${OTD_LNAME}-${OTD_VERSION}"
cp "${GENERIC_FILES}/Scripts/postinst" "${output}/${OTD_LNAME}-${OTD_VERSION}/debian/${OTD_LNAME}.postinst"
cp "${GENERIC_FILES}/Scripts/postrm" "${output}/${OTD_LNAME}-${OTD_VERSION}/debian/${OTD_LNAME}.postrm"

echo "Copying Debian files..."
cp -R "${debian_src}/DEBIAN" "${output}"
cp -R "${debian_src}/usr" "${output}"

generate_rules "${output}/usr/lib/udev/rules.d/99-opentabletdriver.rules"
generate_desktop_file "${output}/usr/share/applications/opentabletdriver.desktop"
copy_pixmap_assets "${output}/usr/share/pixmaps"

echo "Generating DEBIAN/control..."
cat << EOF > "${output}/DEBIAN/control"
Package: ${OTD_LNAME}
Version: ${OTD_VERSION}-${PKG_VER}
Section: misc
echo "Generating debian/control..."
cat << EOF > "${output}/${OTD_LNAME}-${OTD_VERSION}/debian/control"
Source: opentabletdriver
Priority: optional
Build-Depends: dotnet-sdk-6.0
Maintainer: InfinityGhost <[email protected]>, X9VoiD <[email protected]>

Package: opentabletdriver
Section: base
Architecture: amd64
Installed-Size: $(du -s "${output}" | cut -f1)
Pre-Depends: udev
Depends: libevdev2, libgtk-3-0, dotnet-runtime-6.0, ${shlibdeps}
Depends: libevdev2, libgtk-3-0, dotnet-runtime-6.0, \${shlibs:Depends}
Recommends: libx11-6, libxrandr2
Conflicts: ${OTD_NAME}
Replaces: ${OTD_NAME}
Maintainer: ${OTD_MAINTAINERS[1]}
Description: A ${OTD_DESC}
$(echo "${OTD_LONG_DESC}" | sed '2,$s/^/ /')
.
$(echo "${OTD_LONG_DESC2}" | sed '2,$s/^/ /')
Homepage: ${OTD_UPSTREAM_URL}
Vcs-Browser: ${OTD_REPO_URL}
Vcs-Git: ${OTD_GIT}
EOF

echo "Generating debian/changelog..."
cat <<EOF > "${output}/${OTD_LNAME}-${OTD_VERSION}/debian/changelog"
opentabletdriver (${OTD_VERSION}-${PKG_VER}) unstable; urgency=low

* New version: ${OTD_VERSION}-${PKG_VER}

-- InfinityGhost <[email protected]> `LANG=C date +"%a, %d %b %Y %X %z"`

EOF

PREV_DIR="${PWD}"
echo "Creating '${PKG_FILE}'..."
move_to_nested "${output}" "${output}/opentabletdriver"
dpkg-deb --build --root-owner-group "${output}/opentabletdriver" "${output}/${PKG_FILE}"
cd "${output}/${OTD_LNAME}-${OTD_VERSION}"
dpkg-buildpackage --no-sign -b
cd "${PREV_DIR}"
mv "${output}/${OTD_LNAME}_${OTD_VERSION}-${PKG_VER}_amd64.deb" "${output}/${PKG_FILE}"
29 changes: 0 additions & 29 deletions eng/linux/Debian/usr/share/doc/opentabletdriver/copyright

This file was deleted.

File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions eng/linux/Generic/Scripts/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -e

if lsmod | grep hid_uclogic > /dev/null; then
rmmod hid_uclogic || true
fi

if lsmod | grep wacom > /dev/null; then
rmmod wacom || true
fi

if udevadm control --reload-rules; then
udevadm trigger --settle || true
udevadm trigger --name-match=uinput --settle || true
fi

printf "Run the daemon by invoking 'otd-daemon', or by enabling opentabletdriver.service"
File renamed without changes.
47 changes: 47 additions & 0 deletions eng/linux/Generic/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

DESTDIR="${DESTDIR:-/usr/local/}"
generic_src="$(readlink -f $(dirname "${BASH_SOURCE[0]}"))"

. ${generic_src}/../lib.sh

if [ ! -d "${OTD_BUILD_DIR}" ]; then
echo "OTD_BUILD_DIR is not set, please build OpenTabletDriver and set this variable."
exit 1
fi

# Scripts
mkdir -p "${DESTDIR}/bin"
install -m 0755 "${generic_src}/Scripts/otd" "${DESTDIR}/bin/otd"
install -m 0755 "${generic_src}/Scripts/otd-daemon" "${DESTDIR}/bin/otd-daemon"
install -m 0755 "${generic_src}/Scripts/otd-gui" "${DESTDIR}/bin/otd-gui"

# modprobe
mkdir -p "${DESTDIR}/lib/modprobe.d"
install -m 0644 "${generic_src}/modprobe/99-opentabletdriver.conf" "${DESTDIR}/lib/modprobe.d/99-opentabletdriver.conf"

# systemd user
mkdir -p "${DESTDIR}/lib/systemd/user"
install -m 0644 "${generic_src}/systemd-user/opentabletdriver.service" "${DESTDIR}/lib/systemd/user/opentabletdriver.service"

# manpages
mkdir -p "${DESTDIR}/share/man/man8"
gzip -c "${generic_src}/manpages/opentabletdriver.8" > "${DESTDIR}/share/man/man8/opentabletdriver.8.gz"

# license
mkdir -p "${DESTDIR}/share/doc/opentabletdriver"
install -m 0644 "${REPO_ROOT}/LICENSE" "${DESTDIR}/share/doc/opentabletdriver/LICENSE"

# pixmaps
copy_pixmap_assets "${DESTDIR}/share/pixmaps"

# udev rules
mkdir -p "${DESTDIR}/lib/udev/rules.d"
mv "${OTD_BUILD_DIR}/99-opentabletdriver.rules" "${DESTDIR}/lib/udev/rules.d/99-opentabletdriver.rules"

# desktop entry
generate_desktop_file "${DESTDIR}/share/applications/opentabletdriver.desktop"

# OpenTabletDriver
mkdir -p "${DESTDIR}/lib/opentabletdriver"
cp -r "${OTD_BUILD_DIR}"/* "${DESTDIR}/lib/opentabletdriver"
Loading