#!/bin/bash

echo "===== Running 'systemd-resolved' remover... =====" && \
RESULT=$(dpkg -l | grep 'systemd-resolved') && \
sleep 1 && \
echo "Searching..." && \
sleep 1 && \
echo "" && \
if [[ $RESULT != "" ]]; then
	echo "Unfortunately, the 'systemd-resolved' has been found on your system." && \
	sleep 1 && \
	echo "Trying to remove this garbage..." && \
	CMD1='apt' && \
	CMD1_SEARCH=$(which apt) && \
	if [[ $CMD1_SEARCH == "" ]]; then
		CMD1='apt-get'
	fi
	sudo ${CMD1} remove -y --purge systemd-resolved && \
	sleep 1 && \
	echo "==========================================================" && \
	echo "Successfully removed 'systemd-resolved'. Congratulations!" && \
	echo "" && \
	echo "" && \
	exit 0;
fi
echo "==========================================================" && \
echo "Luckly, this machine doesn't have 'systemd-resolved'. Congratulations!" && \
echo ""
