-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·72 lines (60 loc) · 1.38 KB
/
setup.sh
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/sh
PROGNAME=$(basename "$0")
case "$1" in
-h|--help)
echo "usage: $PROGNAME [fswiki_home]"
;;
-v|--version)
echo "$PROGNAME version 0.01"
exit
;;
esac
echo "# fswiki setup (for 3.5.8)..."
echo "prepare..."
if test -z "$FSWIKI_HOME";
then
FSWIKI_HOME=.
fi
if test -n "$1";
then
FSWIKI_HOME="$1"
fi
echo " FSWIKI_HOME=$FSWIKI_HOME"
PERM_DIR=777
PERM_FILE=666
PERM_EXE=755
echo " check $FSWIKI_HOME/wiki.cgi..."
if test -e "$FSWIKI_HOME/wiki.cgi";
then
echo " ok"
else
echo " $FSWIKI_HOME/wiki.cgi not exists!!"
exit 1
fi
echo "do..."
chmod $PERM_EXE "$FSWIKI_HOME"/wiki.cgi || exit 1
for dir in backup attach pdf log data config theme tmpl tools;
do
echo " check $FSWIKI_HOME/$dir..."
test -d "$FSWIKI_HOME"/$dir || mkdir "$FSWIKI_HOME"/$dir || exit 1
find "$FSWIKI_HOME/$dir" -type d -exec chmod $PERM_DIR {} \;
find "$FSWIKI_HOME/$dir" -type f -exec chmod $PERM_FILE {} \;
done
for logfile in access.log attach.log freeze.log download_count.log;
do
echo " check $FSWIKI_HOME/log/$logfile..."
test -e "$FSWIKI_HOME"/log/$logfile || touch "$FSWIKI_HOME"/log/$logfile || exit 1
done
echo " check $FSWIKI_HOME/.htaccess..."
if test -e "$FSWIKI_HOME/.htaccess";
then
echo " already exists."
else
cat > "$FSWIKI_HOME/.htaccess" << HTACCESS
<FilesMatch "\.(pm|dat|wiki|log)$">
deny from all
</FilesMatch>
HTACCESS
echo " create."
fi
echo "done"