#!/bin/bash ## this script generates executables for jiwigo ## to use it, you have to download the "work" directory ## here : http://www.jiwigo.com/downloads/work.tar.gz ## you just have to change work_path to indicate the path to "work" ## and "project_path" to the path of the project. ## you have to run the mvn jar command before launching this script ## the mvn command is writter in the install file of the project : install/install.txt ## all the generated files will be moved to the "generation" directory. ## the package dpkg-dev must be installed work_path='/home/mael/Documents/jiwigo/work' project_path='/home/mael/workspace/jiwigo' target_path=$project_path/target ############################################################################################### ##################### building deb ############################## ############################################################################################### echo '##### building deb... #####' cd $work_path #Calculate size and version to complete debian's control file size=`du -cs jiwigo` size=`echo $size | cut -d ' ' -f 1` version=`find $target_path -type f -name \*with-dependencies.jar | xargs -I file echo file | cut -d '-' -f 2` cp $work_path/templates/control_template $work_path/temp echo Version: $version >> $work_path/temp echo Installed-Size: $size >> $work_path/temp rm $work_path/jiwigo/DEBIAN/control mv temp $work_path/jiwigo/DEBIAN/control #copies sources rm -rf $work_path/jiwigo/usr/share/jiwigo/src/src-jiwigo/* cp -r $project_path/src/* $work_path/jiwigo/usr/share/jiwigo/src/src-jiwigo/ #copies the jar rm $work_path/jiwigo/usr/share/jiwigo/jiwigo.jar find $target_path -type f -name \*with-dependencies.jar -exec cp {} $work_path/jiwigo/usr/share/jiwigo/jiwigo.jar \; #delete temporary files find "$work_path" | egrep "~$" | perl -n -e 'system("rm $_");' #changes current directory cd "$work_path" #makes deb dpkg-deb --build jiwigo rm "$work_path/depot/jiwigo.deb" rm "$work_path/depot/Packages.gz" #moves deb mv -f "$work_path/jiwigo.deb" "$work_path/depot/jiwigo.deb" #makes Packages.gz cd "$work_path/depot" dpkg-scanpackages . /dev/null | gzip - > Packages.gz ############################################################################################### ##################### Building exe ############################## ############################################################################################### echo '##### building exe... #####' cd $work_path work_path_for_sed="$(echo $work_path | sed 's/\//\\\//g')" sed 's/#jar_location/'$work_path_for_sed'\/jiwigo\/usr\/share\/jiwigo\/jiwigo.jar/g' templates/launch4j_template.xml > launch4j_tmp.xml sed 's/#exe_location/'$work_path_for_sed'\/jiwigo.exe/g' launch4j_tmp.xml > launch4j.xml rm launch4j_tmp.xml $work_path/launch4j/launch4j $work_path/launch4j.xml rm launch4j.xml ############################################################################################### ##################### completes generation folder ############################## ############################################################################################### echo '##### completing generation folder... #####' rm $work_path/generation/* mv $work_path/jiwigo.exe $work_path/generation/ cp $work_path/depot/jiwigo.deb $work_path/generation/ cp $work_path/jiwigo/usr/share/jiwigo/jiwigo.jar $work_path/generation/ cd $project_path/ tar -zcf $work_path/generation/jiwigo-src.tar.gz --exclude '.*' src pom.xml install echo '##### Done #####'