install: replace install.sh with build.sh
This commit is contained in:
parent
e939562ee4
commit
d0b10e88bc
4 changed files with 28 additions and 18 deletions
|
@ -8,7 +8,11 @@ and TTYs.
|
||||||
|
|
||||||
With `go`, `libxkbcommon-dev` and `scdoc` installed, run:
|
With `go`, `libxkbcommon-dev` and `scdoc` installed, run:
|
||||||
|
|
||||||
sudo ./install.sh
|
./build.sh && sudo ./build.sh install
|
||||||
|
|
||||||
|
And to trigger the udev rule, run:
|
||||||
|
|
||||||
|
sudo udevadm control --reload && sudo udevadm trigger
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
|
22
build.sh
Executable file
22
build.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# ./build.sh ['install']
|
||||||
|
: "${DOTOOL_VERSION=$(git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 1.3)}"
|
||||||
|
: "${DOTOOL_DESTDIR=}"
|
||||||
|
: "${DOTOOL_BINDIR=usr/local/bin}"
|
||||||
|
: "${DOTOOL_UDEV_RULES_DIR=etc/udev/rules.d}"
|
||||||
|
|
||||||
|
if [ "$*" != '' ] && [ "$*" != install ]; then
|
||||||
|
echo bad usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ "$1" ]; then
|
||||||
|
go build -ldflags "-X main.Version=$DOTOOL_VERSION" || exit
|
||||||
|
echo Built Successfully.
|
||||||
|
else
|
||||||
|
install -Dm755 dotool dotoolc dotoold -t "$DOTOOL_DESTDIR/$DOTOOL_BINDIR" || exit
|
||||||
|
install -Dm644 80-dotool.rules -t "$DOTOOL_DESTDIR/$DOTOOL_UDEV_RULES_DIR" || exit
|
||||||
|
mkdir -p "$DOTOOL_DESTDIR/usr/share/man/man1" || exit
|
||||||
|
scdoc < doc/dotool.1.scd > "$DOTOOL_DESTDIR/usr/share/man/man1/dotool.1" || exit
|
||||||
|
echo Installed Successfully.
|
||||||
|
fi
|
17
install.sh
17
install.sh
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# ./install.sh [DESTDIR] [BINDIR]
|
|
||||||
: "${DOTOOL_VERSION=$(git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 1.3)}"
|
|
||||||
|
|
||||||
go build -buildvcs=false -ldflags "-X main.Version=$DOTOOL_VERSION" || exit
|
|
||||||
mkdir -p "$1/${2:-usr/local/bin}" || exit
|
|
||||||
cp -v dotool dotoolc dotoold "$1/${2:-usr/local/bin}" || exit
|
|
||||||
mkdir -p "$1/etc/udev/rules.d" || exit
|
|
||||||
cp -v 80-dotool.rules "$1/etc/udev/rules.d" || exit
|
|
||||||
|
|
||||||
# Remove files from before the keyboard layout approach changed
|
|
||||||
rm -f "$1/usr/share/X11/xorg.conf.d/50-dotool.conf"
|
|
||||||
rm -f "$1/etc/sway/config.d/dotool"
|
|
||||||
|
|
||||||
# Make the new/updated udev rule effective
|
|
||||||
udevadm control --reload
|
|
||||||
udevadm trigger
|
|
|
@ -1,3 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
rm -vf /usr/local/bin/dotool /usr/local/bin/dotoolc /usr/local/bin/dotoold
|
rm -vf /usr/local/bin/dotool /usr/local/bin/dotoolc /usr/local/bin/dotoold
|
||||||
rm -vf /etc/udev/rules.d/80-dotool.rules
|
rm -vf /etc/udev/rules.d/80-dotool.rules
|
||||||
|
rm -vf /usr/share/man/man1/dotool.1
|
||||||
|
|
Loading…
Reference in a new issue