From ee703cef93a7c87e229e2819c71af0adce83862b Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Mon, 1 Jul 2013 12:08:42 +0000 Subject: [PATCH] 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. --- conf.d/armh.mk | 4 ++-- features.in/live/config.mk | 3 ++- .../live/live/image-scripts.d/35-xdg-user-dirs | 12 ------------ features.in/xdg-user-dirs/README | 5 +++++ features.in/xdg-user-dirs/config.mk | 9 +++++++++ .../rootfs/image-scripts.d/35-xdg-user-dirs | 18 ++++++++++++++++++ 6 files changed, 36 insertions(+), 15 deletions(-) delete mode 100755 features.in/live/live/image-scripts.d/35-xdg-user-dirs create mode 100644 features.in/xdg-user-dirs/README create mode 100644 features.in/xdg-user-dirs/config.mk create mode 100755 features.in/xdg-user-dirs/rootfs/image-scripts.d/35-xdg-user-dirs diff --git a/conf.d/armh.mk b/conf.d/armh.mk index 7e881945..dd7c7239 100644 --- a/conf.d/armh.mk +++ b/conf.d/armh.mk @@ -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) diff --git a/features.in/live/config.mk b/features.in/live/config.mk index ba44d161..d119ac46 100644 --- a/features.in/live/config.mk +++ b/features.in/live/config.mk @@ -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 diff --git a/features.in/live/live/image-scripts.d/35-xdg-user-dirs b/features.in/live/live/image-scripts.d/35-xdg-user-dirs deleted file mode 100755 index dc678967..00000000 --- a/features.in/live/live/image-scripts.d/35-xdg-user-dirs +++ /dev/null @@ -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 diff --git a/features.in/xdg-user-dirs/README b/features.in/xdg-user-dirs/README new file mode 100644 index 00000000..79af0029 --- /dev/null +++ b/features.in/xdg-user-dirs/README @@ -0,0 +1,5 @@ +Эта фича обеспечивает наличие "ручки" для конфигурирования +типовых пользовательских каталогов для нескольких типов данных +и предоставляет возможность задавать предпочитаемые умолчания, +которые могут различаться по дистрибутивам; см. тж. +http://freedesktop.org/wiki/Software/xdg-user-dirs diff --git a/features.in/xdg-user-dirs/config.mk b/features.in/xdg-user-dirs/config.mk new file mode 100644 index 00000000..65f70806 --- /dev/null +++ b/features.in/xdg-user-dirs/config.mk @@ -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) diff --git a/features.in/xdg-user-dirs/rootfs/image-scripts.d/35-xdg-user-dirs b/features.in/xdg-user-dirs/rootfs/image-scripts.d/35-xdg-user-dirs new file mode 100755 index 00000000..7461d018 --- /dev/null +++ b/features.in/xdg-user-dirs/rootfs/image-scripts.d/35-xdg-user-dirs @@ -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