-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathinstaller-contrib-drupal-latest-ubuntu24.04-offisrc-apache2-mysql-8.0-php-8.3.conf
146 lines (116 loc) · 3.66 KB
/
installer-contrib-drupal-latest-ubuntu24.04-offisrc-apache2-mysql-8.0-php-8.3.conf
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
if [ -f "include/startup.sh" ]; then
. include/startup.sh
chmod -R u+x *
elif [ -f "../include/startup.sh" ]; then
. ../include/startup.sh
chmod -R u+x ../*
fi
web_path="/var/www/html"
img_root="include/Logos"
logo_img_name="drupal_logo.png"
icon_img_name="drupal_icon.png"
img_root_path="$img_root/$logo_img_name"
icon_img_root_path="$img_root/$icon_img_name"
local_html_path="include/index.html"
update_status="include/updateInstallStatus.sh"
html_path="/var/www/html/index.html"
prepare_installer() {
install_apache() {
echo "Installing apache2..." | log
apt update && apt install -y apache2
echo "Starting apache2 service..." | log
systemctl start apache2
APACHE_STATUS=$(systemctl status apache2 --no-pager)
printf "%s\n" "$APACHE_STATUS" | log
systemctl enable apache2
}
if [ ! -d $web_path ]; then
echo "Creating ${web_path}..." | log
mkdir -p "$web_path"
fi
if [ -f $html_path ]; then
echo "Removing old index.html file..." | log
rm -f "$html_path"
fi
confPath="/etc/apache2/sites-available"
if [ ! -d $confPath ]; then
echo "Creating ${confPath}" | log
mkdir -p "$confPath"
fi
install_apache
tag httpd.success
tag apache2.success
bash tweaks/apache-enable-ssl-light
echo "Writing apache configuration file..." | log
cat <<_EOF_ > /etc/apache2/sites-available/installProgress.conf
<VirtualHost *:80>
ServerName _
DocumentRoot $web_path
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName _
DocumentRoot $web_path
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>
_EOF_
echo "Copying web installer UX files..." | log
cp -r "$local_html_path" "$html_path"
cp -r "$img_root_path" "$web_path/$logo_img_name"
cp -r "$icon_img_root_path" "$web_path/$icon_img_name"
chmod 644 "$web_path/$logo_img_name"
chmod 644 "$web_path/$icon_img_name"
echo "Enabling apache2 SSL..." | log
a2enmod ssl
echo "Enabling apache2 installProgress configuration..." | log
a2ensite installProgress
echo "Disabling apache2 default configuration..." | log
a2dissite 000-default
echo "Restarting apache2 service..." | log
systemctl restart apache2
APACHE_STATUS=$(systemctl status apache2 --no-pager)
printf "%s\n" "$APACHE_STATUS" | log
}
prepare_installer
echo "Updating Web UI..." | log
"$update_status" "$html_path" -uf "$logo_img_name"
"$update_status" "$html_path" -ut "Drupal Installation"
"$update_status" "$html_path" -ui "$logo_img_name"
"$update_status" "$html_path" -uh "Drupal Installation"
"$update_status" "$html_path" -rp "Initializing setup..."
declare -a steps=(
"include/installInProgressSSH"
"apps/drupal-latest-offisrc-ubuntu24.04-apache2-mysqlserver-php8.3-fpm"
"tweaks/mysql-server-autoconfig"
"tweaks/motd-header-tweak"
"tweaks/motd-description-append"
"tweaks/cwm-description-autoconfig"
"include/installInProgressSSH-remove"
)
for run in "${steps[@]}"; do
printf "Executing %s\n" "$run" | log
if ! $run; then
script_exit_code=$?
printf "Exit Code: %d\n" "$script_exit_code" | log
case "$script_exit_code" in
0) printf "Done. (0)\n" | log ;;
1) printf "Error during %s. Exiting.\n" "$run" | log
return 1
;;
98) printf "Exit Code 98. Script already executed, can run only once. Continuing. (98)\n" | log ;;
99) printf "Exit Code 99. Continuing. (99)\n" | log ;;
127) printf "Error. %s not found. Exiting. (127)\n" "$run" | log
return 1
;;
*) printf "Exit Code not configured. Exiting. (%d)\n" "$script_exit_code" | log
return 1
;;
esac
fi
done
tag Script.success
exit 0