#!/bin/bash

PKG=repo-upstream-salt

copy_repo_file() {
    local codename=$(lsb_release -cs || echo "unknown")
    local repo_file="/usr/share/$PKG/salt-upstream-${codename}.list"
    local target_file="/etc/apt/sources.list.d/$PKG.list"
    if test -e "$repo_file"; then
        echo -e "\e[0;32m$PKG: copy $repo_file -> ${target_file}\e[0m"
        cp -vf $repo_file $target_file
    else
        echo -e "\e[0;31m$PKG: There are no repos for release '${codename}'\e[0m"
    fi
}

case $1 in
	configure)
        copy_repo_file
	;;

	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
