	
# sudo でpasswordの入力が促されるコマンドを/etc/sudoersに登録
	
echo "------------------------------------"
	
cd ../
echo $PWD
echo "git pull"
git pull
	
echo "------------------------------------"
	
#make distclean
#aclocal
#autoreconf -i
#automake --add-missing

./configure
make distclean
./configure
make

if [ `uname` = "Darwin" ]; then
  echo "########## mac で実行 ################"
	sudo make install

	# mcmdRBのmakeとインストール
	cd ruby
	make clean
	make
	sudo make install
	#cd gem
	#sudo gem install mcmd-*.gem

	cd ../package/mac
	echo $PWD
	echo "mkpackage.sh"
	bash mkpackage.sh

	echo "installer -pkg build/kgmod-*.pkg -target /"
	sudo installer -pkg build/kgmod-*.pkg -target /

	echo "installer -pkg build/mcmd-*.pkg -target /"
	sudo installer -pkg build/mcmd-*.pkg -target /
	

elif [ `uname` = "Linux" ]; then
  echo "########## Linuxで実行 ################"
	sudo make install
	
	# mcmdRBのmakeとインストール
	cd ruby
	make clean
	make
	cd gem
	sudo gem install mcmd-*.gem

	cd ../../package/ubuntu
	echo $PWD
	echo "mkpackage.sh  &>xxlog_1"
	bash mkpackage.sh  &>xxlog_1
	cat xxlog_1
	
	echo "------------------------------------"
	cd ../../;
	echo $PWD
	echo "./rmAllBins.sh"
	sudo bash rmAllBins.sh
	
	echo "------------------------------------"
	cd package/PACKAGE;
	echo $PWD
	echo "dpkg -i mcmd_*"
	sudo dpkg -i mcmd_*

fi

cd ../../../test
echo $PWD
echo "git pull"
git pull
	
echo "%%% testスクリプト実行 %%%%%%"
bash check.sh

echo "%%% testRBスクリプト実行 %%%%%%"
cd ruby
bash check.sh


