#!/bin/bash ######Version 3 By Maosen 20170618######
# author Maosen Sun <sunnymaosen@gmail.com,sun285529808@qq.com>
# copyright Maosen Sun
# organization EmulatedLab(QQ Group:593920308)
# @link http://www.eve-ng.com
# @version 20170618
qemu=$(pwd)
icon="/opt/unetlab/html/images/icons"
include="/opt/unetlab/html/includes"
template="/opt/unetlab/html/templates" 
if [ ${qemu:25:10} == 'openstack-' ]
then
	mv -f $qemu/Openstack.png $icon/Openstack.png
	mv -f $qemu/openstack.php $template/openstack.php
	if grep -i \'openstack\' $include/init.php > /dev/null
	then
		echo -e "\033[33mSorry!!!\033[0m Maybe you has already import it!"
	else
		sed -i "/Linux/i\\\t\t'openstack'\t\t\t=>\t'Openstack'," $include/init.php
		echo -e "\033[31mGreat!!!\033[0m \"Openstack Device\" import successfully!!!"
	fi
	rm -rf $qemu/openstack.sh
else
	echo -e "\033[31mSorry!!!\033[0m Your folder name is NOT legal, please modify the directory name, then run the script again !!! \n\033[32mFor example: \"openstack-xxxx\"\033[0m"
fi

