From e08a49eb8946cad54f34d0299303b28392831c26 Mon Sep 17 00:00:00 2001 From: Chip Black Date: Sat, 29 Mar 2014 04:18:34 -0500 Subject: [PATCH 1/1] Add install routine (of sorts) --- Makefile | 43 +++++++++++++++++++++++++++- scripts/write-environment-configs.pl | 39 +++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 scripts/write-environment-configs.pl diff --git a/Makefile b/Makefile index 94a17d8..1346294 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ clean: @-make -C builddeps/scrypt-1.1.6/lib/crypto clean @-make -C lib/perl/Blerg-Database clean -.phony: perl-lib +.PHONY: perl-lib perl-lib: cd lib/perl/Blerg-Database && perl Makefile.PL make -C lib/perl/Blerg-Database @@ -70,3 +70,44 @@ builddeps/scrypt-1.1.6/config.h: builddeps/scrypt.a: builddeps/scrypt-1.1.6/config.h make -C builddeps/scrypt-1.1.6/lib/crypto CFLAGS="$(CFLAGS)" cp builddeps/scrypt-1.1.6/lib/crypto/scrypt.a builddeps/ + +.PHONY: install +install: + @echo "Please use 'make install-environment' to install Blërg to an environment" + +.PHONY: install-environment +install-environment: all + @if [ -z "$(ENV_DIR)" ]; then \ + echo "Specify the install directory in the ENV_DIR variable"; \ + exit 1; \ + fi + install --mode 755 -d \ + $(ENV_DIR)/bin \ + $(ENV_DIR)/lib/cgi-bin \ + $(ENV_DIR)/etc \ + $(ENV_DIR)/data/data \ + $(ENV_DIR)/data/hash_tags \ + $(ENV_DIR)/data/ref_tags \ + $(ENV_DIR)/www/build \ + $(ENV_DIR)/www/css \ + $(ENV_DIR)/www/doc \ + $(ENV_DIR)/www/images + install --mode 755 blerg.cgi rss.cgi $(ENV_DIR)/lib/cgi-bin/ + install --mode 755 blergtool blerglatest $(ENV_DIR)/bin/ + install --mode 644 www/favicon.gif www/favicon.ico www/index.html \ + www/welcome.html \ + $(ENV_DIR)/www/ + install --mode 644 www/build/enyo-blerg.js www/build/enyo-blerg.css \ + $(ENV_DIR)/www/build/ + install --mode 644 www/css/blerg.css www/css/doc.css \ + $(ENV_DIR)/www/css/ + install --mode 644 www/doc/changelog.html www/doc/index.html \ + www/doc/post_help.html www/doc/privacy_data.html \ + $(ENV_DIR)/www/doc/ + install --mode 644 www/images/blerglogo.png www/images/corner.svg \ + www/images/play.png www/images/rss.png \ + $(ENV_DIR)/www/images/ + www/jssrc/lib/onyx/deploy.sh $(ENV_DIR)/www/jssrc/lib/onyx + cd lib/perl/Blerg-Database && perl Makefile.PL INSTALL_BASE="$(ENV_DIR)" + make -C lib/perl/Blerg-Database install + perl scripts/write-environment-configs.pl $(ENV_DIR) diff --git a/scripts/write-environment-configs.pl b/scripts/write-environment-configs.pl new file mode 100644 index 0000000..1be7645 --- /dev/null +++ b/scripts/write-environment-configs.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl +use Cwd qw/abs_path/; +use strict; + +my $ENV_DIR = shift; +if (!defined $ENV_DIR) { + die "Please specify an environment directory to write configs into\n"; +} +$ENV_DIR = abs_path($ENV_DIR); + +# Shell +open C, '>', "$ENV_DIR/etc/env.sh"; +print C <', "$ENV_DIR/etc/nginx-fastcgi-vars.conf"; +print C <