2018-04-03 02:58:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-08-14 03:26:07 +00:00
|
|
|
set -e
|
2018-04-03 02:58:14 +00:00
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
if [[ $SEAFILE_BOOTSRAP != "" ]]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-06-25 11:05:09 +00:00
|
|
|
if [[ $TIME_ZONE != "" ]]; then
|
|
|
|
time_zone=/usr/share/zoneinfo/$TIME_ZONE
|
|
|
|
if [[ ! -e $time_zone ]]; then
|
|
|
|
echo "invalid time zone"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
ln -snf $time_zone /etc/localtime
|
|
|
|
echo "$TIME_ZONE" > /etc/timezone
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-04-03 02:58:14 +00:00
|
|
|
dirs=(
|
|
|
|
conf
|
|
|
|
ccnet
|
|
|
|
seafile-data
|
|
|
|
seahub-data
|
|
|
|
pro-data
|
|
|
|
seafile-license.txt
|
|
|
|
)
|
|
|
|
|
|
|
|
for d in ${dirs[*]}; do
|
|
|
|
src=/shared/seafile/$d
|
|
|
|
if [[ -e $src ]]; then
|
|
|
|
rm -rf /opt/seafile/$d && ln -sf $src /opt/seafile
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ! -e /shared/logs/seafile ]]; then
|
|
|
|
mkdir -p /shared/logs/seafile
|
|
|
|
fi
|
|
|
|
rm -rf /opt/seafile/logs && ln -sf /shared/logs/seafile/ /opt/seafile/logs
|
|
|
|
|
|
|
|
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
|