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
|
#!/bin/sh -e
# determine architecture
ARCH=`dpkg --print-installation-architecture`
#DEBCONF_DEBUG=1
#export DEBCONF_DEBUG
if [ "$1" = "configure" ]; then
update-rc.d setserial start 30 S . stop 30 0 6 . >/dev/null
if [ -f /usr/share/debconf/confmodule ]; then # debconf exists
# source debconf library
. /usr/share/debconf/confmodule
if [ -r /etc/rc.boot/0setserial ] ; then
if [ "$ARCH" != "m68k" ]; then
# inform about the renaming of rc.boot file
db_get setserial/rc-boot-file-renamed
mv /etc/rc.boot/0setserial /etc/rc.boot/0setserial.pre-2.15
# ask about using autosave in serial.conf
#db_get setserial/autosave
#if [ "$RET" = "true" ]; then
# cp /etc/serial.conf /etc/serial.conf.orig
# /etc/init.d/setserial stop >&2
# echo "setserial thought the following about your system..." >&2
# if ! grep "^[^#]" /etc/serial.conf >&2 ; then
# echo " no information..." >&2
# fi
#fi
else
# inform about the removal of rc.boot file
db_get setserial/rc-boot-file-removed
rm -f /etc/rc.boot/0setserial
fi
fi
if [ "$ARCH" != "m68k" ]; then
if [ ! -e /etc/serial.conf ]; then
touch /etc/serial.conf
fi
chead="`head -1 /etc/serial.conf`X"
db_get setserial/autosave-types
case "$RET" in
( "AUTOSAVE ONCE" | "autosave once" )
if [ "$chead" != "###AUTOSAVE-ONCE###X" -a "$chead" != "###PORT STATE GENERATED USING AUTOSAVE-ONCE###X" ]; then
mv /etc/serial.conf /etc/serial.conf.tmp
echo "###AUTOSAVE-ONCE###" > /etc/serial.conf
cat /etc/serial.conf.tmp >> /etc/serial.conf
rm /etc/serial.conf.tmp
/etc/init.d/setserial stop >&2
fi
;;
( "MANUAL" | "manual" )
if [ "$chead" != "#X" ]; then
mv /etc/serial.conf /etc/serial.conf.tmp
echo "#" > /etc/serial.conf
cat /etc/serial.conf.tmp >> /etc/serial.conf
rm /etc/serial.conf.tmp
fi
;;
( "AUTOSAVE ALWAYS" | "autosave always" )
if [ "$chead" != "###AUTOSAVE###X" ]; then
mv /etc/serial.conf /etc/serial.conf.tmp
echo "###AUTOSAVE###" > /etc/serial.conf
cat /etc/serial.conf.tmp >> /etc/serial.conf
rm /etc/serial.conf.tmp
/etc/init.d/setserial stop >&2
fi
;;
esac
#if [ "$RET" = "true" ]; then
# cp /etc/serial.conf /etc/serial.conf.orig
# /etc/init.d/setserial stop >&2
# echo "setserial thought the following about your system..." >&2
# if ! grep "^[^#]" /etc/serial.conf >&2 ; then
# echo " no information..." >&2
# fi
#fi
if [ -x /sbin/update-modules ]; then
if ! /sbin/update-modules ; then
db_input high setserial/update-modules-failed || true
db_get setserial/update-modules-failed
db_go
fi
fi
fi
else # debconf doesn't exist, revert to old type of questions
# See if the user has an old-style 0setserial entry
if [ -r /etc/rc.boot/0setserial ] ; then
if [ "$ARCH" != "m68k" ]; then
echo "You have an old-style 0setserial entry. The configuration"
echo "mechanism has changed completely from 2.14."
echo "Renaming your old /etc/rc.boot/0setserial to 0setserial.pre-2.15"
mv /etc/rc.boot/0setserial /etc/rc.boot/0setserial.pre-2.15
echo ""
echo "This release uses serial.conf in /etc/ to configure the ports"
echo "When you shutdown or halt your machine, your current settings should"
echo "be automatically stored, providing you do not have either"
echo "a multiport or a hayes device (edit /etc/serial.conf by hand)."
echo "Attention PCMCIA users - pcmcia has its own configuration for"
echo "pcmcia serial-type devices, which is not compatible with setserial."
echo "I have attempted to compensate for this, but if you have problems"
echo "read /usr/share/doc/setserial/README.Debian.gz"
echo "Note that if you edit serial.conf, remember to remove completely"
echo "the AUTOSAVE line from the file."
echo ""
echo -n "Do you want the automatic serial port configuration (recommended) (YES/no):"
read ANSWER
if [ "$ANSWER" = "no" -o "$ANSWER" = "NO" -o "$answer" = "n" -o "$ANSWER" = "N" ]
then
echo "Okay, not touching your configuration. Edit your /etc/serial.conf yourself."
else
echo "Configuring setserial automatically"
cp /etc/serial.conf /etc/serial.conf.orig
/etc/init.d/setserial stop
echo "setserial thought the following about your system..."
# grep -v "^#" /etc/serial.conf
if ! grep "^[^#]" /etc/serial.conf >&2 ; then
echo " no information..."
fi
fi
else
echo "You have an old-style 0setserial entry. The new standard makes"
echo "use of /etc/init.d rather than /etc/rc.boot, and your old"
echo "/etc/rc.boot/0setserial file from version 2.14 will be removed."
rm -f /etc/rc.boot/0setserial
fi
fi
if [ "$ARCH" != "m68k" -a -x /sbin/update-modules ]; then
if ! /sbin/update-modules ; then
cat <<END >&2
WARNING: setserial tried to install the module management code to support
the serial.o module being loaded and unloaded dynamically by kerneld (or
its equivalent). However, update-modules failed to allow its installation.
There may be something non-standard about your module configuration.
You should try running /sbin/update-modules on your own.
Please press <enter> to continue...
END
read KEYPRESS
fi
fi
fi # debconf or not
fi # $1 = configure
#DEBHELPER#
|