aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <pcmsinan@gmail.com>2023-02-18 15:38:11 +0530
committersinanmohd <pcmsinan@gmail.com>2023-02-18 16:33:39 +0530
commit2eb0c4f22d72db7a411d7ba74a1ca4d2fa27f74c (patch)
tree61661dc045690d769af7da952e47bea2a8d0f4fa
parent7cee8aa5eadafb01b8c68fd44b1b2b00a8bddf73 (diff)
clean: follow the xdg base directory specification
-rwxr-xr-xsoibox24
1 files changed, 12 insertions, 12 deletions
diff --git a/soibox b/soibox
index 20b9989..381be5b 100755
--- a/soibox
+++ b/soibox
@@ -1,9 +1,9 @@
#!/bin/sh
soibox_version="0.1"
-config_dir="$HOME/.config/soibox"
-store_dir="$HOME/.local/share/soibox"
-cache_dir="$HOME/.cache/soibox"
+config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/soibox"
+data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/soibox"
+cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}/soibox"
usage()
{
@@ -240,7 +240,7 @@ github_dl_release()
fi
# compare github releases with local cache
- for local_id in "$store_dir"/*
+ for local_id in "$data_dir"/*
do
case "${local_id##*/}" in
*[[:alpha:]])
@@ -280,15 +280,15 @@ github_dl_release()
note "downloading ${1##*/}, ${release##*/}"
curl -LO "$release_link" --output-dir "${3:-$cache_dir}"
- tar -xaf "${cache_dir}/${release_link##*/}" -C "$store_dir" \
+ tar -xaf "${cache_dir}/${release_link##*/}" -C "$data_dir" \
--one-top-level="${1##*/}:${release_gittag}-${release_id}" --strip-components 1 ||
die "failed to extract $cache_dir/${release_link##*/}"
if [ "$latest_id" -lt "$release_id" ]
then
- rm "${store_dir}/${1##*/}" 2> /dev/null
- ln -s "${store_dir}/${1##*/}:${release_gittag}-${release_id}" "${store_dir}/${1##*/}"
- dl_path="${store_dir}/${1##*/}/"
+ rm "${data_dir}/${1##*/}" 2> /dev/null
+ ln -s "${data_dir}/${1##*/}:${release_gittag}-${release_id}" "${data_dir}/${1##*/}"
+ dl_path="${data_dir}/${1##*/}/"
fi
fi
@@ -543,8 +543,8 @@ main()
die "dont run soibox as root"
[ -d "$config_dir" ] ||
mkdir -p "$config_dir"
- [ -d "$store_dir" ] ||
- mkdir -p "$store_dir"
+ [ -d "$data_dir" ] ||
+ mkdir -p "$data_dir"
[ -d "$cache_dir" ] ||
mkdir -p "$cache_dir"
@@ -633,7 +633,7 @@ main()
[ "$loglevel" != 0 ] && [ -n "$banner" ] &&
print_banner "$(absolute_path "$banner" "$local_config")"
- WINEPREFIX="${store_dir}/prefix"
+ WINEPREFIX="${data_dir}/prefix"
[ -n "$wine_prefix" ] &&
WINEPREFIX="$(absolute_path "$wine_prefix" "$local_config")"
export WINEPREFIX
@@ -656,7 +656,7 @@ main()
## gamemode wont work without --ignore=noroot, https://github.com/netblue30/firejail/issues/5035
if [ "$firejail" = on ] && dep_check "firejail"
then
- cmd="--whitelist=${WINEPREFIX} --whitelist=${store_dir} --whitelist=${groot} ${cmd}"
+ cmd="--whitelist=${WINEPREFIX} --whitelist=${data_dir} --whitelist=${groot} ${cmd}"
cmd="firejail --net=none --ignore=noroot --profile=${firejail_prof:-steam} ${cmd}"
fi
## gamemode wont recognize gamescope, but it's necessary to work with firejail