Commit 3b845e68 authored by Arnaud Blanchard's avatar Arnaud Blanchard

Improve security of bash scripts

parent 47bd273d
......@@ -36,7 +36,7 @@ done
[ $# -lt 1 ] && { echo "You need at least an argument"; usage; exit 1;}
if [ $# -gt 2 ]; then
if [ $# -gt 1 ]; then
case "$2" in
Release|Debug|RelWithDebugInfo|MinSizeRel) build_type="$2";;
*)echo "Unknown build type '$2'">&2; usage;;
......@@ -62,8 +62,7 @@ if [ "$1" = "all" ]; then
do
project_name=`basename $project_path`o
echo "Install **$project_path**"
#( ) is used to void to be contaminated by changing directory inside
developer_tools/install_project.sh $project_path $build_type > /tmp/blaar/install_$project_name.log || { echo; echo "Fail installing '$project_path'"; cat /tmp/blaar/install_$project_name.log; echo; exit 2; };
developer_tools/install_project.sh $project_path $build_type > /tmp/blaar/install_${project_name}.log || { echo; echo "Fail installing '$project_path'"; cat /tmp/blaar/install_${project_name}.log; echo; exit 2; };
done
echo
else
......
......@@ -24,14 +24,17 @@ usage(){
{
[ $# -lt 1 ] && { echo "Missing project directory."; usage; exit 1; }
#We go in the project directory
cd $1
project_dir="$PWD"
project_name=$(basename $project_dir)
cd - > /dev/null
#We go in blaar directory
cd $(dirname $0)
blaar_dir="$PWD"
blaar_build_dir="${blaar_dir}_build"
cd $1
project_dir="$PWD"
project_name=`basename $project_dir`
cd $blaar_dir
./compile.sh "$project_dir" "Release" "$project_name" > /tmp/blaar/compile_$project_name.log || { echo "Fail compiling '$project_dir'"; cat /tmp/blaar/compile_$project_name.log; exit 2; }
......@@ -39,12 +42,14 @@ usage(){
shift #remove $0 i.e. run.sh from $@
command_line="$bin_dir/$project_name $@"
echo
echo "Compile and execute **$project_name**": $bin_dir/$project_name "$@"
echo "Compile and execute: $command_line"
echo
$bin_dir/$project_name "$@"
exit $?
} 1>&2
#Finaly we launch it
$command_line
......@@ -16,7 +16,7 @@ current_dir=`pwd`
parent_dir=`dirname $current_dir`
build_dir="$parent_dir/`basename $current_dir`_build"
if (( $# != 1 ))
if [[ $# != 1 ]]
then
echo "You need a project directory as argument."
echo "Usage : xcode_project <project_directory>"
......@@ -30,4 +30,4 @@ developer_tools/create_project.sh $1 $build_dir xcode
if (( $? == 0 ))
then
open $build_dir/xcode/$1/$name.xcodeproj
fi
\ No newline at end of file
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment