-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved support for systemd autostart.
- Loading branch information
Showing
10 changed files
with
200 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
[package] | ||
name = "empress" | ||
version = "1.0.2" | ||
version = "1.0.3" | ||
authors = ["rookie1024 <[email protected]>"] | ||
edition = "2018" | ||
description = "A D-Bus MPRIS daemon for controlling media players." | ||
documentation = "https://docs.rs/empress" | ||
readme = "README.md" | ||
repository = "https://github.com/ray-kast/empress" | ||
license = "AGPL-3.0-or-later" | ||
license-file = "LICENSE" | ||
keywords = ["mpris", "music", "play", "pause", "skip"] | ||
categories = ["command-line-utilities", "multimedia", "os"] | ||
|
||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Systemd unit file for empress | ||
|
||
[Unit] | ||
Description=A D-Bus MPRIS daemon for controlling media players. | ||
Documentation=https://github.com/ray-kast/empress/ | ||
PartOf=graphical-session.target | ||
|
||
[Service] | ||
Type=dbus | ||
BusName=net.ryan_s.Empress1 | ||
ExecStart=/path/to/empress server | ||
|
||
# vim:set ft=systemd: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# D-Bus service file for empress | ||
|
||
[D-BUS Service] | ||
Name=net.ryan_s.Empress1 | ||
Exec=/path/to/empress server | ||
SystemdService=empress.service | ||
|
||
# vim:set ft=toml: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#/bin/bash | ||
|
||
function usage() { | ||
cat <<EOF >&2 | ||
Usage: scripts/install.sh [FLAGS] [PATH] | ||
Installs (or uninstalls) service files for empress. PATH is an absolute path | ||
to the empress binary, and is required if -r is not present. | ||
Flags: | ||
-h Display this message and quit. | ||
-l Install service files to a local directory. | ||
-n Generate service files in target/ but do not install them. | ||
-r Remove already-installed service files. | ||
EOF | ||
} | ||
|
||
set -e | ||
|
||
loc='' | ||
noop='' | ||
remove='' | ||
|
||
while getopts "hlnr" opt; do | ||
case $opt in | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
l) | ||
loc='1' | ||
;; | ||
n) | ||
noop='1' | ||
;; | ||
r) | ||
remove='1' | ||
;; | ||
\?) | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
shift $((OPTIND - 1)) | ||
|
||
if [[ -z "$remove" ]] && (( $# != 1 )); then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
systemd_file=empress.service | ||
dbus_file=net.ryan_s.Empress1.service | ||
|
||
if [[ -z "$remove" ]]; then | ||
sed -e "s:/path/to/empress:$1:" "etc/$systemd_file.in" >"target/$systemd_file" | ||
sed -e "s:/path/to/empress:$1:" "etc/$dbus_file.in" >"target/$dbus_file" | ||
fi | ||
|
||
[[ -n "$noop" ]] && exit 0 | ||
|
||
systemd_dir="/usr/lib/systemd/user/" | ||
dbus_dir="/usr/share/dbus-1/services/" | ||
|
||
if [[ -n "$loc" ]]; then | ||
base="$XDG_DATA_HOME" | ||
|
||
[[ -n "$base" ]] || base="$HOME" | ||
|
||
systemd_dir="$base/.local/share/systemd/user" | ||
dbus_dir="$base/.local/share/dbus-1/services" | ||
fi | ||
|
||
mkdir -p "$systemd_dir" | ||
mkdir -p "$dbus_dir" | ||
|
||
fail=0 | ||
|
||
if [[ -z "$remove" ]]; then | ||
( | ||
install -vDm644 "target/$systemd_file" -t "$systemd_dir" && \ | ||
install -vDm644 "target/$dbus_file" -t "$dbus_dir" | ||
) || fail=$? | ||
else | ||
mv -v "$systemd_dir/$systemd_file" /tmp || fail=$? | ||
mv -v "$dbus_dir/$dbus_file" /tmp || fail=$? | ||
fi | ||
|
||
if [[ -n "$fail" ]]; then | ||
echo "ERROR: Installation failed." | ||
exit $fail | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ set -e | |
|
||
cd "$(dirname "$0")/.." | ||
|
||
ls | ||
|
||
cargo build --bin empress | ||
|
||
echo $'\x1b[1mStarting server...\x1b[m' | ||
|
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
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
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