2016-11-11 04:54:47 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-04-12 09:12:43 +00:00
|
|
|
set -e
|
2016-11-11 04:54:47 +00:00
|
|
|
set -o pipefail
|
|
|
|
|
2016-11-11 04:56:47 +00:00
|
|
|
if [[ $SEAFILE_BOOTSRAP != "" ]]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-11-11 04:54:47 +00:00
|
|
|
dirs=(
|
|
|
|
conf
|
|
|
|
ccnet
|
|
|
|
seafile-data
|
|
|
|
seahub-data
|
2018-04-12 09:12:43 +00:00
|
|
|
bootstrap.conf
|
2016-11-11 04:54:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
for d in ${dirs[*]}; do
|
2016-11-12 06:03:52 +00:00
|
|
|
src=/shared/seafile/$d
|
2016-11-11 04:54:47 +00:00
|
|
|
if [[ -e $src ]]; then
|
2018-04-12 09:12:43 +00:00
|
|
|
ln -sf $src /opt/seafile
|
2016-11-11 04:54:47 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-04-12 09:12:43 +00:00
|
|
|
if [[ ! -e /shared/logs/seafile ]]; then
|
|
|
|
mkdir -p /shared/logs/seafile
|
|
|
|
fi
|
2016-11-12 06:03:52 +00:00
|
|
|
if [[ -e /shared/logs/seafile ]]; then
|
2018-04-12 09:12:43 +00:00
|
|
|
rm /opt/seafile/logs && ln -sf /shared/logs/seafile/ /opt/seafile/logs
|
2016-11-12 06:03:52 +00:00
|
|
|
fi
|
2016-11-11 04:54:47 +00:00
|
|
|
|
2016-11-28 07:06:23 +00:00
|
|
|
current_version_dir=/opt/seafile/seafile-server-${SEAFILE_VERSION}
|
|
|
|
latest_version_dir=/opt/seafile/seafile-server-latest
|
|
|
|
seahub_data_dir=/shared/seafile/seahub-data
|
|
|
|
|
2018-04-12 09:12:43 +00:00
|
|
|
if [[ ! -e ${seahub_data_dir} ]]; then
|
|
|
|
mkdir -p ${seahub_data_dir}
|
2016-11-14 06:47:40 +00:00
|
|
|
fi
|
2016-11-28 07:06:23 +00:00
|
|
|
source_avatars_dir=${current_version_dir}/seahub/media/avatars
|
2018-04-12 09:12:43 +00:00
|
|
|
if [[ ! -e ${seahub_data_dir}/avatars ]]; then
|
|
|
|
mv $source_avatars_dir ${seahub_data_dir}/avatars
|
|
|
|
fi
|
|
|
|
rm -rf $source_avatars_dir && ln -sf ${seahub_data_dir}/avatars $source_avatars_dir
|
2016-11-25 08:27:35 +00:00
|
|
|
|
2016-11-28 07:06:23 +00:00
|
|
|
source_custom_dir=${current_version_dir}/seahub/media/custom
|
|
|
|
rm -rf $source_custom_dir
|
2018-04-12 09:12:43 +00:00
|
|
|
if [[ ! -e ${seahub_data_dir}/custom ]]; then
|
|
|
|
mkdir -p ${seahub_data_dir}/custom
|
|
|
|
fi
|
|
|
|
rm -rf $source_custom_dir && ln -sf ${seahub_data_dir}/custom $source_custom_dir
|
|
|
|
|
|
|
|
rm -rf /var/lib/mysql
|
|
|
|
if [[ ! -e /shared/db ]];then
|
|
|
|
mkdir -p /shared/db
|
|
|
|
fi
|
|
|
|
ln -sf /shared/db /var/lib/mysql
|
|
|
|
|
|
|
|
if [[ ! -e /shared/logs/var-log ]]; then
|
|
|
|
mv /var/log /shared/logs/var-log
|
|
|
|
fi
|
|
|
|
rm -rf /var/log && ln -sf /shared/logs/var-log /var/log
|