Skip to content

Commit

Permalink
Add conveniences for packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Pippadi committed Jun 4, 2023
1 parent 6dff268 commit 4a21ec1
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
go.work
WiiWill
fyne-cross
pkg/WiiWill.tar.xz
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ A simple Wii remote gamepad mapper for Linux.

## Usage

1. Build with `go build` [TODO: publish prebuilt binary]
2. Instantiate `uinput` kernel module with `sudo modprobe uinput`
3. Start program
4. Connect Wii remote from system's bluetooth settings
1. Download the tarball from the releases section
2. Untar with `tar -xvf WiiWill.tar.xz`
3. Install `make` if you haven't already, and run `sudo make install`
4. Start program
5. Connect Wii remote from system's bluetooth settings

Steps 3 and 4 *must* be done in order for WiiWill to recognize the remote.
Steps 3 and 4 *must* be done in order for WiiWill to recognize the remote. Uninstall with `sudo make uninstall`.

## Motivations

Expand Down
3 changes: 3 additions & 0 deletions pkg/49-wiiwill.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See https://stackoverflow.com/questions/11939255/writing-to-dev-uinput-on-ubuntu-12-04

KERNEL=="uinput", TAG+="uaccess"
34 changes: 34 additions & 0 deletions pkg/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# If PREFIX isn't provided, we check for $(DESTDIR)/usr/local and use that if it exists.
# Otherwice we fall back to using /usr.

LOCAL != test -d $(DESTDIR)/usr/local && echo -n "/local" || echo -n ""
LOCAL ?= $(shell test -d $(DESTDIR)/usr/local && echo "/local" || echo "")
PREFIX ?= /usr$(LOCAL)

Name := "WiiWill"
Exec := "WiiWill"
Icon := "WiiWill.png"

default:
# User install
# Run "make user-install" to install in ~/.local/
# Run "make user-uninstall" to uninstall from ~/.local/
#
# System install
# Run "sudo make install" to install the application.
# Run "sudo make uninstall" to uninstall the application.

install:
install -Dm00644 usr/local/share/applications/$(Name).desktop $(DESTDIR)$(PREFIX)/share/applications/$(Name).desktop
install -Dm00755 usr/local/bin/$(Exec) $(DESTDIR)$(PREFIX)/bin/$(Exec)
install -Dm00644 usr/local/share/pixmaps/$(Icon) $(DESTDIR)$(PREFIX)/share/pixmaps/$(Icon)
install -Dm00644 etc/modules-load.d/uinput.conf /etc/modules-load.d/uinput.conf
install -Dm00644 etc/udev/rules.d/49-wiiwill.rules /etc/udev/rules.d/49-wiiwill.rules
udevadm control --reload-rules
modprobe uinput
uninstall:
-rm $(DESTDIR)$(PREFIX)/share/applications/$(Name).desktop
-rm $(DESTDIR)$(PREFIX)/bin/$(Exec)
-rm $(DESTDIR)$(PREFIX)/share/pixmaps/$(Icon)
-rm /etc/modules-load.d/uinput.conf
-rm /etc/udev/rules.d/49-wiiwill.rules
23 changes: 23 additions & 0 deletions pkg/generateTar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

cd "$(dirname $0)"/..
repodir="$PWD"
cd -
tarfile="WiiWill.tar.xz"

cd "$repodir"
make clean
make tar

cd "$repodir"/fyne-cross/dist/linux-amd64/
tar -xvf "$tarfile"
rm "$tarfile"

mkdir -p etc/modules-load.d
mkdir -p etc/udev/rules.d
cp "$repodir"/pkg/uinput.conf etc/modules-load.d
cp "$repodir"/pkg/49-wiiwill.rules etc/udev/rules.d
cp "$repodir"/pkg/Makefile .

tar -cJvf "$repodir/pkg/$tarfile" *
cd "$(dirname $0)"
1 change: 1 addition & 0 deletions pkg/uinput.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uinput

0 comments on commit 4a21ec1

Please sign in to comment.