summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO23
-rw-r--r--.gitignore6
-rw-r--r--PKGBUILD51
-rw-r--r--xdg.patch31
4 files changed, 111 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..5650d772c8db
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,23 @@
+pkgbase = earbuds-xdg-git
+ pkgdesc = Control your galaxy buds live via cli w/ XDG Base Directory support
+ pkgver = v0.1.9.r19.g4a2d75f
+ pkgrel = 1
+ url = https://github.com/JojiiOfficial/LiveBudsCli
+ arch = x86_64
+ license = GPL3
+ makedepends = cargo
+ makedepends = git
+ makedepends = bluez
+ makedepends = bluez-libs
+ makedepends = gcc-libs
+ makedepends = glibc
+ provides = earbuds
+ provides = earbuds-git
+ conflicts = earbuds
+ conflicts = earbuds-git
+ source = git+https://github.com/JojiiOfficial/LiveBudsCli
+ source = xdg.patch
+ md5sums = SKIP
+ md5sums = e5d31b44912bc1450ae46490508d15a2
+
+pkgname = earbuds-xdg-git
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..35f857e6f45e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+pkg/
+src/
+*\.tar\.*
+*\.pub
+*\.signature
+LiveBudsCli/
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..942f866e4f86
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,51 @@
+# Maintainer: erayaydin <erayaydinn@protonmail.com>
+# Maintainer: jojii <jojii@gmx.net>
+pkgname=earbuds-xdg-git
+_pkgname=earbuds
+_gitname=LiveBudsCli
+pkgver=v0.1.9.r19.g4a2d75f
+pkgrel=1
+pkgdesc="Control your galaxy buds live via cli w/ XDG Base Directory support"
+url="https://github.com/JojiiOfficial/LiveBudsCli"
+license=("GPL3")
+source=(
+ "git+$url"
+ 'xdg.patch'
+)
+md5sums=(
+ 'SKIP'
+ 'e5d31b44912bc1450ae46490508d15a2'
+)
+arch=("x86_64")
+conflicts=("earbuds" "earbuds-git")
+provides=("earbuds" "earbuds-git")
+makedepends=("cargo" "git" "bluez" "bluez-libs" "gcc-libs" "glibc")
+
+pkgver() {
+ cd $_gitname
+ git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ patch --directory="$_gitname" --forward --strip=1 --input="${srcdir}/xdg.patch"
+}
+
+build() {
+ cd $_gitname
+
+ cargo build --release
+}
+
+package() {
+ cd $_gitname
+ usrdir="$pkgdir/usr"
+ mkdir -p $usrdir
+ install -Dm 755 "target/release/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
+ install -Dm 755 "LICENSE" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
+
+ ./target/release/${_pkgname} --generate=zsh > _${_pkgname}
+ install -Dm 644 _earbuds "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
+
+ ./target/release/${_pkgname} --generate=bash > ${_pkgname}.fish
+ install -Dm 644 ${_pkgname}.fish "${pkgdir}/usr/share/fish/vendor_completions.d/${_pkgname}.fish"
+}
diff --git a/xdg.patch b/xdg.patch
new file mode 100644
index 000000000000..6e703867c94f
--- /dev/null
+++ b/xdg.patch
@@ -0,0 +1,31 @@
+diff --git a/src/daemon/buds_config.rs b/src/daemon/buds_config.rs
+index 3929269..42aac1d 100644
+--- a/src/daemon/buds_config.rs
++++ b/src/daemon/buds_config.rs
+@@ -164,7 +164,11 @@ impl Config {
+
+ // Create missing folders and return the config file
+ pub async fn get_config_file() -> Result<PathBuf, String> {
+- let conf_dir: PathBuf = get_home_dir().unwrap().join(".config").join("livebuds");
++ let conf_home: PathBuf = match get_xdg_config() {
++ Some(x) => x,
++ None => get_home_dir().unwrap().join(".config")
++ };
++ let conf_dir: PathBuf = conf_home.join("livebuds");
+
+ if !conf_dir.exists().await {
+ fs::create_dir_all(&conf_dir)
+@@ -176,6 +180,13 @@ impl Config {
+ }
+ }
+
++pub fn get_xdg_config() -> Option<PathBuf> {
++ std::env::var_os("XDG_CONFIG_HOME")
++ .and_then(|xdg| if xdg.is_empty() { None } else { Some(xdg) })
++ .or(None)
++ .map(PathBuf::from)
++}
++
+ pub fn get_home_dir() -> Option<PathBuf> {
+ std::env::var_os("HOME")
+ .and_then(|home| if home.is_empty() { None } else { Some(home) })