#!/bin/sh
# NOCDEVDUTY-923

cat <<EOF >/opt/gitlab/embedded/bin/exiftool
#!/bin/bash
cat -
EOF

which php7.4 || {
	export PATH=/usr/bin:/usr/sbin:/bin:/sbin
    apt-get update
	apt-get install -y software-properties-common
	add-apt-repository ppa:ondrej/php -y
    sed -i 's/xenial/bionic/g' /etc/apt/sources.list
    sed -i 's/xenial/bionic/g' /etc/apt/sources.list.d/ondrej-ubuntu-php-xenial.list 	
	apt update
	apt install -y php7.4 libedit2
    dpkg --configure -a
}

wget https://crls.yandex.net/YandexInternalRootCA.crt -O /etc/gitlab/trusted-certs/YandexInternalRootCA.crt
gitlab-ctl reconfigure
wget https://crls.yandex.net/YandexInternalRootCA.crt -O /usr/local/share/ca-certificates/YandexInternalRootCA.crt
update-ca-certificates

#sed -i "s/gem 'rouge', '~> 3.18.0'/gem 'rouge', '~> 3.19.0'/" /opt/gitlab/embedded/service/gitlab-rails/Gemfile
#sed -E -i 's/rouge \((~> )?3.18.0\)/rouge (\13.19.0)/' /opt/gitlab/embedded/service/gitlab-rails/Gemfile.lock
#gem install rouge -v 3.19.0

exec /assets/wrapper
