#!/bin/sh

set -e

# Source debconf library.
. /usr/share/debconf/confmodule

# Remove symbolic link if it belongs to swiftlang
if [ "$1" = "remove" ] || [ "$1" = "purge" ] || [ "$1" = "abort-install" ]; then
    if [ -h /usr/bin/swift ]; then
        SWIFT_LINK=`readlink /usr/bin/swift`
        if [ "$SWIFT_LINK" = '/usr/libexec/swift/bin/swift' ]; then
            #echo "Removing symbolic link /usr/bin/swift"
            rm -f /usr/bin/swift
        fi
    fi
fi

# Clean up
if [ "$1" = "purge" -a -e /usr/share/debconf/confmodule ]; then
    # Remove my changes to the db.
    db_purge
fi

#DEBHELPER#
