factor out xdg-user-dirs feature

This script hook used to lurk in live feature but was deemed needed
in cubox images too; thus it's time to move it into a standalone
feature (maybe a configurable one, even).

Thanks glebfm@ for initial shot and sem@ for discussion.
This commit is contained in:
Michael Shigorin 2013-07-01 12:08:42 +00:00
parent 8613271d5d
commit ee703cef93
6 changed files with 36 additions and 15 deletions

View File

@ -35,8 +35,8 @@ vm/.arm-base: profile/bare use/kernel use/net-eth/dhcp use/vm-ssh; @:
@$(call add,BASE_PACKAGES,mkinitrd uboot-tools)
@$(call set,BRANDING,altlinux-kdesktop)
vm/.cubox-bare: vm/.arm-base use/armh use/armh-cubox use/services/ssh \
use/cleanup/installer use/repo use/branding +systemd
vm/.cubox-bare: vm/.arm-base use/armh use/armh-cubox use/services/ssh +systemd \
use/cleanup/installer use/repo use/branding use/xdg-user-dirs/deep
@$(call set,KFLAVOURS,cubox)
@$(call set,BRANDING,altlinux-kdesktop)
@$(call add,THE_BRANDING,alterator graphics indexhtml menu notes)

View File

@ -26,7 +26,8 @@ use/live/x11: use/live/base use/x11-autologin use/live/sound +power +efi
@$(call add,SYSLINUX_CFG,localboot)
# this target specifically pulls free xorg drivers in (and a few more bits)
use/live/desktop: use/live/x11 use/x11/xorg use/x11/wacom +vmguest; @:
use/live/desktop: use/live/x11 use/x11/xorg use/x11/wacom \
use/xdg-user-dirs/deep +vmguest; @:
# preconfigure apt for both live and installed-from-live systems
use/live/repo: use/live

View File

@ -1,12 +0,0 @@
#!/bin/sh
# Turn on xdg-user-dirs.
# NB: not yet available on t6/p6 hence the warning
. shell-config
if control xdg-user-dirs enabled; then
shell_config_set /etc/xdg/user-dirs.defaults MOVIES 'Documents/Videos'
shell_config_set /etc/xdg/user-dirs.defaults PHOTOS 'Documents/Pictures'
else
echo "** warning: control xdg-user-dirs failed" >&2
fi

View File

@ -0,0 +1,5 @@
Эта фича обеспечивает наличие "ручки" для конфигурирования
типовых пользовательских каталогов для нескольких типов данных
и предоставляет возможность задавать предпочитаемые умолчания,
которые могут различаться по дистрибутивам; см. тж.
http://freedesktop.org/wiki/Software/xdg-user-dirs

View File

@ -0,0 +1,9 @@
use/xdg-user-dirs:
@$(call add_feature)
@$(call add,THE_PACKAGES,xdg-user-dirs)
@$(call xport,XDG_USER_DIRS)
# tweak some values to move these dirs into Documents/
use/xdg-user-dirs/deep: use/xdg-user-dirs
@$(call add,XDG_USER_DIRS,MOVIES:Documents/Videos)
@$(call add,XDG_USER_DIRS,PHOTOS:Documents/Pictures)

View File

@ -0,0 +1,18 @@
#!/bin/sh
# turn on xdg-user-dirs.and tweak its defaults if told so
# (using tuples like "PHOTOS:Documents/Pictures")
. shell-config
CONFIG="/etc/xdg/user-dirs.defaults"
if control xdg-user-dirs enabled; then
if [ -n "$GLOBAL_XDG_USER_DIRS" ]; then
echo "$GLOBAL_XDG_USER_DIRS" \
| tr ' ' '\n' \
| while IFS=':' read k v; do
[ -n "$k" -a -n "$v" ] || continue
shell_config_set "$CONFIG" "$k" "$v"
done
fi
fi