This repository was archived by the owner on May 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup
More file actions
executable file
·57 lines (49 loc) · 2.2 KB
/
setup
File metadata and controls
executable file
·57 lines (49 loc) · 2.2 KB
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
#!/usr/bin/env bash
printf "\n* * * * * \n\nStarting setup. Your sudo password will be required.\n\n* * * * *\n\n"
# REQUIRED
printf "\nPreparing directory for install...\n"
sudo chmod -R 777 .
# REQUIRED
printf "\nInstalling global Composer dependencies...\n"
composer global require "fxp/composer-asset-plugin:^1.1"
printf "\nInstalling this package's Composer dependencies...\n"
composer install -o --prefer-dist
# REQUIRED
if [ ! -f config.xml ]; then
printf "\nPreparing configuration file `config.xml`...\n"
cp config.example.xml config.xml
fi
# OPTIONAL (but a good idea)
APACHE_USER=${1:-"www-data"}
APACHE_GROUP=${2:-$APACHE_USER}
printf "\nTransfering ownership to $APACHE_USER:$APACHE_GROUP as the Apache user:group.\n"
sudo chown -R $APACHE_USER:$APACHE_GROUP .
# OPTIONAL (but a good idea)
printf "\nSetting secure file permissions...\n"
sudo find . -type d -exec chmod 550 {} +
sudo find . -type f -exec chmod 440 {} +
sudo chmod 750 setup
sudo find .git -type d -exec chmod 750 {} +
sudo find .git -type f -exec chmod 640 {} +
# REQUIRED (may require MORE if ownershop was not transferred to Apache)
printf "Setting file permissions to allow Smarty caching...\n"
sudo chmod 750 vendor/battis/bootstrapsmarty/templates_c
sudo find vendor/battis/bootstrapsmarty/templates_c/*.php -type f -exec chmod 640 {} +
sudo chmod 750 vendor/battis/bootstrapsmarty/cache
sudo find vendor/battis/bootstrapsmarty/cache/*.php -type f -exec chmod 640 {} +
printf "Setting file permissions to allow logging...\n"
sudo chmod 750 logs
sudo find logs/*.log -type f -exec chmod 640 {} +
# Honor SELinux, if present
if type sestatus &>/dev/null ; then
SELINUX_ENABLED=$(sestatus | grep -oP "(?<=^Current mode:).*")
if [ $SELINUX_ENABLED == "enabled" ]; then
printf "Updating SELinux context for Smarty cache directories\n"
sudo chcon -R -t httpd_sys_rw_content_t vendor/battis/bootstrapsmarty/templates_c
sudo chcon -R -t httpd_sys_rw_content_t vendor/battis/bootstrapsmarty/cache
printf "Updating SELinux context for logging\n"
sudo chcon -R -t httpd_sys_rw_content_t logs
fi
fi
printf "\nDirectory configured.\n"
printf "\nPoint your web browser at this directory to complete installation.\n\n"