diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2026-09-16 21:35:11 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2026-09-16 21:35:11 +0200 |
| commit | 4558ca2fb10c144e1f7ab380329eb577e12851d3 (patch) | |
| tree | 97283d5b62c8b4d041ec6a6a6f955b91ed4947a7 | |
| parent | cde0c2c3259743ab0f63ff19d1a9b87298df41f3 (diff) | |
Make Runtime Dir Creation Linux-Only
The `XDG_RUNTIME_DIR` is a Linux-only thing, and there is no
established equivalent on macOS, so just don't create the
directory.
Also cleaned up some "if unset" expansions in the script.
| -rwxr-xr-x | dbx | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -20,7 +20,9 @@ args=() OS="$(uname -s)" DATADIR="${XDG_DATA_HOME:-$HOME/.local/share}/dbx" CONFIGDIR="${XDG_CONFIG_HOME:-$HOME/.config}/dbx" -RUNTIMEDIR="${XDG_RUNTIME_DIR:-/run/user/$UID}/dbx" +if [ "$OS" = "Linux" ]; then + RUNTIMEDIR="${XDG_RUNTIME_DIR:-/run/user/$UID}/dbx" +fi usage() { cat <<USAGE @@ -178,7 +180,7 @@ parse_opt() { parse_opts() { local optstr=":hvn:" - if [ -n "${DBX_NAME:-}" ]; then + if [ -n "${DBX_NAME-}" ]; then name="$(parse_name "$DBX_NAME")" fi @@ -206,7 +208,7 @@ parse_opts() { OPTIND=1 while getopts "$optstr" opt; do - parse_opt "$opt" "${OPTARG:-?}" + parse_opt "$opt" "${OPTARG-?}" done shift $((OPTIND - 1)) @@ -257,7 +259,10 @@ parse_opts() { } dbx_mkdirs() { - mkdir -p "$DATADIR" "$CONFIGDIR" "$RUNTIMEDIR" + mkdir -p "$DATADIR" "$CONFIGDIR" + if [ -n "${RUNTIMEDIR-}" ]; then + mkdir -p "$RUNTIMEDIR" + fi } ssh_id() { |
