postinst is in setserial 2.17-48.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
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 202 203 204 205 206 207 | #!/bin/sh
set -e
# determine architecture
ARCH=`dpkg --print-architecture`
package="setserial"
autoconfig="/var/lib/setserial/autoserial.conf"
#DEBCONF_DEBUG=1
#export DEBCONF_DEBUG
# Here are the one-off conversion routines for /var/lib/setserial usage.
# reentry is prevented via touching etc.serial.conf.bkp
# Do not delete that file...
#
if [ ! -f /var/lib/setserial/etc.serial.conf.bkp ]; then
if [ -f /etc/serial.conf ]; then
echo Updating your /etc/serial.conf to /var/lib/setserial/etc.serial.conf.bkp.
cp /etc/serial.conf /var/lib/setserial/etc.serial.conf.bkp
chead="`sed 1q /etc/serial.conf`X"
if [ "$chead" = "###PORT STATE GENERATED USING AUTOSAVE-ONCE###X" ]; then
rm -f /etc/serial.conf
elif [ "$chead" = "#KERNELX" ]; then
rm -f /etc/serial.conf
elif [ "$chead" = "###AUTOSAVE###X" ]; then
rm -f /etc/serial.conf
elif [ "$chead" = "###AUTOSAVE-ONCE###X" ]; then
rm -f /etc/serial.conf
fi
else
touch /var/lib/setserial/etc.serial.conf.bkp
fi
echo removing the old setserial entry in the rcn.d directories
# It MUST be moved to the new priority to work - hope noone minds. I
# could just delete it and then create a new name, but that seems
# pointless
update-rc.d -f setserial remove >/dev/null
echo Update complete.
fi
if [ ! -f $autoconfig ]; then
if [ "$ARCH" = "sparc" ]; then
cat > $autoconfig <<ZZZ
#
# This is an empty conf file. You should refer to the setserial documentation
# to find out what can be done with this file for your architecture.
#
ZZZ
else
cat > $autoconfig <<ZZZ
###AUTOSAVE-ONCE###
###AUTOSAVE###
#
# If you want to configure this file by hand, use
# dpkg-reconfigure setserial
# and change the configuration mode of the file to MANUAL. If you do not do this, this file may be overwritten automatically the next time you upgrade the
# package.
#
ZZZ
fi
fi
if [ "$1" = "configure" ]; then
if [ -r /etc/init.d/etc-setserial ] ; then
update-rc.d etc-setserial start 30 S . stop 30 0 1 6 . >/dev/null
fi
update-rc.d setserial start 46 S . stop 19 0 1 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
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 $autoconfig ]; then
touch $autoconfig
fi
chead="`sed 1q $autoconfig`X"
db_get setserial/autosave-types
case "$RET" in
( "AUTOSAVE ONCE" | "autosave once" )
if [ "$chead" != "###PORT STATE GENERATED USING AUTOSAVE-ONCE###X" ]; then
mv $autoconfig ${autoconfig}.tmp
echo "###AUTOSAVE-ONCE###" > $autoconfig
cat ${autoconfig}.tmp >> $autoconfig
rm ${autoconfig}.tmp
/etc/init.d/setserial stop >&2
fi
;;
( "MANUAL" | "manual" )
if [ "$chead" != "#X" ]; then
mv $autoconfig ${autoconfig}.tmp
echo "#" > $autoconfig
cat ${autoconfig}.tmp >> ${autoconfig}
rm ${autoconfig}.tmp
fi
;;
( "KERNEL" | "kernel" )
if [ "$chead" != "#KERNELX" ]; then
rm ${autoconfig}
echo "#KERNEL" > $autoconfig
fi
;;
( "AUTOSAVE ALWAYS" | "autosave always" )
if [ "$chead" != "###AUTOSAVE###X" ]; then
mv ${autoconfig} ${autoconfig}.tmp
echo "###AUTOSAVE###" > ${autoconfig}
cat ${autoconfig}.tmp >> ${autoconfig}
rm ${autoconfig}.tmp
/etc/init.d/setserial stop >&2
fi
;;
esac
# HHH update-modules removed
# if [ -x /sbin/update-modules ]; then
# #db_get setserial/usemodup
# #if [ "$RET" = "true" ]; then
# if ! /sbin/update-modules ; then
# WHOCARES=0;
# fi
# #fi
# fi
fi
else # debconf doesn't exist, revert to old type of questions
# This never happens, as debconf is now a required package.
exit 1
# 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" ] || [ "$ANSWER" = "NO" ] || [ "$answer" = "n" ] || [ "$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
invoke-rc.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
# HHH update-modules removed
#if [ "$ARCH" != "m68k" ] && [ -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
|