mirror of
https://github.com/linuxserver/docker-projectsend.git
synced 2026-02-20 08:39:17 +08:00
72 lines
1.9 KiB
Plaintext
72 lines
1.9 KiB
Plaintext
#!/usr/bin/with-contenv bash
|
||
|
||
# set default values for variables
|
||
PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-512M}
|
||
MAX_UPLOAD=${MAX_UPLOAD:-5000}
|
||
PHP_MAX_FILE_UPLOAD=${PHP_MAX_FILE_UPLOAD:-200}
|
||
USABLE_MAX_UPLOAD=${MAX_UPLOAD//[!0-9]/}
|
||
|
||
# create our folders
|
||
mkdir -p \
|
||
/config/projectsend/images \
|
||
/data/projectsend \
|
||
/var/run/apache2
|
||
|
||
# configure php
|
||
sed -i \
|
||
-e "s#;*memory_limit =.*#memory_limit = ${PHP_MEMORY_LIMIT}#i" \
|
||
-e "s#;*upload_max_filesize =.*#upload_max_filesize = ${USABLE_MAX_UPLOAD}M#i" \
|
||
-e "s#;*max_file_uploads =.*#max_file_uploads = ${PHP_MAX_FILE_UPLOAD}#i" \
|
||
-e "s#;*post_max_size =.*#post_max_size = ${USABLE_MAX_UPLOAD}M#i" \
|
||
-e "s#;*cgi.fix_pathinfo=.*#cgi.fix_pathinfo= 0#i" \
|
||
/etc/php7/php.ini
|
||
|
||
# copy config
|
||
PREV_DIR=$(pwd)
|
||
|
||
cd /defaults/upload || exit
|
||
shopt -s globstar nullglob
|
||
shopt -s dotglob
|
||
for i in *
|
||
do
|
||
if [ ! -e "/data/projectsend/${i}" ] ; then
|
||
cp -R "${i}" "/data/projectsend/${i}"
|
||
chown abc:abc "/data/projectsend/${i}"
|
||
fi
|
||
done
|
||
|
||
cd /defaults/custom || exit
|
||
for i in *
|
||
do
|
||
if [ ! -e "/config/projectsend/images/${i}" ] ; then
|
||
cp -R "${i}" "/config/projectsend/images/${i}"
|
||
chown abc:abc "/config/projectsend/images/${i}"
|
||
fi
|
||
done
|
||
shopt -u globstar nullglob
|
||
shopt -u dotglob
|
||
|
||
cd "${PREV_DIR}" || exit
|
||
|
||
# create symlinks
|
||
[[ ! -L /var/www/localhost/htdocs/upload ]] && \
|
||
ln -sf /data/projectsend /var/www/localhost/htdocs/upload
|
||
[[ ! -L /var/www/localhost/htdocs/img/custom ]] && \
|
||
ln -sf /config/projectsend/images /var/www/localhost/htdocs/img/custom
|
||
|
||
[[ -f /var/www/localhost/htdocs/includes/sys.config.php ]] && \
|
||
rm /var/www/localhost/htdocs/includes/sys.config.php
|
||
[[ ! -L /var/www/localhost/htdocs/includes/sys.config.php ]] && \
|
||
ln -sf /config/projectsend/sys.config.php \
|
||
/var/www/localhost/htdocs/includes/sys.config.php
|
||
|
||
# permissions
|
||
chown abc:abc \
|
||
/data \
|
||
/data/projectsend
|
||
|
||
chown -R abc:abc \
|
||
/config \
|
||
/var/run/apache2 \
|
||
/var/www/localhost/htdocs
|