OSDN Git Service

default permmision memo
[pukiwiki/pukiwiki_devel.git] / pkwk_chmod.sh
1 #!/bin/sh
2 # $Id: pkwk_chmod.sh,v 1.7 2011/01/16 15:05:08 henoheno Exp $
3 #  ==========================================================
4    Copyright='(C) 2002-2004 minix-up project, All Rights Reserved'
5    Homepage='http://cvsknit.sourceforge.net/'
6    License='(also revised)BSD Licnese, NO WARRANTY'
7 #
8
9
10 #    chmod 777 attach backup cache counter diff trackback wiki* 2>/dev/null
11 #    chmod 666 wiki*/*.txt cache/*.dat cache/*.ref cache/*.rel  2>/dev/null
12
13 check_dir()
14 {
15   for dir in "$@"; do
16     test -d "$dir" || return 1
17   done
18   return 0
19 }
20
21 list_dir()
22 {
23   # Needed
24   echo 'wiki'
25   echo 'diff'
26   echo 'backup'
27
28   # Optional
29   ls -d 'cache' 'counter' 'attach' wiki.[a-z][a-z] 2>/dev/null | while read dir; do
30     echo "$dir"
31   done
32 }
33
34 list_files()
35 {
36   for dir in "$@"; do
37     case "$dir" in
38       attach )
39          # Unfortunately attach/attached-files have no suffix
40          # that should be .bin or someting
41          find "$dir" -type f -name '*.log'
42       ;;
43       backup ) find "$dir" -type f \( -name '*.txt' -or -name '*.gz'     \) ;;
44       cache  ) find "$dir" -type f \( -name '*.dat' -or -name '*.re[fl]' \) ;;
45       *      ) find "$dir" -type f -name '*.txt' ;;
46     esac
47   done
48 }
49
50
51 # Validate
52 if ! check_dir ` list_dir ` ; then
53   echo 'ERROR: Seems not pukiwiki DATA_HOME'
54   exit 1
55 fi
56
57 # Run
58 list_dir | while read dir; do
59   chmod 777 "$dir" && {
60     list_files "$dir" | while read file; do
61       chmod 666 "$file"
62     done
63   }
64 done
65
66 # ERRATA
67 chmod a-x INSTALL.txt image/b_pukiwiki.official.png
68
69 chmod o+r *.php */*.php image/*.png image/face/*.png */index.html
70 chmod o+rx lib skin plugin image image/face
71
72 #chmod o+rx doc
73 #chmod o+r *.txt doc/*.txt
74