blob: 3fd76355224602cc6bf602fa60b10d66fee862d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|