diff options
-rw-r--r-- | Makefile | 72 | ||||
-rwxr-xr-x | util/init.pl | 70 |
2 files changed, 72 insertions, 70 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..351a09bf --- /dev/null +++ b/Makefile @@ -0,0 +1,72 @@ +# all (default) +# Same as $ make staticdirs js skins www robots +# +# staticdirs +# Creates the required directory structures in static/ +# +# js +# Generates the Javascript code +# +# skins +# Generates the CSS code +# +# robots +# Ensures that www/robots.txt and static/robots.txt exist. Can be modified to +# suit your needs. +# +# chmod +# For when the http process is run from a different user than the files are +# chown'ed to. chmods all files and directories written to from vndb.pl. +# (including the stylesheets and javascript code, so these can be auto-updated) +# +# chmod-tladmin +# The TransAdmin plugin also needs write access to some files +# +# +# NOTE: This Makefile has only been tested using a recent version of GNU make +# in a relatively up-to-date Arch Linux environment, and may not work in other +# environments. Patches to improve the portability are always welcome. + + +.PHONY: all staticdirs js skins robots chmod chmod-tladmin + +all: staticdirs js skins robots + + +staticdirs: static/cv static/sf static/st + +static/cv static/sf static/st: + mkdir $@; + for i in $$(seq -w 0 1 99); do mkdir "$@/$$i"; done + + +js: static/f/script.js + +static/f/script.js: data/script.js data/lang.txt util/jsgen.pl + util/jsgen.pl + + +skins: static/s/*/style.css + +static/s/%/style.css: static/s/%/conf util/skingen.pl data/style.css + util/skingen.pl $* + + +www: + mkdir www + +robots: www www/robots.txt static/robots.txt + +%/robots.txt: + echo 'User-agent: *' > $@ + echo 'Disallow: /' >> $@ + + +chmod: all + chmod a-x+rw static/f/script.js + chmod -R a-x+rwX static/{cv,sf,st} + chmod a-x+rw static/s/*/{style.css,boxbg.png} + +chmod-tladmin: + chmod a-x+rwX data/lang.txt data/docs data/docs/*\.* + diff --git a/util/init.pl b/util/init.pl deleted file mode 100755 index ac533174..00000000 --- a/util/init.pl +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/perl - - -# This script should be run after you've somehow managed to fetch -# all the versioned files from the git repo. - - -print "Initializing the files and directories needed to run VNDB...\n"; - - -# determine our root directory -use Cwd 'abs_path'; -our $ROOT; -BEGIN { - ($ROOT = abs_path $0) =~ s{/util/init\.pl$}{}; -} - - -print " Using project root: $ROOT\n"; -print "\n"; - - - -print "Creating directory structures...\n"; -for my $d (qw| cv st sf |) { - print " /static/$d\n"; - mkdir "$ROOT/static/$d" or die "mkdir '$ROOT/static/$d': $!\n"; - for my $i (0..99) { - my $n = sprintf '%s/static/%s/%02d', $ROOT, $d, $i; - mkdir $n or die "mkdir '$n': $!\n"; - chmod 0777, $n or die "chmod 777 '$n': $!\n"; - } -} -print "\n"; - - -print "Creating /www\n"; -print " You can use this directory to store all files you want to\n"; -print " be available from the main domain. A favicon.ico for example.\n"; -mkdir "$ROOT/www" or die $!; -print "\n"; - - -print "Writing robots.txt in /static and /www\n"; -print " You probably don't want your personal copy of VNDB to end up\n"; -print " in the google results, so I'll install a default robots.txt\n"; -print " for you. You're free to modify them as you wish.\n"; -for ('static/robots.txt', 'www/robots.txt') { - print " $_ exists, skipping...\n", next if -f "$ROOT/$_"; - open my $F, '>', "$ROOT/$_" or die "$_: $!\n"; - print $F "User-agent: *\nDisallow: /\n"; - close $F; -} -print "\n"; - - -if(!-f "$ROOT/data/config.pl") { - # TODO: create a template config file - print "No custom config file found, please write one!\n"; -} -print "\n"; - - -print "Everything is initialized! Now make sure to configure your\n"; -print "webserver and to initialize a postgresql database (using\n"; -print "dump.sql)\n"; - - - - |