e91f7b060e
--- type: change message: |- make docker-remote not force a .git extension There wasn't really a good reason to do so, except convention maybe, but even then I'm not sure it was a real convention. This commit also fixes the docker image naming for docker-remote change_hash: AAdGtR83SalP03yPlU0FDNkzlDzgWFXs08vJ26KtB8du credentials: - type: pgp_signature pub_key_id: 95C46FA6A41148AC body: iQIzBAABAgAdFiEEJ6tQKp6olvZKJ0lwlcRvpqQRSKwFAl6BDAkACgkQlcRvpqQRSKwcsxAAtfvN8xNqWAXS48MVApoFPtK4GoUeoJsW+2KVWlaHYxwOtROaLoXBp+reNn9ESeetebQB8qPY44/xwmQuZ//CKt1iDvGqf470FW6bnm+LFNmpX5X49WUKs2KeTSXBeVYRtz8vZKPkQyfhlcUB2rHtVIWbqXPFXV4UtufqEnSu1LEgF+MORkNzOkoF35xRzp6pUlcmOc4Q1TUvK5+m3QXQpD9g3imA2fp49rmfVQ4E9OdtFAPxfhCWEdi2Zre8k9W2XFgCak/SX++9i1/7eyfC896RiCPD/cR/OvzXlCE8psuORAJ0MqcaJCYWz84KWVKH2sHqmkT0AYnrJRV+QXWWUS3ePZX/LzGBqgkxU8AuNiGXiDl5X9XVBRpCbYdwAjO0s4CoV6okH06euqlpvKhsLDKW6/TlIAqDVNg91Pqklu/oSd37faGCDfvDgsWvuypXe1VG+o2MXIdP5Z1Keis0tPKRyNCILa9aG8Jzue4Eaa3OnLCPnzT/MaXbTgAosLZf/IObyEGNhGnGZzUXXlwbwJNHQfeim1sILUEWCTU7/NrupSPOmjNzFcSQmvmLj4iBqnFikQez48uYl/ZL7jFYxbOxiPmXCNe+NX42TExT9P6wLkQs5kKzFbNKUgx5W5ou1ZQuqJ8CflS/eUBA+FEpb4nYdgPMKNwMPW/MD42Z1Uk= account: mediocregopher
95 lines
2.1 KiB
Bash
95 lines
2.1 KiB
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
QUIET=false
|
|
#SFLOG="/start.log"
|
|
|
|
#print timestamp
|
|
timestamp() {
|
|
date +"%Y-%m-%d %T"
|
|
}
|
|
|
|
#screen/file logger
|
|
sflog() {
|
|
#if $1 is not null
|
|
if [ ! -z ${1+x} ]; then
|
|
message=$1
|
|
else
|
|
#exit function
|
|
return 1;
|
|
fi
|
|
#if $QUIET is not true
|
|
if ! $($QUIET); then
|
|
echo "${message}"
|
|
fi
|
|
#if $SFLOG is not null
|
|
if [ ! -z ${SFLOG+x} ]; then
|
|
#if $2 is regular file or does not exist
|
|
if [ -f ${SFLOG} ] || [ ! -e ${SFLOG} ]; then
|
|
echo "$(timestamp) ${message}" >> ${SFLOG}
|
|
fi
|
|
fi
|
|
}
|
|
|
|
#start services function
|
|
startc() {
|
|
sflog "Services for container are being started..."
|
|
/etc/init.d/fcgiwrap start > /dev/null
|
|
/etc/init.d/nginx start > /dev/null
|
|
sflog "The container services have started..."
|
|
}
|
|
|
|
#stop services function
|
|
stopc() {
|
|
sflog "Services for container are being stopped..."
|
|
/etc/init.d/nginx stop > /dev/null
|
|
/etc/init.d/fcgiwrap stop > /dev/null
|
|
sflog "Services for container have successfully stopped. Exiting."
|
|
exit 0
|
|
}
|
|
|
|
#trap "docker stop <container>" and shuts services down cleanly
|
|
trap "(stopc)" TERM INT
|
|
|
|
#startup
|
|
|
|
#test for ENV varibale $FQDN
|
|
if [ ! -z ${FQDN+x} ]; then
|
|
sflog "FQDN is set to ${FQDN}"
|
|
else
|
|
export FQDN=dehub
|
|
sflog "FQDN is set to ${FQDN}"
|
|
fi
|
|
|
|
#modify config files with fqdn
|
|
sed -i "s,MYSERVER,${FQDN},g" /etc/nginx/nginx.conf &> /dev/null
|
|
|
|
# create the individual repo directories
|
|
while [ ! -z "$1" ]; do
|
|
dir="/repos/$1";
|
|
if [ ! -d "$dir" ]; then
|
|
echo "Initializing repo $1"
|
|
mkdir "$dir"
|
|
git init --bare "$dir"
|
|
git config -f "$dir/config" http.receivepack true
|
|
git config -f "$dir/config" receive.denyNonFastForwards true
|
|
git symbolic-ref HEAD refs/heads/main
|
|
chown -R git:git "$dir"
|
|
fi
|
|
|
|
mkdir -p "$dir/hooks"
|
|
cp /pre-receive "$dir/hooks/"
|
|
chmod +x "$dir/hooks/pre-receive"
|
|
|
|
shift
|
|
done
|
|
|
|
#start init.d services
|
|
startc
|
|
|
|
#pause script to keep container running...
|
|
sflog "Services for container successfully started."
|
|
sflog "Dumping logs"
|
|
tail -f /var/log/nginx/*.log
|