2023-09-18 17:13:15 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-10-13 17:33:18 +08:00
|
|
|
set -e
|
2023-10-13 16:27:02 +08:00
|
|
|
|
2023-10-13 17:33:18 +08:00
|
|
|
try_times=3
|
2023-10-19 10:44:31 +08:00
|
|
|
|
|
|
|
# start by supervisord
|
|
|
|
/usr/bin/supervisord
|
|
|
|
# debug
|
|
|
|
supervisorctl start apphub
|
|
|
|
|
2023-10-13 17:33:18 +08:00
|
|
|
# set git user and email
|
|
|
|
for ((i=0; i<$try_times; i++)); do
|
2023-10-16 09:30:55 +08:00
|
|
|
set +e
|
|
|
|
username=$(apphub getconfig --section gitea --key user_name)
|
|
|
|
email=$(apphub getconfig --section gitea --key email)
|
|
|
|
set -e
|
2023-10-13 17:33:18 +08:00
|
|
|
if [ -n "$username" ] && [ -n "$email" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
echo "Command failed, retrying..."
|
|
|
|
sleep 3
|
|
|
|
done
|
2023-10-13 16:27:02 +08:00
|
|
|
|
2023-10-13 17:33:18 +08:00
|
|
|
echo $username
|
|
|
|
echo $email
|
2023-10-13 16:27:02 +08:00
|
|
|
|
2023-10-13 17:33:18 +08:00
|
|
|
if [[ -n "$username" ]]; then
|
|
|
|
git config --global user.name "$username"
|
2023-10-13 16:27:02 +08:00
|
|
|
else
|
2023-10-13 17:33:18 +08:00
|
|
|
echo "username is null"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
regex="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
|
|
|
|
if [[ $email =~ $regex ]]; then
|
|
|
|
git config --global user.email "$email"
|
|
|
|
else
|
|
|
|
echo "Not have correct email"
|
|
|
|
exit 1
|
2023-10-13 16:27:02 +08:00
|
|
|
fi
|
|
|
|
|
2023-09-19 14:32:20 +08:00
|
|
|
tail -f /dev/null
|