xdg-user-dirs: employ control feature

Maybe the conditionals shouldn't be too terse, by the way...
This commit is contained in:
Michael Shigorin 2013-07-07 18:16:18 +04:00
parent f123fea698
commit d79061fb44
2 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,6 @@
use/xdg-user-dirs: use/xdg-user-dirs: use/control
@$(call add_feature) @$(call add_feature)
@$(call add,CONTROL,xdg-user-dirs:enabled)
@$(call add,THE_PACKAGES,xdg-user-dirs) @$(call add,THE_PACKAGES,xdg-user-dirs)
@$(call xport,XDG_USER_DIRS) @$(call xport,XDG_USER_DIRS)

View File

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