Created
October 18, 2015 01:40
-
-
Save jmwilson/8e6c579eac5fa7fa9f0d to your computer and use it in GitHub Desktop.
Leap Motion installer patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/orig/DEBIAN/postinst b/leap/DEBIAN/postinst | |
index 750a6b2..5590506 100755 | |
--- a/orig/DEBIAN/postinst | |
+++ b/leap/DEBIAN/postinst | |
@@ -1,49 +1,10 @@ | |
#!/bin/bash -e | |
echo 'Leap Motion installed under /usr/bin and /usr/sbin' | |
-LSB_RELEASE=$(which lsb_release 2> /dev/null) || true | |
-if [ -n "${LSB_RELEASE}" ]; then | |
- DISTID=$(lsb_release -id) | |
-fi | |
- | |
-if [[ -n "${LSB_RELEASE}" && -e /lib/init/upstart-job ]]; then | |
- # Ubuntu | |
- ln -s /lib/init/upstart-job /etc/init.d/leapd | |
- UBUNTU_VERSION=$(lsb_release -r | cut -f 2) | |
- USING_TRAY_WHITELIST=$(echo ${UBUNTU_VERSION} \< 13.04 | bc) | |
- if [ "${USING_TRAY_WHITELIST}" -eq "1" ]; then | |
- echo 'Allow Leap Motion in the system tray with the following command:' | |
- echo ' gsettings set com.canonical.Unity.Panel systray-whitelist "$(gsettings get com.canonical.Unity.Panel systray-whitelist | sed -e "s/]$/, '"'LeapControlPanel'"']/")"' | |
- fi | |
-elif [[ "${DISTID}" == *Debian* ]]; then | |
- # Debian: create the init script to install leapd | |
- sed -e 's/daemonexecutablename/leapd/g' \ | |
- -e 's/This file should be used to construct scripts to be/Description of the service/' \ | |
- -e '/# *placed in \/etc\/init\.d\./d' \ | |
- -e 's/Description of the service/Leap Motion daemon/g' \ | |
- -e 's/Example initscript/Leap Motion initscript/' \ | |
- -e 's/--options args//g' \ | |
- -e 's/--start --quiet/--start --background --quiet/g' \ | |
- -e 's/Foo Bar <foobar@baz.org>/Leap Motion Support <support@leapmotion.com>/g' \ | |
- -e 's/skeleton/leapd/g' \ | |
- -e '/Add code here, if necessary, that waits for the process to be ready/a \ \ \ \ \ \ \ \ cat \/dev\/null \> \$PIDFILE \&\& pidof \$NAME \>\> \$PIDFILE' \ | |
- /etc/init.d/skeleton > /etc/init.d/leapd | |
- chmod 755 /etc/init.d/leapd | |
- update-rc.d -f leapd defaults | |
-fi | |
- | |
-if [[ -n "${LSB_RELEASE}" && -e /lib/init/upstart-job || "${DISTID}" == *Debian* ]]; then | |
- service leapd start | |
- echo 'Check Leap Motion daemon with:' | |
- echo ' service leapd status' | |
-else | |
- # other distros | |
- echo 'To start the Leap Motion daemon, run:' | |
- echo ' sudo leapd' | |
- echo 'This does not appear to be an Debian or Ubuntu-compatible distro' | |
- echo 'If you would like Leap Motion to run as a service, it is up to you' | |
- echo 'to configure systemd or /etc/init.d appropriately.' | |
-fi | |
+systemctl enable leapd | |
+service leapd start | |
+echo 'Check Leap Motion daemon with:' | |
+echo ' service leapd status' | |
echo 'Open the Leap Motion GUI with:' | |
echo ' LeapControlPanel' | |
diff --git a/orig/DEBIAN/postrm b/orig/DEBIAN/postrm | |
deleted file mode 100755 | |
index 5f8ebed..0000000 | |
--- a/orig/DEBIAN/postrm | |
+++ /dev/null | |
@@ -1,15 +0,0 @@ | |
-#!/bin/bash -e | |
- | |
-LSB_RELEASE=$(which lsb_release 2> /dev/null) || true | |
-if [ -n "${LSB_RELEASE}" ]; then | |
- CODENAME=$(lsb_release -cs) | |
- DISTID=$(lsb_release -id) | |
-fi | |
-if [ "${CODENAME}" == "debian" -o "${DISTID}" == "Debian" ]; then | |
- if [ ! -e /lib/init/upstart-job ]; then | |
- update-rc.d -f leapd remove | |
- fi | |
-fi | |
-if [ -n "${LSB_RELEASE}" -a -e /lib/init/upstart-job -o "${CODENAME}" == "debian" -o "${DISTID}" == "Debian" ]; then | |
- rm -vf /etc/init.d/leapd | |
-fi | |
diff --git a/orig/DEBIAN/prerm b/leap/DEBIAN/prerm | |
index 4f7cb47..d20be57 100755 | |
--- a/orig/DEBIAN/prerm | |
+++ b/leap/DEBIAN/prerm | |
@@ -2,3 +2,4 @@ | |
service leapd stop || true | |
killall LeapControlPanel Visualizer Recalibrate 2> /dev/null || true | |
+systemctl disable leapd | |
diff --git a/leap/etc/systemd/system/leapd.service b/leap/etc/systemd/system/leapd.service | |
new file mode 120000 | |
index 0000000..00fb055 | |
--- /dev/null | |
+++ b/leap/etc/systemd/system/leapd.service | |
@@ -0,0 +1 @@ | |
+/lib/systemd/system/leapd.service | |
\ No newline at end of file | |
diff --git a/leap/lib/systemd/system/leapd.service b/leap/lib/systemd/system/leapd.service | |
new file mode 100644 | |
index 0000000..a839e54 | |
--- /dev/null | |
+++ b/leap/lib/systemd/system/leapd.service | |
@@ -0,0 +1,10 @@ | |
+[Unit] | |
+Description=LeapMotion Daemon | |
+After=syslog.target | |
+ | |
+[Service] | |
+Type=simple | |
+ExecStart=/usr/sbin/leapd | |
+ | |
+[Install] | |
+WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment