Improve bash variables

This commit is contained in:
Francisco Javier Trujillo Mata 2018-12-31 10:49:15 +01:00
parent 90d7eaeda4
commit 9f1d609b61

View File

@ -6,6 +6,7 @@ display_usage() {
echo -e "install:\n install or re(install) the toolchain"
echo -e "build:\n update the source tree and build everything"
echo -e "prepare-profile:\n update the bash profile with the needed variables"
echo -e "export-variables:\n Export in this bash session the needed variables"
}
update-profile()
@ -15,9 +16,18 @@ update-profile()
echo "export PS2DEV=~/tools/ps2dev" >> ~/.profile
echo "export PS2SDK=\$PS2DEV/ps2sdk" >> ~/.profile
echo "export PATH=\$PATH:\$PS2DEV/bin:\$PS2DEV/ee/bin:\$PS2DEV/iop/bin:\$PS2DEV/dvp/bin:\$PS2SDK/bin" >> ~/.profile
#load profile
source ~/.profile
}
export-variables()
{
export PS2DEV=~/tools/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
}
download-ps2toolchain()
{
# PS2Toolchain
@ -79,7 +89,7 @@ install-ps2toolchain()
fi
cd ~/ps2tools/ps2toolchain
git fetch
git fetch && git pull
./toolchain.sh
}
@ -90,7 +100,7 @@ install-ps2sdk-ports()
fi
cd ~/ps2tools/ps2sdk-ports
git fetch
git fetch && git pull
make clean && make && make install
}
@ -101,7 +111,7 @@ install-gskit()
fi
cd ~/ps2tools/gskit
git fetch
git fetch && git pull
make clean && make && make install
}
@ -112,7 +122,7 @@ install-ps2-packer()
fi
cd ~/ps2tools/ps2-packer
git fetch
git fetch && git pull
make clean && make && make install
}
@ -120,47 +130,56 @@ install-ps2-packer()
platform=ps2
if [ "$1" = "prepare-profile" ]; then
mkdir -p ~/tools/ps2dev
export-variables
fi;
if [ "$1" = "export-variables" ]; then
mkdir -p ~/tools/ps2dev
update-profile
fi;
if [ "$1" = "install" ]; then
# Install needed dependencies
sudo apt install -yqqq build-essential git p7zip tar wget patch libucl-dev
sudo apt install -yqqq libucl-dev zlib1g-dev
#load profile
source ~/.profile
if [ ! -d ~/tools/ps2dev ]; then
mkdir -p ~/tools/ps2dev
# Prepare the lbash
update-profile
if [ -z ${PS2DEV+x} ]; then
echo $platform variables not found, run first either prepare-profile or export-variables...
else
# Install needed dependencies
sudo apt install -yqqq build-essential git p7zip tar wget patch libucl-dev
sudo apt install -yqqq libucl-dev zlib1g-dev
#Download everything
download-ps2toolchain
download-ps2sdk-ports
download-gskit
download-ps2-packer
donwload-libretro
#install everything
install-ps2toolchain
install-ps2sdk-ports
install-gskit
install-ps2-packer
echo $platform environment ready...
fi
#Download everything
download-ps2toolchain
download-ps2sdk-ports
download-gskit
download-ps2-packer
donwload-libretro
#install everything
install-ps2toolchain
install-ps2sdk-ports
install-gskit
install-ps2-packer
echo $platform environment ready...
fi;
if [ "$1" = "build" ]; then
if [ -d "~/tools/ps2dev/" ]; then
if ! [ -x "$(command -v ee-gcc)" ]; then
echo Error: PS2 toolchain is not installed.
echo $platform environment not found, run with install again...
else
cd ~/libretro/ps2
git pull
./libretro-buildbot-recipe.sh recipes/playstation/ps2
else
echo $platform environment not found, run with install again...
./libretro-buildbot-recipe.sh recipes/playstation/ps2
fi
fi;
if [ $# -le 0 ]; then
display_usage
fi