[go: up one dir, main page]

Menu

[c03ccd]: / trunk / debian / postinst  Maximize  Restore  History

Download this file

83 lines (65 with data), 2.6 kB

#!/bin/sh
# postinst script for lethe
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    configure)
		#FIXME: en proximas versiones no se regenerara el initramfs hasta despues de
		#       correr el script de configuracion de Lethe.

		#######Generacion del archivo de configuracion
		[ -d /etc/lethe ] ||mkdir /etc/lethe
		CONFILE=/etc/lethe/lethe.conf
		
		mountp=$(cat /etc/fstab | grep ext3 | sed -e "s/ \+/./g" | cut -f2 -d. | cut -f2-100 -d/)
		echo "#This variable indicates what partitions are going to be freezed" >> $CONFILE
		echo "MOUNTP=$(echo \"$mountp\")" >> $CONFILE
		echo "LETHE_PART=$(blkid |grep lethe|cut -d: -f1)" >> $CONFILE
		echo "#Last modification for this file at $(date -R)" >> $CONFILE
		#######Fin de la generacion del archivo de configuracion

		#conf para grub1
		if [  -f /boot/grub/menu.lst ]; then
			GCONFIG=/boot/grub/menu.lst
			if [ -z "$(grep  'aufs=tmpfs' $GCONFIG)" ]; then
				sed -i.bak $GCONFIG -re  's/(^[ \t]*kernel)(.*)/\1 \2 aufs=tmpfs/g'
			fi
			#backapeo la conf de grub previa
			echo ""
			[ -e /etc/lethe/grub.bak ]||[ -e /etc/lethe/menu.lst.bak  ]||\
				mv $GCONFIG.bak /etc/lethe/ && echo "Se ah realizado una copia de su archivo\
				de configuracion de GRUB en /etc/lethe/"
		fi

		#conf para grub2
		[ -e /etc/grub.d/09_lethe ] || cp /etc/lethe/09_lethe /etc/grub.d
		if [  -f /etc/grub.d/09_lethe ]; then
			/usr/sbin/update-grub
		fi

		#Agrego aufs a la lista de modulos ke se levantan en el inicio
		if [ -z "$(grep aufs /etc/initramfs-tools/modules)" ]; then
			echo "aufs" >> /etc/initramfs-tools/modules
		fi
		
		echo ""
		echo "Regenerando la imagen initramfs... Esto puede tomar unos minutos."
		update-initramfs -u -k all
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0