#! /bin/sh # # initscripts postinst # set -e case "$1" in configure) PREV_VER=$2 ;; abort-upgrade|abort-remove|abort-deconfigure) exit 0 ;; esac umask 022 chrooted() { if [ -r /proc/1/root ]; then return 1 fi return 0 } # # Initialize rcS default file. # if [ ! -f /etc/default/rcS ] then cp -p /usr/share/initscripts/default.rcS /etc/default/rcS else # in Ubuntu we use /var/run and /var/lock tmpfses; these are not # optional so remove the options from /etc/default/rcS if dpkg --compare-versions "$PREV_VER" le-nl "2.87dsf-4ubuntu9" then sed -i "/^RAMRUN=/d;/^RAMLOCK=/d" /etc/default/rcS fi fi # # In 2.86.ds1-7 the "single" script was moved. # We have to remove the old links _before_ we install new ones. # if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-7" then update-rc.d -f single remove >/dev/null 2>&1 || : fi # In 2.86.ds1-16, the mtab.sh and hostname.sh scripts were moved. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16" then update-rc.d -f mtab.sh remove >/dev/null 2>&1 || : update-rc.d -f hostname.sh remove >/dev/null 2>&1 || : fi # In 2.86.ds1-21, the sendsigs script were moved, and in 2.86.ds1-35 # it was moved back. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-35" then update-rc.d -f sendsigs remove >/dev/null 2>&1 || : fi # In 2.86.ds1-56ubuntu1, the waitnfs.sh was renamed to mountnfs.sh to be in # sync with Debian again. if dpkg --compare-versions "$PREV_VER" le-nl "2.86.ds1-56ubuntu1" then update-rc.d -f waitnfs.sh remove >/dev/null 2>&1 || : fi # # In 2.87dsf-2 the "mountoverflowtmp" script was dropped # from runlevels 0 and 6. # We have to remove the old links _before_ we install new ones. # if dpkg --compare-versions "$PREV_VER" lt "2.87dsf-2" ; then update-rc.d -f mountoverflowtmp remove >/dev/null 2>&1 || : fi # In 2.87dsf-4ubuntu1, the bootlogs.sh was renamed to bootlogs to be in # sync with Debian again. if dpkg --compare-versions "$PREV_VER" le-nl "2.87dsf-4ubuntu1" then update-rc.d -f bootlogs.sh remove >/dev/null 2>&1 || : fi # In 2.87dsf-4ubuntu2, we begin migrating to Upstart jobs, so all of # these get removed. if dpkg --compare-versions "$PREV_VER" le-nl "2.87dsf-4ubuntu2" then update-rc.d -f hostname.sh remove >/dev/null 2>&1 || : update-rc.d -f mountkernfs.sh remove >/dev/null 2>&1 || : update-rc.d -f mountdevsubfs.sh remove >/dev/null 2>&1 || : update-rc.d -f checkroot.sh remove >/dev/null 2>&1 || : update-rc.d -f mtab.sh remove >/dev/null 2>&1 || : update-rc.d -f checkfs.sh remove >/dev/null 2>&1 || : update-rc.d -f mountall.sh remove >/dev/null 2>&1 || : update-rc.d -f mountall-bootclean.sh remove >/dev/null 2>&1 || : update-rc.d -f mountoverflowtmp remove >/dev/null 2>&1 || : update-rc.d -f mountnfs.sh remove >/dev/null 2>&1 || : update-rc.d -f mountnfs-bootclean.sh remove >/dev/null 2>&1 || : update-rc.d -f bootmisc.sh remove >/dev/null 2>&1 || : update-rc.d -f bootlogs remove >/dev/null 2>&1 || : update-rc.d -f rmnologin remove >/dev/null 2>&1 || : fi # Previous to 2.87dsf-4ubuntu17.4, /etc/motd sometimes got erroneously copyied # to /etc/motd.tail. This stanza is taken from the Oneiric version of this # file, with the comparison version number appropriately twiddled. if [ -f /etc/motd.tail ] && \ dpkg --compare-versions "$PREV_VER" lt "2.87dsf-4ubuntu17.4" then # If the standard help-text from update-motd is found in the # /etc/motd.tail file, it has been created from the old /etc/motd # file during the initscripts < 2.87dsf-4ubuntu17.4 postinst script, # so it should be removed. Give up if the help-text template # generator is missing or produces no output. help_text=$(/etc/update-motd.d/10-help-text 2>/dev/null || true) if [ -n "$help_text" ] && fgrep -q "$help_text" /etc/motd.tail then rm -f /etc/motd.tail # Rebuild the motd now that motd.tail has been fixed. run-parts --lsbsysinit /etc/update-motd.d > /var/run/motd.new \ && mv /var/run/motd.new /var/run/motd || true fi fi # # Okay, we could do this with update-rc.d, but that would probably # be pretty slow. This way we win some speed. # DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES. # # Links in runlevel S # #update-rc.d bootlogd start 05 S . >/dev/null || exit $? update-rc.d urandom start 55 S . start 30 0 6 . >/dev/null || exit $? # # Links in runlevels other than S # update-rc.d halt start 90 0 . >/dev/null || exit $? update-rc.d reboot start 90 6 . >/dev/null || exit $? update-rc.d umountroot start 60 0 6 . >/dev/null || exit $? update-rc.d umountfs start 40 0 6 . >/dev/null || exit $? update-rc.d umountnfs.sh start 31 0 6 . >/dev/null || exit $? update-rc.d sendsigs start 20 0 6 . >/dev/null || exit $? update-rc.d killprocs start 30 1 . >/dev/null || exit $? update-rc.d single start 90 1 . >/dev/null || exit $? update-rc.d ondemand start 99 2 3 4 5 . >/dev/null || exit $? update-rc.d rc.local start 99 2 3 4 5 . >/dev/null || exit $? #update-rc.d stop-bootlogd-single start 99 S . >/dev/null || exit $? #update-rc.d stop-bootlogd start 99 2 3 4 5 . >/dev/null || exit $? # # Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12) # versions. We have the same functionality in mount{kern,devsub}fs.sh # # # In 2.86.ds1-10 the "mountvirtfs" script was replaced by # mountkernfs.sh and mountdevsubfs.sh. It was removed completely in # 2.86.ds1-16. # for F in mountkernfs devpts.sh mountvirtfs do rm -f /etc/init.d/$F update-rc.d $F remove >/dev/null 2>&1 || : done # # Create /var/run and /var/lock on the root partition to make sure # they are available. # If mount fail (like in a vserver environment), just clean up and ignore # it. # if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-22" && ! chrooted then # We need to quickly bind / to another location so we can make them # just in case /var is a mountpoint or a symlink to one. mkdir -p /.root if mount -n --bind / /.root ; then if [ -L /.root/var ] && [ ! -d /.root/var ] ; then # No use trying if /var is a relative symlink. It is not # going to work. : else mkdir -p /.root/var/run /.root/var/lock fi umount /.root fi rmdir /.root fi # # When installing for the first time or upgrading from version before # 2.86.ds1-27, a reboot is needed to make the /lib/init/rw/ tmpfs # available. Flag this using notify-reboot-required. Not mounting it # here as it creates problem for debootstrap, vservers, pbuilder and # cowbuilder. # if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-27" \ && [ -x /usr/share/update-notifier/notify-reboot-required ]; then /usr/share/update-notifier/notify-reboot-required fi # # Create mount point for spufs, and create spu system group # if mountpoint -q /proc && grep -qs '^cpu.*Cell' /proc/cpuinfo; then if ! getent group spu >/dev/null; then # the adduser package is priority important; cannot use addgroup groupadd -K GID_MAX=1000 spu fi mkdir -p /spu if ! mountpoint -q /spu; then # No need to fail configuration if this isn't possible. Mount # will still display an error. See LP #261490 and #251593. mount -t spufs -ogid=spu spufs /spu || true fi fi # # Create initial log files # [ "$PREV_VER" ] || chmod 755 /var/log/fsck || : for F in /var/log/dmesg /var/log/boot /var/log/fsck/checkroot /var/log/fsck/checkfs do if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1 then echo "(Nothing has been logged yet.)" >| "$F" chown root:adm "$F" chmod 640 "$F" fi done # # Set up nologin symlink so that dynamic-login-disabling will work # (when DELAYLOGIN is set to "yes") # if [ ! -L /etc/nologin ] && [ ! -e /etc/nologin ] then rm -f /var/lib/initscripts/nologin ln -s /var/lib/initscripts/nologin /etc/nologin fi # # Set up motd stuff, putting variable file in /var/run/ # if [ ! -f /etc/motd.tail ] then if [ -f /etc/motd -a ! -L /etc/motd ] then sed 1d /etc/motd > /etc/motd.tail [ -s /etc/motd.tail ] || rm -f /etc/motd.tail fi fi if [ ! -f /var/run/motd ] then if [ -f /etc/motd ] then cat /etc/motd > /var/run/motd else :>/var/run/motd fi fi if [ ! -L /etc/motd ] then [ -f /etc/default/rcS ] && . /etc/default/rcS if [ "$EDITMOTD" = no ] then cat /var/run/motd > /etc/motd.static ln -sf motd.static /etc/motd else ln -sf /var/run/motd /etc/motd fi fi # # Mount kernel virtual filesystems...not. # This causes problems in pbuilder. # # #if [ -x /etc/init.d/mountkernfs.sh ] #then # if which invoke-rc.d >/dev/null 2>&1 # then # invoke-rc.d mountkernfs.sh start || : # else # /etc/init.d/mountkernfs.sh start # fi #fi # # Create /dev/pts, /dev/shm directories # if [ "$(uname -s)" = Linux ] then # # Only create /dev/{pts,shm} if /dev is on the # root file system. If some package has mounted a # seperate /dev (ramfs from udev, devfs) it is # responsible for the presence of those subdirs. # (it is OK for these to fail under fakechroot) # if ! mountpoint -q /dev then [ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts || [ "$FAKECHROOT" = true ]; } [ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; } fi fi # # Create /etc/rc.local on first time install and when upgrading from # versions before "2.86.ds1-16" # if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16" then if [ ! -e /etc/rc.local ]; then cat << EOF > /etc/rc.local #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. exit 0 EOF # make sure it's enabled by default. chmod 755 /etc/rc.local fi fi :