#!/usr/bin/bash

if [ $1 == 'make' ];then
	cd kylincameralibs &&\
	debian/rules clean &&\
	cd ..

	mkdir kylincameralibs-v10.1/ &&\
	cp kylincameralibs kylincameralibs-v10.1/kylincameralibs-1.0.0 -r &&\
	rm kylincameralibs-v10.1/kylincameralibs-1.0.0/.git -rf

	mkdir kylincameralibs-v10/ &&\
	cp kylincameralibs kylincameralibs-v10/kylincameralibs-1.0.0 -r &&\
	rm kylincameralibs-v10/kylincameralibs-1.0.0/.git -rf

	sed -i "s/v101;/juniper.sp3;/g" ./kylincameralibs-v10/kylincameralibs-1.0.0/debian/changelog
	sed -i "s/libx264-155 | libx264-163, libgpac4 | libgpac11, libva2, libva-drm2/libx264-148, libgpac4, libva1, libva-drm1/g" ./kylincameralibs-v10/kylincameralibs-1.0.0/debian/control && echo "make finish"
	
	tar -vczf kylincameralibs-v10.1.tar.gz kylincameralibs-v10.1
	tar -vczf kylincameralibs-v10.tar.gz kylincameralibs-v10
elif [ $1 == 'clean' ];then
	rm ./kylincameralibs-v10 -rf && rm ././kylincameralibs-v10.1 -rf &&\
	rm kylincameralibs-v10.1.tar.gz && rm kylincameralibs-v10.tar.gz &&\
	echo "clean ok"
fi
