mirror of
https://github.com/ChronosX88/psyced.git
synced 2024-12-05 00:22:19 +00:00
teach psyconf to generate the full config
This commit is contained in:
parent
02d4e80119
commit
5739aacad6
57
bin/psyconf
57
bin/psyconf
@ -44,18 +44,36 @@ use File::Spec;
|
|||||||
# }
|
# }
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
sub debug() { 0 }
|
||||||
|
|
||||||
# append something while testing
|
# append something while testing
|
||||||
#my $test = "-NEW";
|
#my $test = "-NEW";
|
||||||
use Data::Dumper;
|
#use Data::Dumper;
|
||||||
|
|
||||||
sub say {
|
sub say {
|
||||||
print join('', @_); # if $test;
|
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 ###
|
### MAIN ###
|
||||||
# if you are manually compiling an ldmud, rename it or change here.
|
# if you are manually compiling an ldmud, rename it or change here.
|
||||||
my $driver = 'psyclpc';
|
my $driver = 'psyclpc';
|
||||||
|
my $newbie = 0;
|
||||||
|
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
&getopt;
|
&getopt;
|
||||||
@ -166,8 +184,26 @@ X
|
|||||||
$c{_basic_host_name} || 'psyced';
|
$c{_basic_host_name} || 'psyced';
|
||||||
$chatname = 'psyced' if $chatname eq 'psyc';
|
$chatname = 'psyced' if $chatname eq 'psyc';
|
||||||
|
|
||||||
# say "Generating control files in $c{_basic_path_base} ..\n\n";
|
my $t = "$base/local";
|
||||||
my $t = "$base/local/ports.h$test";
|
unless (-w $t) {
|
||||||
|
$newbie = 1;
|
||||||
|
say <<X;
|
||||||
|
|
||||||
|
Welcome new installer!
|
||||||
|
Copying (just this time) default configuration into $t ..
|
||||||
|
X
|
||||||
|
sys("/bin/cp", "-rp", "$base/config/blueprint", $t);
|
||||||
|
}
|
||||||
|
$t = "$base/data";
|
||||||
|
mkdir($t) unless -w $t;
|
||||||
|
$t = "$base/data/person";
|
||||||
|
mkdir($t) unless -w $t;
|
||||||
|
$t = "$base/data/place";
|
||||||
|
mkdir($t) unless -w $t;
|
||||||
|
$t = "$base/log";
|
||||||
|
mkdir($t) unless -w $t;
|
||||||
|
|
||||||
|
$t = "$base/local/ports.h$test";
|
||||||
say "Generating control file $t ..\n";
|
say "Generating control file $t ..\n";
|
||||||
rename $t, "$t~";
|
rename $t, "$t~";
|
||||||
open O, '>', $t or die "Cannot write to $t";
|
open O, '>', $t or die "Cannot write to $t";
|
||||||
@ -549,6 +585,7 @@ X
|
|||||||
print O "\t\$commandline\n";
|
print O "\t\$commandline\n";
|
||||||
} else {
|
} else {
|
||||||
say "The file $sandbox/log/psyced.out will contain the runtime output.\n";
|
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 <<X;
|
print O <<X;
|
||||||
touch $sandbox/log/psyced.out $sandbox/log/psyced.err
|
touch $sandbox/log/psyced.out $sandbox/log/psyced.err
|
||||||
$domv $sandbox/log/psyced.err $sandbox/log/psyced.err-old
|
$domv $sandbox/log/psyced.err $sandbox/log/psyced.err-old
|
||||||
@ -581,9 +618,9 @@ X
|
|||||||
|
|
||||||
# PSYCED INIT.D SCRIPT
|
# PSYCED INIT.D SCRIPT
|
||||||
$t = "$base/etc";
|
$t = "$base/etc";
|
||||||
mkdir($t);
|
mkdir($t) unless -w $t;
|
||||||
$t .= "/init.d";
|
$t .= "/init.d";
|
||||||
mkdir($t);
|
mkdir($t) unless -w $t;
|
||||||
$t .= "/psyced$test";
|
$t .= "/psyced$test";
|
||||||
say "Generating control file $t ..\n";
|
say "Generating control file $t ..\n";
|
||||||
rename $t, "$t~";
|
rename $t, "$t~";
|
||||||
@ -675,13 +712,13 @@ X
|
|||||||
|
|
||||||
# TORRC
|
# TORRC
|
||||||
$t = "$base/etc/tor";
|
$t = "$base/etc/tor";
|
||||||
mkdir($t);
|
mkdir($t) unless -w $t;
|
||||||
$t = "$base/var";
|
$t = "$base/var";
|
||||||
mkdir($t);
|
mkdir($t) unless -w $t;
|
||||||
$t = "$base/var/tor";
|
$t = "$base/var/tor";
|
||||||
mkdir($t);
|
mkdir($t) unless -w $t;
|
||||||
$t = "$base/etc/tor/torrc";
|
$t = "$base/etc/tor/torrc";
|
||||||
say "Generating Tor configuration $t ..\n";
|
say "Generating optional Tor configuration $t ..\n";
|
||||||
rename $t, "$t~";
|
rename $t, "$t~";
|
||||||
open O, '>', $t or die "Cannot write to $t";
|
open O, '>', $t or die "Cannot write to $t";
|
||||||
|
|
||||||
@ -822,7 +859,9 @@ X
|
|||||||
|
|
||||||
## end of former archetype.pl
|
## end of former archetype.pl
|
||||||
|
|
||||||
|
unless ($newbie) {
|
||||||
say "\nCaution: You may have to completely shut down and restart psyced\n";
|
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";
|
say "to ensure the newly generated start-up scripts are actually used.\n";
|
||||||
|
}
|
||||||
|
|
||||||
# vim:ts=8
|
# vim:ts=8
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
[_basic]
|
[_basic]
|
||||||
; Base directory of this PSYCED installation
|
; Base directory of this PSYCED installation
|
||||||
_path_base = /opt/psyced
|
_path_base = /opt/psyced
|
||||||
|
; psyced runs in a sandbox of psyclpc and therefore needs this to be writable
|
||||||
|
|
||||||
; Configuration directory of this PSYCED installation
|
; Configuration directory of this PSYCED installation
|
||||||
; psyconf will automatically search /etc/psyc for psyced.ini.
|
; 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
|
; Path leading to your private and public TLS keys
|
||||||
; (absolute or relative to the configuration directory).
|
; (absolute or relative to the configuration directory).
|
||||||
_path_PEM_key = /etc/ssl/private/psyced_key.pem
|
_path_PEM_key = psyced.key
|
||||||
_path_PEM_certificate = /etc/ssl/certs/psyced_cert.pem
|
_path_PEM_certificate = psyced.crt
|
||||||
; Remember to make these files accessible to the userid
|
; Remember to make these files accessible to the userid
|
||||||
; running the psyced daemon!
|
; running the psyced daemon!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user