#!/bin/sh
set -e
if [ -f /etc/debian_version ]; then
	if dpkg --get-selections| grep debian-archive-keyring; then
		if dpkg --get-selections|grep kali-archive-keyring ;then
			_distributor="kali"
		elif dpkg --get-selections|grep parrot-archive-keyring ;then
			_distributor="parrot"
		elif dpkg --get-selections|grep siduction-archive-keyring ;then
			_distributor="siduction"
		elif dpkg --get-selections|grep kfreebsd ;then
			_distributor="freebsd"
		else 
			_distributor="debian"
		fi
	fi
	if dpkg --get-selections|grep ubuntu-keyring ;then
		_distributor="ubuntu"
	fi
	if dpkg --get-selections|grep linuxmint-keyring ;then
		_distributor="linuxmint"
	fi
	if dpkg --get-selections|grep devuan-keyring ;then
		_distributor="devuan"
	fi
fi
printf "\nsearching distributor $_distributor icon...\n"
_basedir="/usr/share/icons/Hedera"
if [ -f "${_basedir}"/240/logos/distributor-$_distributor.png ];then
	printf "\nSetting $_distributor as your distributior.\n"
	for _dir in $(echo $(find "${_basedir}" -maxdepth 1 -mindepth 1 -type d -not -name symbolic));do
		cd $_dir
		cp -fv "$_dir"/logos/distributor-$_distributor.png "$_dir"/logos/emblem-distributor.png
		cd $_basedir
	done
fi
