summaryrefslogtreecommitdiffstats
path: root/trunk/files/desktop-directories-liveusb-rw
diff options
context:
space:
mode:
authorThomas Backlund <tmb@mageia.org>2012-05-26 15:24:36 +0000
committerThomas Backlund <tmb@mageia.org>2012-05-26 15:24:36 +0000
commit07cb265cf99918196a257585757a3c2bb175f57f (patch)
tree834d1a087b069104babdd124681c59045636d3f3 /trunk/files/desktop-directories-liveusb-rw
parentc8f4f11fd9e32b4b87197de0e0b63a4ed500f6ad (diff)
downloaddraklive-config-07cb265cf99918196a257585757a3c2bb175f57f.tar
draklive-config-07cb265cf99918196a257585757a3c2bb175f57f.tar.gz
draklive-config-07cb265cf99918196a257585757a3c2bb175f57f.tar.bz2
draklive-config-07cb265cf99918196a257585757a3c2bb175f57f.tar.xz
draklive-config-07cb265cf99918196a257585757a3c2bb175f57f.zip
branch for mga 1
Diffstat (limited to 'trunk/files/desktop-directories-liveusb-rw')
-rwxr-xr-xtrunk/files/desktop-directories-liveusb-rw37
1 files changed, 37 insertions, 0 deletions
diff --git a/trunk/files/desktop-directories-liveusb-rw b/trunk/files/desktop-directories-liveusb-rw
new file mode 100755
index 0000000..3fd7635
--- /dev/null
+++ b/trunk/files/desktop-directories-liveusb-rw
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+LIVEUSB_LOCK="$HOME/.liveusb-folders"
+LIVEUSB_ROOT=/live/media
+[ -e "$LIVEUSB_ROOT/My Documents" ] && LIVEUSB_ALA_WINDOWS=1
+
+[ -e $LIVEUSB_LOCK ] && exit
+
+while pidof -x xdg-user-dirs-update; do
+ [ "$SECONDS" -le 60 ] || return
+ sleep 1
+done
+
+function create_link() {
+ NAME=$1
+ SRC=$2
+ [ -z "$SRC" ] && SRC=$($NAME)
+ XDG_DIR=$(xdg-user-dir $NAME)
+ LIVEUSB_DIR="$LIVEUSB_ROOT/$SRC"
+ mkdir -p "$LIVEUSB_DIR"
+ mv $XDG_DIR/{.??,}* "$LIVEUSB_DIR"
+ rmdir $XDG_DIR && ln -sf "$LIVEUSB_DIR" "$XDG_DIR"
+}
+
+if [ -n "$LIVEUSB_ALA_WINDOWS" ]; then
+ create_link "DOCUMENTS" "My Documents"
+ create_link "DOWNLOAD" "My Documents/My Downloads"
+ create_link "MUSIC" "My Documents/My Music"
+ create_link "PICTURES" "My Documents/My Images"
+ create_link "VIDEOS" "My Documents/My Video"
+else
+ for d in DOWNLOAD DOCUMENTS MUSIC PICTURES VIDEOS; do
+ create_link $d $(echo $d | tr A-Z a-z)
+ done
+fi
+
+touch $LIVEUSB_LOCK