Sophie

Sophie

distrib > Mandriva > 8.1 > i586 > by-pkgid > 4fa0ffe4743c81c5641d521551e3ab4b > scriptlet

dev-3.2-3mdk.i586.rpm

PREIN

/bin/sh
if [ -r /proc/mounts ] ; then
	(while read source mountpoint rest ; do
		if [ "$mountpoint" = /dev ] ; then
			exit 1
		fi
	 done
	 exit 0 ) < /proc/mounts
	MOUNTED=$?
	if [ "$MOUNTED" -ne 0 ] ; then
		echo $"Cannot install the dev package: mounted devfs detected."
		exit $MOUNTED
	fi
fi
if [ ! -d /dev ] ; then
	/bin/mkdir /dev
fi
/usr/sbin/groupadd -g 19 -r -f floppy > /dev/null 2>/dev/null ||:
exit 0

POSTIN

/bin/sh
if [ -f /etc/fstab ] ; then
  # add /dev/pts to fstab if fstab exists (install2 does it during install)
  if grep 'devpts' /etc/fstab >/dev/null 2>&1 ; then 
      # correct permissions from broken dev packages
      TMP=$(mktemp /tmp/fstab.XXXXXX)
      sed 's/devpts.*mode=0622/devpts  gid=5,mode=620/g' < /etc/fstab > $TMP && cat $TMP > /etc/fstab || { echo "failed to correct devpts permissions in /etc/fstab" 1>&2 ; exit 1 ; }
      rm -f $TMP
  else
    # note that we do not disallow comments; we wish to allow people
    # to comment it out if they so desire.
    if [ $(grep '/proc' /dev/fstab 2>/dev/null | wc -l) -gt 1 ] ; then
      # ugly but robust
      echo '
none                    /dev/pts                devpts  gid=5,mode=620        0 0' \
        >> /etc/fstab || { echo "failed to add devpts filesystem to /etc/fstab" 1>&2 ; exit 1 ; }
    else
      # beautiful in the common case
      TMP=$(mktemp /tmp/fstab.XXXXXX)
      sed '/\/proc/a\
none                    /dev/pts                devpts  gid=5,mode=620        0 0
          ' < /etc/fstab > $TMP && cat $TMP > /etc/fstab || { echo "failed to add devpts filesystem to /etc/fstab" 1>&2 ; exit 1 ; }
      rm -f $TMP
    fi
  fi
  # add /dev/shm to fstab if fstab exists (install2 does it during install)
  if ! grep 'tmpfs' /etc/fstab >/dev/null 2>&1 ; then 
    # note that we do not disallow comments; we wish to allow people
    # to comment it out if they so desire.
    if [ $(grep '/proc' /dev/fstab 2>/dev/null | wc -l) -gt 1 ] ; then
      # ugly but robust
      echo '
none                    /dev/shm                tmpfs   defaults        0 0' \
        >> /etc/fstab || { echo "failed to add tmpfs filesystem to /etc/fstab" 1>&2 ; exit 1 ; }
    else
      # beautiful in the common case
      TMP=$(mktemp /tmp/fstab.XXXXXX)
      sed '/\/proc/a\
none                    /dev/shm                tmpfs   defaults        0 0
          ' < /etc/fstab > $TMP && cat $TMP > /etc/fstab || { echo "failed to add tmpfs filesystem to /etc/fstab" 1>&2 ; exit 1 ; }
      rm -f $TMP
    fi
  fi
fi
if [ -x /sbin/pam_console_apply ] ; then
  /sbin/pam_console_apply
fi