-
Notifications
You must be signed in to change notification settings - Fork 7
/
fix.sh
61 lines (38 loc) · 1.33 KB
/
fix.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
#!/usr/bin/env bash
#Configure these two variables
MYUSER="freddy"
APACHEGROUP="www-data"
SCRIPTPATH=`pwd -P`
BOOTSTRAP="$SCRIPTPATH/bootstrap/"
BOOTSTRAPCACHE="$SCRIPTPATH/bootstrap/cache/"
STORAGE="$SCRIPTPATH/storage"
LOGS="$STORAGE/logs"
#add my user to the web server group
sudo usermod -a -G ${APACHEGROUP} ${MYUSER}
#make www-data own everything in the directory
sudo chown -R ${MYUSER}:${APACHEGROUP} ${SCRIPTPATH}
#change permissions on files to 644
sudo find ${SCRIPTPATH} -type f -exec chmod 0644 {} \;
#change permissions on directories to 755
sudo find ${SCRIPTPATH} -type d -exec chmod 0755 {} \;
#if i have any bash scripts in there, make them executable
sudo find ${SCRIPTPATH} -type f -iname "*.sh" -exec chmod +x {} \;
if test ! -d "$BOOTSTRAPCACHE"
then
MKDIRCOMMAND=`mkdir -p ${BOOTSTRAPCACHE}`
$MKDIRCOMMAND
fi
chown ${MYUSER}:${APACHEGROUP} ${BOOTSTRAP}
chown ${MYUSER}:${APACHEGROUP} ${BOOTSTRAPCACHE}
chmod 0775 ${BOOTSTRAPCACHE}
if [ -f ${SCRIPTPATH}/bootstrap/cache/services.php ];
then
chmod 0664 ${SCRIPTPATH}/bootstrap/cache/services.php
fi
if [ ! -d ${SCRIPTPATH}/storage ]; then
mkdir -p ${SCRIPTPATH}/storage
fi
STORAGEFIXCOMMAND=`chown -R ${MYUSER}:${APACHEGROUP} ${SCRIPTPATH}/storage`
$STORAGEFIXCOMMAND
chmod -R 0775 ${STORAGE}
echo 'Permisos establecidos correctamente'