public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] New eclass: xdg-basedir
@ 2014-01-30  3:37 Mike Gilbert
  2014-01-30  8:11 ` [gentoo-dev] " Gilles Dartiguelongue
  2014-01-30 11:48 ` Michael Palimaka
  0 siblings, 2 replies; 11+ messages in thread
From: Mike Gilbert @ 2014-01-30  3:37 UTC (permalink / raw
  To: Gentoo Dev; +Cc: freedesktop-bugs


[-- Attachment #1.1: Type: text/plain, Size: 302 bytes --]

Here's a simple eclass that pretty much just extracts the XDG stuff from
the gnome2_environment_reset function.

One difference: it creates 3 of the 4 directories under ${HOME} instead
of ${T}, just to mimic the default behavior in the XDG basedir spec a
bit more closely.

Please give a look.

[-- Attachment #1.2: xdg-basedir.eclass --]
[-- Type: text/plain, Size: 1040 bytes --]

# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: xdg-basedir
# @MAINTAINER:
# freedesktop-bugs@gentoo.org
# @BLURB: Set up directories according to the XDG Base Directory Specification.
# @EXAMPLE:
# @CODE
# inherit xdg-basedir
#
# src_prepare() {
# 	xdg-basedir-setup
# }
# @CODE

# Unset these globally to avoid leaking values from the calling environment.
unset XDG_DATA_HOME XDG_CONFIG_HOME XDG_CACHE_HOME XDG_RUNTIME_DIR

# @FUNCTION: xdg-basedir-setup
# @DESCRIPTION:
# Creates sensible locations for the following environment variables:
# XDG_DATA_HOME
# XDG_CONFIG_HOME
# XDG_CACHE_HOME
# XDG_RUNTIME_DIR
xdg-basedir-setup() {
	export XDG_DATA_HOME="${HOME}/.local/share"
	export XDG_CONFIG_HOME="${HOME}/.config"
	export XDG_CACHE_HOME="${HOME}/.cache"
	export XDG_RUNTIME_DIR="${T}/run"
	mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" || die
	mkdir -p -m 0700 "${XDG_RUNTIME_DIR}" || die
}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-30 17:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-30  3:37 [gentoo-dev] New eclass: xdg-basedir Mike Gilbert
2014-01-30  8:11 ` [gentoo-dev] " Gilles Dartiguelongue
2014-01-30  8:24   ` Jonathan Callen
2014-01-30  8:29   ` Ulrich Mueller
2014-01-30  8:35     ` Gilles Dartiguelongue
2014-01-30 11:48 ` Michael Palimaka
2014-01-30 13:03   ` Ulrich Mueller
2014-01-30 14:45     ` Jeroen Roovers
2014-01-30 15:44       ` [gentoo-dev] Shell function names (was: New eclass: xdg-basedir) Ulrich Mueller
2014-01-30 17:32   ` [gentoo-dev] Re: New eclass: xdg-basedir Mike Gilbert
2014-01-30 17:45     ` Michael Palimaka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox