<commit_before>#
# Apache turbo.me file
# https://github.com/turboapps/turbome/tree/master/apache
#
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0

###################################
# Meta tags
###################################

meta title="apache"
meta name="apache"
meta namespace="apache"

###################################
# Pull dependency images
###################################

layer microsoft/vcredist:2012
using gnu/wget,7-zip/7-zip,python/python:3.4.1,gnu/sed


###################################
# Image settings
###################################

var port = "8080"
var email = "<EMAIL>@<EMAIL>"
var intalldir = "C:\\apache\\apache2"

###################################
# Download and install
###################################

cmd pip install requests --quiet

# Set working directory
cmd mkdir c:\Workspace
workdir c:\Workspace

batch
  echo import requests >> getVersion.py
  echo import re >> getVersion.py
  echo host = 'https://www.apachehaus.com/cgi-bin/download.plx' >> getVersion.py
  echo headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0'} >> getVersion.py
  echo r = requests.get(host , headers=headers, timeout=10) >> getVersion.py
  echo print(re.findall('httpd-(.*x86-vc11.*)\.zip', r.text )[0]) >> getVersion.py

cmd python getVersion.py
var version = last

var url = "http://www.apachehaus.com/downloads/httpd-" + version  + ".zip"

cmd "python -c ""print('%version%'.split('-')[0])"""

var tag = last


# Download
cmd "wget --no-check-certificate --no-verbose -O httpd.zip %url%"

cmd 7z x httpd.zip
cmd mkdir c:\apache
cmd move apache* c:\apache\apache2
workdir c:\apache\apache2

batch
  sed -i "s|^Listen 80|Listen 8080|" conf\httpd.conf
  sed -i "s|\("^ServerAdmin\s" * *\).*|\1admin@localhost|" conf\httpd.conf
  sed -i "s|\("^ServerName" *\)|#\1|" conf\httpd.conf
  sed -i "s|/Apache24|C:\\apache\\apache2|" conf\httpd.conf

batch
  bin\httpd.exe -k install > nul
  echo 1

###################################
# Environment Variables
###################################

env path="C:\apache\apache2\bin"

###################################
# Clean up
###################################

workdir c:\

cmd rmdir c:\Workspace /s /q
cmd rmdir c:\wget /s /q
cmd rmdir c:\python34 /s /q

###################################
# Version
###################################

meta tag=tag 
meta version=tag 

###################################
# Startup File
###################################

setworkdir C:\apache\apache2
# No startup files needed<commit_msg>CI-171 - fix apache script<commit_after>#
# Apache turbo.me file
# https://github.com/turboapps/turbome/tree/master/apache
#
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0

requires privilege:admin

###################################
# Meta tags
###################################

meta title="apache"
meta name="apache"
meta namespace="apache"

###################################
# Pull dependency images
###################################

layer microsoft/vcredist:2012
using gnu/wget,7-zip/7-zip,python/python:3.4.1,gnu/sed


###################################
# Image settings
###################################

var port = "8080"
var email = "admin@localhost"
var intalldir = "C:\\apache\\apache2"

###################################
# Download and install
###################################

cmd pip install requests --quiet

# Set working directory
cmd mkdir c:\Workspace
workdir c:\Workspace

batch
  echo import requests >> getVersion.py
  echo import re >> getVersion.py
  echo host = 'https://www.apachehaus.com/cgi-bin/download.plx' >> getVersion.py
  echo headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0'} >> getVersion.py
  echo r = requests.get(host , headers=headers, timeout=10) >> getVersion.py
  echo print(re.findall('httpd-(.*x86-vc11.*)\.zip', r.text )[0]) >> getVersion.py

cmd python getVersion.py
var version = last

var url = "http://www.apachehaus.com/downloads/httpd-" + version  + ".zip"

cmd "python -c ""print('%version%'.split('-')[0])"""

var tag = last


# Download
cmd "wget --no-check-certificate --no-verbose -O httpd.zip %url%"

cmd mkdir c:\apache
cmd 7z x httpd.zip -oc:\apache
cmd dir /b c:\apache | findstr A
var outputDir = last

workdir "c:\apache\Apache24"
batch
  sed -i "s|^Listen 80|Listen 8080|" conf\httpd.conf
  sed -i "s|\("^ServerAdmin\s" * *\).*|\1admin@localhost|" conf\httpd.conf
  sed -i "s|\("^ServerName" *\)|#\1|" conf\httpd.conf
  sed -i "s|/Apache24|C:\\apache\\Apache24|" conf\httpd.conf

batch
  bin\httpd.exe -k install > nul
  echo 1

###################################
# Environment Variables
###################################

env path="C:\apache\Apache24\bin"

###################################
# Clean up
###################################

workdir c:\

cmd rmdir c:\Workspace /s /q
cmd rmdir c:\wget /s /q
cmd rmdir c:\python34 /s /q

###################################
# Version
###################################

meta tag=tag 
meta version=tag 

###################################
# Startup File
###################################

setworkdir "C:\apache\Apache24"
# No startup files needed
{'fraction_non_alphanumeric': 0.3365530303030303, 'fraction_numerical': 0.025757575757575757, 'mean_word_length': 4.907158836689038, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3897296', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1637, 'n_words': 398}