summaryrefslogtreecommitdiff
path: root/docker/cgit/docker-entrypoint.sh
blob: 6d632c0583007146bfa15c45e28cae269ede709b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash


if [ "${1}" = "init" ]; then
  # setup apache
  sed -i "s/ScriptAlias \/cgit\//ScriptAlias \//" /etc/apache2/conf-enabled/cgit.conf
  sed -i "/RedirectMatch/d" /etc/apache2/conf-enabled/cgit.conf
  ex -s -c $(grep -n "^Alias" /etc/apache2/conf-enabled/cgit.conf | cut -d ":" -f 1)m0 -c w -c q /etc/apache2/conf-enabled/cgit.conf
  sed -i "s/\/usr\/share\/cgit/\/usr\/share\/cgit-docker/" /etc/apache2/conf-enabled/cgit.conf

  service apache2 start

  # populate assets
  if [ ! $(ls -A /usr/share/cgit-docker) ]; then
    cp /usr/share/cgit/* /usr/share/cgit-docker/
  fi

  # run complex init
  /docker-init.py

  # loop
  tail -f /dev/null
else
  exec "$@"
fi