/usr/sbin/interchangeconfig is in interchange 5.7.7-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | #! /usr/bin/perl
#
# Copyright 2001,2003,2004,2005,2009,2010 by Stefan Hornburg (Racke) <racke@linuxia.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301 USA.
use strict;
use warnings;
# constants we use
my $lock_ex = 2;
my $lock_un = 8;
# configuration files which we modify
my $featconf = '/etc/interchange/features.cfg';
my $settingsconf = '/etc/interchange/settings.cfg';
# Interchange variables
my %setvars = (DEBUG => 0, FULL_URL => 0, ROBOTS => 1, SOAP => 0,
SWISH => 0, TRAFFIC => 'low', UI_LOCALE => 'en_US');
my %requires = (SOAP => ['SOAP::Lite']);
my %featvars = (UI => '', USE_FOUNDATION => '', USE_STANDARD => '',
MV_GETPPID_BROKEN => 0);
my %skipvars;
# other variables
my (@tokens, $varref);
# parse commandline
for (@ARGV) {
unless (/\S+=/) {
die "$0: invalid parameter '$_'\n";
}
@tokens = split(/=/);
if (exists($setvars{$tokens[0]})) {
$varref = \%setvars;
} elsif (exists($featvars{$tokens[0]})) {
$varref = \%featvars;
} else {
die "$0: no such variable $tokens[0]\n";
}
if (defined $tokens[1]) {
$varref->{$tokens[0]} = $tokens[1];
} else {
$varref->{$tokens[0]} = '';
}
# don't override these settings
$skipvars{$tokens[0]} = 1;
}
# modify features configuration
&update_configfile($featconf, 0, \%featvars);
# modify settings configuration
&update_configfile($settingsconf, 1, \%setvars);
sub update_configfile {
my ($configfile, $modsallowed, $varref) = @_;
if (-f $configfile) {
open (SCONF, "+<$configfile")
|| die ("$0: Couldn't open $configfile: $!\n");
flock (SCONF, $lock_ex);
while (<SCONF>) {
# strip leading/trailing whitespace
s/^\s+//; s/^\s+$//;
# skip comment lines/blank lines
next if /^\#/; next unless /\S/;
# check for "Variable"'s
@tokens = split (/\s+/, $_, 3);
next if $tokens[0] ne 'Variable';
next if exists $skipvars{$tokens[1]};
# record values found
if (exists $varref->{$tokens[1]}) {
if (defined $tokens[2]) {
$varref->{$tokens[1]} = $tokens[2];
} else {
$varref->{$tokens[1]} = '';
}
}
}
truncate (SCONF, 0)
|| die ("$0: Couldn't truncate $configfile: $!\n");
seek (SCONF, 0, 0)
|| die ("$0: Seek failed on $configfile: $!\n");
} else {
open (SCONF, ">$configfile")
|| die ("$0: Couldn't open $configfile: $!\n");
}
if ($modsallowed) {
print SCONF <<EOF;
# This file is automatically generated by $0.
# You may modify this file, but this is NOT recommended.
EOF
} else {
print SCONF <<EOF;
# This file is automatically generated by $0.
# You may NOT modify this file, because it reflects the
# installation state of the Interchange packages.
EOF
}
for (sort (keys %$varref)) {
print SCONF "Variable $_ $varref->{$_}\n";
}
flock (SCONF, $lock_un);
close (SCONF)
|| die ("$0: Couldn't close $configfile: $!\n");
}
=head1 NAME
interchangeconfig - Updates Debian specific Interchange configuration files
=head1 DESCRIPTION
interchangeconfig reads and writes the Interchange configuration files
/etc/interchange/features.cfg and /etc/interchange/settings.cfg.
The following settings can be changed with C<interchangeconfig>:
=over 4
=item C<DEBUG>
Whether to enable debug mode or not.
=back
=over 4
=item C<FULL_URL>
Whether to enable FullUrl configuration directive or not.
=back
=over 4
=item C<ROBOTS>
The Interchange Debian package uses a separate configuration file
C</etc/interchange/robots.cfg> for the directives C<RobotUA>, C<RobotIP>
and C<RobotHost>. It is recommended to include these settings so
Interchange can distinguish between robots and ordinary users.
=back
=over 4
=item C<SWISH>
Whether to enable Swish search or not.
=back
=over 4
=item C<SOAP>
This setting determines if Interchange starts the SOAP server as well.
This is only available if the Perl module SOAP::Lite is installed.
=back
=over 4
=item C<TRAFFIC>
You can choose different sets of server parameters (C<low>, C<high> and
C<rpc>). Any store based on the foundation demo will change its behaviour too.
If C<rpc> is selected, the Interchange server will run in PreFork mode.
=back
=head1 AUTHOR
Stefan Hornburg (Racke), racke@linuxia.de
=head1 SEE ALSO
interchange(1p)
=cut
|