Use XDG directories explicitly
This commit is contained in:
parent
40532e1bc6
commit
333a45fd7c
11 changed files with 52 additions and 34 deletions
|
@ -1,2 +1,4 @@
|
|||
#!/bin/sh
|
||||
./admin-cli.yml -K -i ./local.ini && ./user-cli.yml -i ./local.ini
|
||||
. ./roles/home-cli/files/bashrc
|
||||
./admin-cli.yml -K -i ./local.ini
|
||||
./user-cli.yml -i ./local.ini
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
#!/bin/sh
|
||||
./admin-gui.yml -K -i ./local.ini && ./user-gui.yml -i ./local.ini
|
||||
. ./roles/home-cli/files/bashrc
|
||||
./admin-gui.yml -K -i ./local.ini
|
||||
./user-gui.yml -i ./local.ini
|
||||
|
|
|
@ -8,6 +8,20 @@ else
|
|||
export ACP="$HOME/data"
|
||||
fi
|
||||
|
||||
# Set up XDG variables. See:
|
||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
|
||||
export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg}
|
||||
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
if [ ! -d $XDG_DATA_HOME ] ; then install -d -m 0700 "$XDG_DATA_HOME" ; fi
|
||||
if [ ! -d $XDG_CACHE_HOME ] ; then install -d -m 0700 "$XDG_CACHE_HOME" ; fi
|
||||
if [ ! -d $XDG_CONFIG_HOME ] ; then install -d -m 0700 "$XDG_CONFIG_HOME" ; fi
|
||||
if [ ! -d $XDG_STATE_HOME ] ; then install -d -m 0700 "$XDG_STATE_HOME" ; fi
|
||||
if [ ! -d "$HOME/.local/bin" ] ; then install -d -m 0700 "$HOME/.local/bin" ; fi
|
||||
|
||||
if [ -n "$ZSH_VERSION" ]
|
||||
then
|
||||
# These commands do not exist in zsh.
|
||||
|
@ -50,12 +64,11 @@ _acp_add_path () {
|
|||
# Last in the list means first in the path.
|
||||
for dir in "$HOME/.local/bin" \
|
||||
"$HOME/.cargo/bin" \
|
||||
"${XDG_DATA_HOME:-$HOME/.local/share}/gem/ruby/bin" \
|
||||
"${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/exports/bin" \
|
||||
"$XDG_DATA_HOME/gem/ruby/bin" \
|
||||
"$XDG_DATA_HOME/flatpak/exports/bin" \
|
||||
/opt/local/bin \
|
||||
/opt/local/sbin \
|
||||
/var/lib/flatpak/exports/bin \
|
||||
$ACP/bin \
|
||||
/usr/local/bin \
|
||||
/usr/local/sbin \
|
||||
/usr/bin \
|
||||
|
@ -80,9 +93,9 @@ if [ -f /etc/locale.conf ]
|
|||
then
|
||||
. /etc/locale.conf
|
||||
fi
|
||||
if [ -f "${XDG_CONFIG_DIR:-$HOME/.config}/locale.conf" ]
|
||||
if [ -f "$XDG_CONFIG_DIR/locale.conf" ]
|
||||
then
|
||||
. "${XDG_CONFIG_DIR:-$HOME/.config}/locale.conf"
|
||||
. "$XDG_CONFIG_DIR/locale.conf"
|
||||
fi
|
||||
|
||||
# Other exports.
|
||||
|
@ -177,7 +190,7 @@ alias en="LANG=en_GB.UTF-8"
|
|||
alias fr="LANG=fr_FR.UTF-8"
|
||||
|
||||
# Alias dig to drill if dig is not installed.
|
||||
if [ -x /usr/bin/drill ] && ! [ -x /usr/bin/dig ]
|
||||
if [ -x /usr/bin/drill ]
|
||||
then
|
||||
alias dig=drill
|
||||
fi
|
||||
|
@ -186,7 +199,7 @@ fi
|
|||
if [ -x "$ACP/opt/go/bin/go" ] || [ -x /usr/bin/go ] || [ -x /usr/local/bin/go ]
|
||||
then
|
||||
export GOPROXY=https://proxy.golang.org
|
||||
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
||||
export GOPATH="$XDG_DATA_HOME/go"
|
||||
if [ ! -d "$GOPATH" ]
|
||||
then
|
||||
mkdir -p "$GOPATH/bin"
|
||||
|
|
|
@ -22,9 +22,10 @@
|
|||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.local/bin"
|
||||
state: directory
|
||||
mode: '0700'
|
||||
- name: Create systemd user directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.config/systemd/user"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}/systemd/user"
|
||||
state: directory
|
||||
- name: Create ~/.ssh directory
|
||||
ansible.builtin.file:
|
||||
|
@ -33,17 +34,17 @@
|
|||
mode: '0700'
|
||||
- name: Create ~/.config directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.config"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}"
|
||||
state: directory
|
||||
- name: Create ~/.config/git directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.config/git"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}/git"
|
||||
state: directory
|
||||
- name: Create ~/.config/mc directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.config/mc"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}/mc"
|
||||
state: directory
|
||||
- name: Create ~/.config/powershell directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.config/powershell"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}/powershell"
|
||||
state: directory
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
- name: Copy openpgp.asc
|
||||
ansible.builtin.copy:
|
||||
src: openpgp.asc
|
||||
dest: "{{ ansible_env.HOME }}/.config/openpgp.asc"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/openpgp.asc"
|
||||
- name: Copy .dput.cf
|
||||
ansible.builtin.copy:
|
||||
src: dput.cf
|
||||
|
@ -40,7 +40,7 @@
|
|||
- name: Copy .config/git/config
|
||||
ansible.builtin.copy:
|
||||
src: gitconfig
|
||||
dest: "{{ ansible_env.HOME }}/.config/git/config"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/git/config"
|
||||
- name: Copy .quiltrc-dpkg
|
||||
ansible.builtin.copy:
|
||||
src: quiltrc-dpkg
|
||||
|
@ -61,12 +61,12 @@
|
|||
- name: Copy mc ini
|
||||
ansible.builtin.copy:
|
||||
src: mc.ini
|
||||
dest: "{{ ansible_env.HOME }}/.config/mc/ini"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/mc/ini"
|
||||
- name: Copy mc panels.ini
|
||||
ansible.builtin.copy:
|
||||
src: mc.panels.ini
|
||||
dest: "{{ ansible_env.HOME }}/.config/mc/panels.ini"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/mc/panels.ini"
|
||||
- name: Copy Microsoft.PowerShell_profile.ps1
|
||||
ansible.builtin.copy:
|
||||
src: Microsoft.PowerShell_profile.ps1
|
||||
dest: "{{ ansible_env.HOME }}/.config/powershell/Microsoft.PowerShell_profile.ps1"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/powershell/Microsoft.PowerShell_profile.ps1"
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
- name: Create user applications directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.local/share/applications"
|
||||
path: "{{ ansible_env.XDG_DATA_HOME }}/applications"
|
||||
state: directory
|
||||
- name: Create user autostart directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.config/autostart"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}/autostart"
|
||||
state: directory
|
||||
- name: Create ~/.fvwm directory
|
||||
ansible.builtin.file:
|
||||
|
@ -27,9 +27,9 @@
|
|||
state: directory
|
||||
- name: Create ~/.local/share/fonts directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.local/share/fonts"
|
||||
path: "{{ ansible_env.XDG_DATA_HOME }}/fonts"
|
||||
state: directory
|
||||
- name: Create ~/.config/fontconfig directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.config/fontconfig"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}/fontconfig"
|
||||
state: directory
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
- name: Load ~/.Xresources
|
||||
ansible.builtin.copy:
|
||||
src: "xrdb.desktop"
|
||||
dest: "{{ ansible_env.HOME }}/.config/autostart/xrdb.desktop"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/autostart/xrdb.desktop"
|
||||
when: ansible_distribution == "Fedora" or ansible_distribution == "Debian"
|
||||
- name: Add to-do list launcher
|
||||
ansible.builtin.template:
|
||||
src: todo.desktop
|
||||
dest: "{{ ansible_env.HOME }}/.local/share/applications/todo.desktop"
|
||||
dest: "{{ ansible_env.XDG_DATA_HOME }}/applications/todo.desktop"
|
||||
- name: Copy .xbindkeysrc
|
||||
ansible.builtin.copy:
|
||||
src: "xbindkeysrc"
|
||||
|
@ -52,4 +52,4 @@
|
|||
- name: Copy fonts.conf
|
||||
ansible.builtin.copy:
|
||||
src: "fonts.conf"
|
||||
dest: "{{ ansible_env.HOME }}/.config/fontconfig/fonts.conf"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/fontconfig/fonts.conf"
|
||||
|
|
|
@ -30,14 +30,14 @@
|
|||
- name: Create Emacs user service (Linux)
|
||||
ansible.builtin.template:
|
||||
src: emacs.service
|
||||
dest: "{{ ansible_env.HOME }}/.config/systemd/user/emacs.service"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/systemd/user/emacs.service"
|
||||
vars:
|
||||
prefix: "{{ '/usr' if ansible_system == 'Linux' else '/usr/pkg' if ansible_system == 'NetBSD' else '/usr/local' }}"
|
||||
when: ansible_system == 'Linux' and emacs_binary.stat.exists == True
|
||||
- name: Add Emacs server to autostart (FreeBSD)
|
||||
ansible.builtin.copy:
|
||||
src: '{{ ansible_env.HOME }}/.emacs.d/emacs-server.desktop'
|
||||
dest: '{{ ansible_env.HOME }}/.config/autostart'
|
||||
dest: '{{ ansible_env.XDG_CONFIG_HOME }}/autostart'
|
||||
remote_src: yes
|
||||
when: ansible_system == 'FreeBSD' and emacs_binary.stat.exists == True
|
||||
- name: Start Emacs user service
|
||||
|
@ -51,6 +51,6 @@
|
|||
- name: Create Emacs client launcher
|
||||
ansible.builtin.copy:
|
||||
src: "{{ ansible_env.HOME }}/.emacs.d/emacs-client.desktop"
|
||||
dest: "{{ ansible_env.HOME }}/.local/share/applications/emacs.desktop"
|
||||
dest: "{{ ansible_env.XDG_DATA_HOME }}/applications/emacs.desktop"
|
||||
remote_src: yes
|
||||
when: emacs_binary.stat.exists == True
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
- name: Set Linux font directory
|
||||
set_fact:
|
||||
font_dir: "{{ ansible_env.HOME }}/.local/share/fonts"
|
||||
font_dir: "{{ ansible_env.XDG_DATA_HOME }}/fonts"
|
||||
- name: Set MacOSX font directory
|
||||
set_fact:
|
||||
font_dir: "{{ ansible_env.HOME }}/Library/Fonts"
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
- name: Create MATE layouts directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/.local/share/mate-panel/layouts"
|
||||
path: "{{ ansible_env.XDG_DATA_HOME }}/mate-panel/layouts"
|
||||
state: directory
|
||||
- name: Copy MATE panel layout
|
||||
ansible.builtin.template:
|
||||
src: mate-acp.layout
|
||||
dest: "{{ ansible_env.HOME }}/.local/share/mate-panel/layouts/acp.layout"
|
||||
dest: "{{ ansible_env.XDG_DATA_HOME }}/mate-panel/layouts/acp.layout"
|
||||
vars:
|
||||
prefix: "{{ '/usr' if ansible_system == 'Linux' else '/usr/pkg' if ansible_system == 'NetBSD' else '/usr/local' }}"
|
||||
esr: "{{ '-esr' if ansible_distribution == 'Debian' else '' }}"
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
|
||||
- name: Check for Sublime Text directory
|
||||
ansible.builtin.stat:
|
||||
path: "{{ ansible_env.HOME }}/.config/sublime-text/Packages/User"
|
||||
path: "{{ ansible_env.XDG_CONFIG_HOME }}/sublime-text/Packages/User"
|
||||
register: sublime
|
||||
- name: Copy Sublime Text preferences
|
||||
ansible.builtin.copy:
|
||||
src: Preferences.sublime-settings
|
||||
dest: "{{ ansible_env.HOME }}/.config/sublime-text/Packages/User/Preferences.sublime-settings"
|
||||
dest: "{{ ansible_env.XDG_CONFIG_HOME }}/sublime-text/Packages/User/Preferences.sublime-settings"
|
||||
when: sublime.stat.exists
|
||||
|
|
Loading…
Reference in a new issue