summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/create_media_dirs.sh
blob: 9e64301462213d03b8688f009fd25fcc57f13640 (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
#!/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
media/tv
media/tv/live
media/gallery
media/music
media/games/nes/roms
media/games/nes/screens
media/games/nes
media/games/pc/screens
media/games/pc
media/games/snes/roms
media/games/snes/screens
media/games/snes
media/games/xmame/cabs
media/games/xmame/flyers
media/games/xmame/hiscores
media/games/xmame/history
media/games/xmame/roms
media/games/xmame/screens
media/games/xmame
media/games
media/video
media/tmp
media/archive
media/pretty
media/streaming
media/video_stuff/trailers
media/video_stuff/coverart
media/video_stuff/fanart
media/video_stuff/screenshots
media/video_stuff/banners
media/games/screenshots
media/games/fanart
media/games/boxart
backup
backup/system_backups
backup/system_backups
backup/user_backups
backup/mythtv_backups
EOF

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