-
Notifications
You must be signed in to change notification settings - Fork 21
/
secure.sh
54 lines (49 loc) · 1.33 KB
/
secure.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
#!/bin/sh
SUCCESS="printf \033[1;32m"
FAILURE="printf \033[1;31m"
WARNING="printf \033[1;33m"
MESSAGE="printf \033[1;34m"
NORMAL="printf \033[0;39m"
MAGENTA="printf \033[1;35m"
$WARNING
echo
echo "+-------------------------------------+"
echo "| MoniWiki configuration script |"
echo "+-------------------------------------+"
echo
$NORMAL
if [ -f config.php ]; then
chmod 644 config.php
if [ $? -ne 0 ]; then
$MESSAGE
mv config.php config.php.$$
cp config.php.$$ config.php
rm -f config.php.$$
chmod 644 config.php
fi
chmod 711 . data
echo "*** chmod 644 config.php"
$NORMAL
fi
IMG_DIR=`cat config.php |grep '^$imgs_dir='|cut -d\' -f2`
[ -n "$IMG_DIR" ] && [ -f imgs_htaccess ] && [ ! -f .$IMG_DIR/.htaccess ] &&
cp imgs_htaccess .$IMG_DIR/.htaccess && rm imgs_htaccess
PDS_DIR=`cat config.php |grep '^$upload_dir='|cut -d\' -f2`
[ -n "$PDS_DIR" ] && [ -f pds_htaccess ] && [ ! -f $PDS_DIR/.htaccess ] &&
cp pds_htaccess $PDS_DIR/.htaccess && rm pds_htaccess
$SUCCESS
echo ""
echo "Your MoniWiki is now secure and cannot be configured."
echo "If you want to config your wiki again, execute the following command:"
echo ""
echo -n " "
$MESSAGE
echo -n "$ "
$NORMAL
echo sh monisetup.sh
$SUCCESS
echo ""
echo "and open 'monisetup.php' on your web browser."
echo ""
echo ""
$NORMAL