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
|
#!/bin/sh -e
. /usr/share/debconf/confmodule
name_list="disk_xapp_same auto_config_x x_config_command x_config_opts auto_start_x x_display_command x_display_opts alt_x_display_command alt_x_display_opts"
config_file=/etc/lessdisks/x.config
addItems() {
config=$1
shift
items=$@
for name in $items; do
db_get lessdisks-xterminal/$name
# perl code contributed by Jonas Smedegaard
# TODO don't require value to be present in configuration file?
perl -i -e "
while (<>) {
print unless /^(#### DO NOT EDIT THIS FILE #####|$name=)/i;
if ( /^$name=/i ) {
\$seen++;
print \"$name=\\\"$RET\\\"\n\";
print STDERR \"WARNING: option \\\"$name\\\" set multiple times!\n\" if ( \$seen > 1 );
}
}
print STDERR \"WARNING: option \\\"$name\\\" not set!\n\" unless \$seen;
" $config_file
done
}
cp -f $config_file $config_file.old
addItems $config_file $name_list
# stop debconf, since the rest of the script may produce output
db_stop
if [ -r /etc/lessdisks/server.config ]; then
# source config file
. /etc/lessdisks/server.config
else
echo "/etc/lessdisks/server.config file not readable"
fi
if [ -r /etc/lessdisks/x.config ]; then
# source config file
. /etc/lessdisks/x.config
else
echo "/etc/lessdisks/x.config file not readable"
fi
#### add entries to inittab to start X in runlevels 4 and 5
# also add entries to show what the various runlevels do
inittab_line="xl:45:respawn:/usr/sbin/lessdisks-xsession"
if [ -z "$(egrep ^$inittab_line /etc/inittab)" ]; then
# TODO put these runlevel lines somewhere else entirely.
echo "# lessdisks terminal x-sessions" >> /etc/inittab
echo "# runlevel 2 is setup/default" >> /etc/inittab
echo "# runlevel 3 is console only" >> /etc/inittab
echo "# runlevel 4 starts X using $alt_x_display_command" >> /etc/inittab
echo "# runlevel 5 starts X using $x_display_command" >> /etc/inittab
echo "$inittab_line" >> /etc/inittab
fi
|