neurodebian.postinst 1016 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/bash

set -e

. /usr/share/debconf/confmodule


case "$1" in
    configure)
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
		db_get neurodebian/enable
		if [ "$RET" = "true" ]; then
			# obtain all the options and call nd-configurerepo
			opts="--do-not-update"
			db_get neurodebian/release; [ "$RET" = "auto" ] || opts+=" -r '$RET'"
			db_get neurodebian/mirror;	nd_mirror="${RET##* }" # get just a url if it came together with alias
			db_get neurodebian/flavor;	nd_flavor="$RET"
			db_get neurodebian/components; nd_components="${RET// /}"

			db_get neurodebian/overwrite;  [ "$RET" = "true" ] && opts+=" --overwrite" || :
			db_get neurodebian/suffix;	   [ "$RET" = "" ]	   || opts+=" --suffix='$RET'" || :

			eval nd-configurerepo -m "$nd_mirror" -c "$nd_components" $opts
		else
			# removing neurodebian APT configs
			rm -f /etc/apt/sources.list.d/neurodebian.sources*.list
		fi
	;;
	abort-upgrade|abort-remove|abort-deconfigure)
		# nothing to do
	;;

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

#DEBHELPER#