-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize
executable file
·70 lines (57 loc) · 1.9 KB
/
customize
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
#!/usr/bin/bash
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Exit if any command fail
set -o errexit
NEXTCLOUD_VERSION="29.0.7"
DESTDIR="/var/www/htdocs/nextcloud"
echo "* Remove unused httpd config files"
HTTPD_CONF_RM="httpd-autoindex.conf
httpd-dav.conf
httpd-default.conf
httpd-info.conf
httpd-languages.conf
httpd-manual.conf
httpd-mpm.conf
httpd-multilang-errordoc.conf
httpd-ssl.conf
httpd-userdir.conf
httpd-vhosts.conf"
for CONF_RM in ${HTTPD_CONF_RM}; do
rm -f /opt/local/etc/httpd/${CONF_RM}
done
/opt/local/bin/install_nc_version "${NEXTCLOUD_VERSION}"
echo "* Change www for cronjobs"
usermod -d "$DESTDIR" -s /usr/bin/bash www
# Configuring image specific packages
echo "* Configuring image specific packages.";
mkdir -p /var/log/httpd/old
mkdir -p /opt/local/etc/httpd/ssl || true
chmod 0640 /opt/local/etc/httpd/ssl
ln -nfs /opt/local/etc/httpd/ssl /opt/local/etc/httpd/tls
echo "* Disable ssh access"
svcadm disable svc:/network/ssh:default || true
echo "* Add commands to bash-history";
cat >> /root/.bash_history << EOF
sudo -u www php /var/www/htdocs/nextcloud/current/occ upgrade
sudo -u www php /var/www/htdocs/nextcloud/current/occ maintenance:mode --off
sudo -u www php /var/www/htdocs/nextcloud/current/occ config:system:set appstoreenabled --type boolean --value false
sudo -u www php /var/www/htdocs/nextcloud/current/occ db:add-missing-indices
sudo -u www php /var/www/htdocs/nextcloud/current/occ db:add-missing-columns
su - www
tail -f /data/shared/data/nextcloud.log
tail -f /var/log/redis/redis.log
tail -f /var/log/php-fpm.log
tail -f /var/log/nginx/*.log
svcadm restart php-fpm ; svcadm restart nginx
svcadm restart php-fpm
svcadm restart nginx
svcs -vx
EOF
chmod 0600 /root/.bash_history
# echo "* Enable ipfilter"
# svcadm enable svc:/network/ipfilter:default
# Clean up
echo "* Cleaning up."
rm /root/customize
# Prepare image for provisioning
sm-prepare-image -y