summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/create_media_dirs.sh
blob: 64970d0db69946e33bdac8f278c55e00168b831c (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
#script to create the media directories
#call it like so
#create_media_dirs.sh /top_level_path

topdir=$1

if [ x$topdir = "x" ]
then
    echo "Top level dir is empty"
    exit 1
fi

if [ ! -d "$topdir" ]
then
    echo "$topdir is not a dir or does not exist"
    exit 2
fi



while read dirname
do
    mkdir -p "${topdir}/${dirname}"
    touch "${topdir}/${dirname}/.media"
    chown  mythtv:users "${topdir}/${dirname}"
    chmod  775  "${topdir}/${dirname}"
    chmod  775  "${topdir}/${dirname}/.media"
done <<EOF
tv
tv/live
gallery
music
games/nes/roms
games/nes/screens
games/nes
games/pc/screens
games/pc
games/snes/roms
games/snes/screens
games/snes
games/xmame/cabs
games/xmame/flyers
games/xmame/hiscores
games/xmame/history
games/xmame/roms
games/xmame/screens
games/xmame
games
backup
image_cache
video/.covers
video/archive
video
motion
tmp
archive
stream
pretty
video_stuff/trailers
video_stuff/coverart
video_stuff/fanart
video_stuff/screenshots
video_stuff/banners
games/screenshots
games/fanart
games/boxart
system_backups/restore
EOF

chown -R mythtv:users ${topdir}
chmod -R 775  ${topdir}