entaxy:back-comp = {

	service = (service:get org.apache.karaf.features.FeaturesService)

	if { $1'' equals "install" } {
	
		# check repo
		_repo = (feature:repo-list | grep ru.entaxy.platform/platform-backward-compat)
		_repo_length = ($_repo length)
		if { $_repo_length'' equals "0" } {
			echo "Installing feature repo ru.entaxy.platform/platform-backward-compat/${project.version}"
			feature:repo-add mvn:ru.entaxy.platform/platform-backward-compat/${project.version}/xml/features
		}
		
		_platform_feature = ($service getFeature entaxy-platform)
		_feature_id = $_platform_feature getId
		_status = ($service getState $_feature_id) toString
		
		if { $_status equals "Uninstalled" } {
			echo "Entaxy Platform not found, installation aborted"
		} else {
			_bc_feature = ($service getFeature entaxy-backward-compatibility-modules)
			_feature_id = $_bc_feature getId
			_status = ($service getState $_feature_id) toString
			
			if { $_status equals "Uninstalled" } {
				echo "Installing feature 'entaxy-backward-compatibility-modules'"
				feature:install -r -v entaxy-backward-compatibility-modules
				echo
				echo " --> DONE"
			} else {
				echo "Feature 'entaxy-backward-compatibility-modules' is already installed"
			}
			
		}
	
	} else {
		if { $1'' equals "uninstall" } {
			echo "Uninstalling feature 'entaxy-backward-compatibility-modules'"
			feature:uninstall -r -v entaxy-backward-compatibility-modules
			echo
			echo " --> DONE"
		} else {

			_bc_feature = ($service getFeature entaxy-backward-compatibility-modules)
			_feature_id = $_bc_feature getId
			_status = ($service getState $_feature_id) toString

			if { $_status equals "Uninstalled" } {
				echo
				echo " --> UNINSTALLED"
			} else {
				echo
				echo " --> INSTALLED"
			}

		}

	}
}