# Debian - Print installation instructions
# USAGE: debian_install_instructions $package[…]
debian_install_instructions() {
	if [ "${PLAYIT_DEBIAN_OLD_DEB_FORMAT:-0}" -eq 1 ]; then
		debian_install_instructions_dpkg "$@"
	else
		debian_install_instructions_apt "$@"
	fi
}

# Debian - Print installation instructions, using apt
# USAGE: debian_install_instructions_apt $package[…]
debian_install_instructions_apt() {
	local path_output_directory
	path_output_directory=$(path_output_directory)

	printf 'apt install'

	local package package_name
	for package in "$@"; do
		package_name=$(package_name "$package")
		# TODO: The following path could be computed from a dedicated function.
		printf ' "%s"' "${path_output_directory}/${package_name}"
	done

	printf '\n'
}

# Debian - Print installation instructions, using dpkg
# USAGE: debian_install_instructions_dpkg $package[…]
debian_install_instructions_dpkg() {
	local path_output_directory
	path_output_directory=$(path_output_directory)

	printf 'dpkg --install'

	local package package_name
	for package in "$@"; do
		package_name=$(package_name "$package")
		# TODO: The following path could be computed from a dedicated function.
		printf ' "%s"' "${path_output_directory}/${package_name}"
	done

	printf '\n'
	printf 'apt-get install --fix-broken\n\n'

	local messages_language message
	messages_language=$(messages_language)
	case "$messages_language" in
		('fr')
			message='Les éventuelles erreurs de dépendances suite à la commande dpkg peuvent être ignorées,'
			message="$message"' elles seront corrigées par la commande apt-get à entrer ensuite.\n'
		;;
		('en'|*)
			message='Potential errors related to dependencies after the dpkg command can be ignored,'
			message="$message"' they will be fixed by the command apt-get to run afterwards.\n'
		;;
	esac
	print_message 'info' "$message"
}

