<commit_before>
DESTDIR ?= /usr

.PHONY = default install cleandb abac gcf
.PHONY: syncm syncd synci syncs syncp

RSYNC = /usr/bin/rsync
PSQL = /usr/bin/psql
INSTALL = /usr/bin/install
INSTALL.WWW = /usr/bin/install -o www-data -g www-data
DB.USER = portal
DB.HOST = localhost
DB.DB = portal
CLEANDB.SQL = db/postgresql/schema.sql db/postgresql/data.sql
LIB.DIR = $(DESTDIR)/share/geni-ch/portal
CA.DIR = $(DESTDIR)/share/geni-ch/CA
ABAC.DIR = $(LIB.DIR)/abac
GCF.D = $(LIB.DIR)/gcf.d
GCF.DIR = $(LIB.DIR)/gcf
FQDN = $(shell /bin/hostname -f)
SHORT_HOST = $(shell /bin/hostname -s)
SED = /bin/sed

default:
	echo "try make install"

www:
	echo "No www directory present. Exiting."
	/bin/false

/var/www/secure:
	sudo /bin/mkdir /var/www/secure

/var/www/images:
	sudo /bin/mkdir /var/www/images

$(LIB.DIR):
	$(INSTALL.WWW) -d $(LIB.DIR)

$(GCF.D):
	$(INSTALL.WWW) -d $(GCF.D)

# Perform some replacements when install gcf.ini
$(GCF.D)/gcf.ini: gcf.d/gcf.ini
	$(SED) -e 's/localhost/$(FQDN)/g' < $^ \
	  | $(SED) -e 's/base_name=.*/base_name=$(SHORT_HOST)/' > $@
	chown www-data.www-data $@
	chmod 0644 $@

$(GCF.D)/omni.ini: gcf.d/omni.ini
	$(INSTALL.WWW) -m 644 $^ $@

$(GCF.D)/trusted_roots:
	$(INSTALL.WWW) -d $@

$(GCF.D)/trusted_roots/cacert.pem:
	/bin/ln -s $(CA.DIR)/cacert.pem $@

$(GCF.DIR)/src/gcf-pgch.py: gcf.d/src/gcf-pgch.py
	$(INSTALL.WWW) $^ $@

$(GCF.DIR)/src/geni/pgch.py: gcf.d/src/geni/pgch.py
	$(INSTALL.WWW) -m 644 $^ $@

GCF_DEPS = 	$(GCF.D) \
		$(GCF.D)/gcf.ini \
		$(GCF.D)/omni.ini \
		$(GCF.D)/trusted_roots \
		$(GCF.D)/trusted_roots/cacert.pem \
		$(GCF.DIR)/src/gcf-pgch.py \
		$(GCF.DIR)/src/geni/pgch.py

install-gcf: $(GCF_DEPS)


install: $(LIB.DIR) www
	sudo /bin/cp www/portal/* /var/www/secure
	sudo /bin/cp www/images/* /var/www/images
	sudo /bin/cp -r www/common /var/www/
	sudo /bin/cp www/index.php /var/www/index.php
	sudo $(INSTALL.WWW) -m 755 -d /var/www/policy
	sudo $(INSTALL.WWW) -m 644 www/policy/* /var/www/policy
	sudo $(INSTALL.WWW) -m 644 apache2-http.conf $(LIB.DIR)
	@echo
	@echo "*** Remember to check www/portal/settings.php! ***"
	@echo

cleandb:
	cat $(CLEANDB.SQL) | $(PSQL) -U $(DB.USER) -h $(DB.HOST) $(DB.DB)

syncm syncd synci syncs syncp:
	(cd .. && $(MAKE) $@)
<commit_msg>install-gcf is part of install in portal make<commit_after>
DESTDIR ?= /usr

.PHONY = default install cleandb abac gcf
.PHONY: syncm syncd synci syncs syncp

RSYNC = /usr/bin/rsync
PSQL = /usr/bin/psql
INSTALL = /usr/bin/install
INSTALL.WWW = /usr/bin/install -o www-data -g www-data
DB.USER = portal
DB.HOST = localhost
DB.DB = portal
CLEANDB.SQL = db/postgresql/schema.sql db/postgresql/data.sql
LIB.DIR = $(DESTDIR)/share/geni-ch/portal
CA.DIR = $(DESTDIR)/share/geni-ch/CA
ABAC.DIR = $(LIB.DIR)/abac
GCF.D = $(LIB.DIR)/gcf.d
GCF.DIR = $(LIB.DIR)/gcf
FQDN = $(shell /bin/hostname -f)
SHORT_HOST = $(shell /bin/hostname -s)
SED = /bin/sed

default:
	echo "try make install"

www:
	echo "No www directory present. Exiting."
	/bin/false

/var/www/secure:
	sudo /bin/mkdir /var/www/secure

/var/www/images:
	sudo /bin/mkdir /var/www/images

$(LIB.DIR):
	$(INSTALL.WWW) -d $(LIB.DIR)

$(GCF.D):
	$(INSTALL.WWW) -d $(GCF.D)

# Perform some replacements when install gcf.ini
$(GCF.D)/gcf.ini: gcf.d/gcf.ini
	$(SED) -e 's/localhost/$(FQDN)/g' < $^ \
	  | $(SED) -e 's/base_name=.*/base_name=$(SHORT_HOST)/' > $@
	chown www-data.www-data $@
	chmod 0644 $@

$(GCF.D)/omni.ini: gcf.d/omni.ini
	$(INSTALL.WWW) -m 644 $^ $@

$(GCF.D)/trusted_roots:
	$(INSTALL.WWW) -d $@

$(GCF.D)/trusted_roots/cacert.pem:
	/bin/ln -s $(CA.DIR)/cacert.pem $@

$(GCF.DIR)/src/gcf-pgch.py: gcf.d/src/gcf-pgch.py
	$(INSTALL.WWW) $^ $@

$(GCF.DIR)/src/geni/pgch.py: gcf.d/src/geni/pgch.py
	$(INSTALL.WWW) -m 644 $^ $@

GCF_DEPS = 	$(GCF.D) \
		$(GCF.D)/gcf.ini \
		$(GCF.D)/omni.ini \
		$(GCF.D)/trusted_roots \
		$(GCF.D)/trusted_roots/cacert.pem \
		$(GCF.DIR)/src/gcf-pgch.py \
		$(GCF.DIR)/src/geni/pgch.py

install-gcf: $(GCF_DEPS)


install: $(LIB.DIR) www install-gcf
	sudo /bin/cp www/portal/* /var/www/secure
	sudo /bin/cp www/images/* /var/www/images
	sudo /bin/cp -r www/common /var/www/
	sudo /bin/cp www/index.php /var/www/index.php
	sudo $(INSTALL.WWW) -m 755 -d /var/www/policy
	sudo $(INSTALL.WWW) -m 644 www/policy/* /var/www/policy
	sudo $(INSTALL.WWW) -m 644 apache2-http.conf $(LIB.DIR)
	@echo
	@echo "*** Remember to check www/portal/settings.php! ***"
	@echo

cleandb:
	cat $(CLEANDB.SQL) | $(PSQL) -U $(DB.USER) -h $(DB.HOST) $(DB.DB)

syncm syncd synci syncs syncp:
	(cd .. && $(MAKE) $@)

{'fraction_non_alphanumeric': 0.21362229102167182, 'fraction_numerical': 0.008845643520566122, 'mean_word_length': 3.1080835603996366, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 45, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6765323', 'n_tokens_mistral': 2225, 'n_tokens_neox': 2108, 'n_words': 396}