Codebase list falkon / HEAD debian / falkon.postinst
HEAD

Tree @HEAD (Download .tar.gz)

falkon.postinst @HEADraw · history · blame

#!/bin/sh
set -e

QW_CVT=/usr/lib/qt5/bin/qwebengine_convert_dict

case "$1" in
    configure)
	# declare falkon as a possible web browser
        update-alternatives --install /usr/bin/x-www-browser \
			    x-www-browser /usr/bin/falkon 80;
	
	# take care of /usr/share/qt5/qtwebengine_dictionaries which
	# comes with the package libqt5webengine-data
	if [ -L /usr/share/qt5/qtwebengine_dictionaries ]; then
	    # /usr/share/qt5/qtwebengine_dictionaries is a symlink
	    # repare it, when it is broken
	    realdir=$(realpath /usr/share/qt5/$(readlink /usr/share/qt5/qtwebengine_dictionaries))
	    if [ ! -d $realdir ]; then
		# the symlink was broken, let's create its target
		mkdir $realdir
	    fi
	else
	    # /usr/share/qt5/qtwebengine_dictionaries is missing
	    # so let's create it as a symlink to /usr/share/hunspell-bdic
	    mkdir -p /usr/share/hunspell-bdic
	    if [ ! -e /usr/share/qt5/qtwebengine_dictionaries ]; then
	       ln -s ../hunspell-bdic /usr/share/qt5/qtwebengine_dictionaries
	    fi
	fi
	# convert existing hunspell dictionaries and install them	
	[ -f "$QW_CVT" ] && \
	    for f in /usr/share/hunspell/*.dic; do \
		g=$(echo $(basename $f) | sed 's/dic$/bdic/'); \
		g=/usr/share/qt5/qtwebengine_dictionaries/$g; \
		if test ! -f $g || \
			test $(stat -c%W "$g") -lt $(stat -c%W "$f"); then \
		    if ! $QW_CVT $f  $g; then \
			echo "Warning: there was an error when launching $QW_CVT $f  $g"; \
		    fi; \
		fi;\
	    done;
        ;;
esac
#DEBHELPER#
exit 0