From 5739aacad6d54565b294a49c83c10a5126011968 Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Wed, 24 Feb 2016 10:04:06 +0100 Subject: [PATCH] teach psyconf to generate the full config --- bin/psyconf | 61 ++++++++++++++++++++++++++++------- config/psyced.ini | 5 +-- install.sh | 12 +++---- {bin => utility/attic}/psyked | 0 4 files changed, 59 insertions(+), 19 deletions(-) rename {bin => utility/attic}/psyked (100%) diff --git a/bin/psyconf b/bin/psyconf index 498692c..6ec5682 100755 --- a/bin/psyconf +++ b/bin/psyconf @@ -44,18 +44,36 @@ use File::Spec; # } #} +sub debug() { 0 } + # append something while testing #my $test = "-NEW"; -use Data::Dumper; +#use Data::Dumper; sub say { print join('', @_); # if $test; } +sub sys { + print join(' ', @_), "\n" if debug; + if (system(@_)) { + if ($? == -1) { + print "\t{failed to execute: $!}\n"; + } elsif ($? & 127) { + printf "\t{command died with sig %d, %s core dump}\n", + ($? & 127), ($? & 128) ? 'with' : 'without'; + } else { + printf "\t{command exited with value %d}\n", $? >> 8; + } + exit $? if $?; + exit $@ if $@; + } +} ### MAIN ### # if you are manually compiling an ldmud, rename it or change here. my $driver = 'psyclpc'; + my $newbie = 0; use Getopt::Std; &getopt; @@ -166,8 +184,26 @@ X $c{_basic_host_name} || 'psyced'; $chatname = 'psyced' if $chatname eq 'psyc'; -# say "Generating control files in $c{_basic_path_base} ..\n\n"; - my $t = "$base/local/ports.h$test"; + my $t = "$base/local"; + unless (-w $t) { + $newbie = 1; + say <', $t or die "Cannot write to $t"; @@ -549,6 +585,7 @@ X print O "\t\$commandline\n"; } else { say "The file $sandbox/log/psyced.out will contain the runtime output.\n"; + say "The file $sandbox/log/psyced.err will contain error messages.\n"; print O <', $t or die "Cannot write to $t"; @@ -822,7 +859,9 @@ X ## end of former archetype.pl - say "\nCaution: You may have to completely shut down and restart psyced\n"; - say "to ensure the newly generated start-up scripts are actually used.\n"; + unless ($newbie) { + say "\nCaution: You may have to completely shut down and restart psyced\n"; + say "to ensure the newly generated start-up scripts are actually used.\n"; + } # vim:ts=8 diff --git a/config/psyced.ini b/config/psyced.ini index 61f6871..490a028 100644 --- a/config/psyced.ini +++ b/config/psyced.ini @@ -11,6 +11,7 @@ [_basic] ; Base directory of this PSYCED installation _path_base = /opt/psyced +; psyced runs in a sandbox of psyclpc and therefore needs this to be writable ; Configuration directory of this PSYCED installation ; psyconf will automatically search /etc/psyc for psyced.ini. @@ -20,8 +21,8 @@ _path_configuration = /etc/psyc ; Path leading to your private and public TLS keys ; (absolute or relative to the configuration directory). -_path_PEM_key = /etc/ssl/private/psyced_key.pem -_path_PEM_certificate = /etc/ssl/certs/psyced_cert.pem +_path_PEM_key = psyced.key +_path_PEM_certificate = psyced.crt ; Remember to make these files accessible to the userid ; running the psyced daemon! diff --git a/install.sh b/install.sh index 46cf769..86974f2 100755 --- a/install.sh +++ b/install.sh @@ -192,12 +192,12 @@ if ! test `ls -1 ${driver}-*tar.${zip} 2>/dev/null` then if wget "${lpcbaseurl}/${driver}-${driverver}.tar.${zip}" then - echo "${driver} successfully retrieved." - else - echo "${hi}ATTENTION: Unable to download ${driver}" - echo "${hi}ATTENTION: ${lo}You have no ${driver}-*.tar.${zip} in this directory." - echo "Please obtain one from http://lpc.psyc.eu." - $exit + echo "${driver} successfully retrieved." + else + echo "${hi}ATTENTION: Unable to download ${driver}" + echo "${hi}ATTENTION: ${lo}You have no ${driver}-*.tar.${zip} in this directory." + echo "Please obtain one from http://lpc.psyc.eu." + $exit fi else if test -d .git diff --git a/bin/psyked b/utility/attic/psyked similarity index 100% rename from bin/psyked rename to utility/attic/psyked