Updated Raspberry Pi 2 install script (created by DonCorleon)

This commit is contained in:
Don Honerbrink 2015-04-06 15:25:21 +00:00
parent 1ebe953892
commit 0ee4dc5cab

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash-
# -------------------------------------------------------- # --------------------------------------------------------
# Installs RetroFE and SDL2 from source on the Raspberry Pi 2 (Raspbian) # Installs RetroFE and SDL2 from source on the Raspberry Pi 2 (Raspbian)
@ -9,10 +9,22 @@
bold="\033[1m" bold="\033[1m"
normal="\033[0m" normal="\033[0m"
black='\033[0;30m'
darkgray='\033[1;30m'
lightgray='\033[0;37m'-
blue='\033[0;34m'
green='\033[0;32m'
cyan='\033[0;36m'
red='\033[0;31m'
purple='\033[0;35m'
orange='\033[0;33m'
yellow='\033[1;33m'
white='\033[1;37m'
NC='\033[0m' # No Color
# Welcome message # Welcome message
echo -e "\n${bold}This script will download and install RetroFE including SDL2 from source." echo -e "\nThis script will download and install ${red}RetroFE${NC} including ${red}SDL2${NC} from source."
echo -e "It will take 30-70 mins to complete on the Raspberry Pi 2 depending on number of updates and upgrades required.${normal}" echo -e "It will take ${yellow}15-60 mins${NC} to complete on the Raspberry Pi 2 depending on number of updates and upgrades required."
# Prompt to continue # Prompt to continue
read -p " Continue? (y/n) " ans read -p " Continue? (y/n) " ans
@ -20,9 +32,9 @@ read -p " Continue? (y/n) " ans
echo -e "\nQuitting...\n" echo -e "\nQuitting...\n"
exit exit
fi fi
echo -e "\n\n${bold}Would you like to Update and Upgrade Raspbian?${normal}?" echo -e "\n\nWould you like to ${red}Update${NC} and ${red}Upgrade${NC} Raspbian?"
read -p " (y/n) " upans read -p " (y/n) " upans
echo -e "${bold}Compile and install SDL2?${normal}?" echo -e "Compile and install ${yellow}SDL2${NC}?$"
read -p " (y/n) " sdlans read -p " (y/n) " sdlans
# Time the install process # Time the install process
@ -31,33 +43,31 @@ START_TIME=$SECONDS
if [[ $upans = "y" ]]; then if [[ $upans = "y" ]]; then
# Update Rasbian # Update Rasbian
echo -e "\n\n${bold}Updating...${normal}" echo -e "\n\n${green}Updating...${NC}"
sudo apt-get update -y sudo apt-get update -y
# Upgrade Rasbian # Upgrade Rasbian
echo -e "\n\n${bold}Upgrading...${normal}" echo -e "\n\n${green}Upgrading...${NC}"
sudo apt-get upgrade -y sudo apt-get upgrade -y
fi fi
# Install basic dependencies not needed for compiling SDL2 # Install basic dependencies not needed for compiling SDL2
echo -e "\n\n${bold}Installing Round 1 Dependencies...${normal}" echo -e "\n\n${green}Installing Round 1 Dependencies...${NC}"
sudo apt-get install -y tortoisehg g++ cmake dos2unix sudo apt-get install -y tortoisehg g++ cmake dos2unix
# ********************************************************************* # *********************************************************************
if [[ $sdlans = "y" ]]; then if [[ $sdlans = "y" ]]; then
# Compile SDL2 Libs # Compile SDL2 Libs-
echo -e "\n\n${bold}Preparing SDL2 Libraries...${normal}" echo -e "\n\n${green}Preparing SDL2 Libraries...${NC}"
# Setting up SDL2 variables # Setting up SDL2 variables
url="http://www.libsdl.org" url="http://www.libsdl.org"
# sdl="SDL2-2.0.3" # sdl="SDL2-2.0.3"
# sdl_url="${url}/release/${sdl}.tar.gz" # sdl_url="${url}/release/${sdl}.tar.gz"
# sdl_config="--host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl" # sdl_config='--host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl'
image="SDL2_image-2.0.0" image="SDL2_image-2.0.0"
image_url="${url}/projects/SDL_image/release/${image}.tar.gz" image_url="${url}/projects/SDL_image/release/${image}.tar.gz"
@ -76,14 +86,14 @@ sudo apt-get install -y tortoisehg g++ cmake dos2unix
wget -N $1 wget -N $1
tar -xzvf $2.tar.gz tar -xzvf $2.tar.gz
cd $2 cd $2
./configure $3 $4 $5 $6 $7 $8 $9 && make -j 4 && sudo make install ./configure && make -j 4 && sudo make install
rm /tmp/$2.tar.gz rm /tmp/$2.tar.gz
rm -rf /tmp/$2 rm -rf /tmp/$2
} }
echo -e "\n\n${bold}Installing Round 2 Dependencies...${normal}" echo -e "\n\n${green}Installing Round 2 Dependencies...${NC}"
sudo apt-get install -y libglib2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsdl2* automake build-essential libasound2-dev libdbus-1-dev libfreeimage-dev libfreetype6-dev libjpeg8-dev libmpeg3-dev libopenal-dev libpango1.0-dev libsndfile-dev libtiff4-dev libudev-dev libvorbis-dev libwebp-dev sudo apt-get install -y libglib2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsdl2* automake build-essential libasound2-dev libdbus-1-dev libfreeimage-dev libfreetype6-dev libjpeg8-dev libmpeg3-dev libopenal-dev libpango1.0-dev libsndfile-dev libtiff4-dev libudev-dev libvorbis-dev libwebp-dev
echo -e "\n\n${bold}Beginning SDL2 Core build...${normal}" echo -e "\n\n${green}Beginning SDL2 Core build...${NC}"
# get ${sdl_url} ${sdl} ${sdl_config} # get ${sdl_url} ${sdl} ${sdl_config}
# Needs to be fixed so its part of the loop # Needs to be fixed so its part of the loop
cd /tmp cd /tmp
@ -95,31 +105,41 @@ sudo apt-get install -y tortoisehg g++ cmake dos2unix
sudo make install sudo make install
rm /tmp/SDL2-2.0.3.tar.gz rm /tmp/SDL2-2.0.3.tar.gz
rm -rf /tmp/SDL2-2.0.3 rm -rf /tmp/SDL2-2.0.3
echo -e "\n\n${bold}Beginning SDL2 Image build...${normal}" echo -e "\n\n${green}Beginning SDL2 Image build...${NC}"
get ${image_url} ${image} ${image_config} get ${image_url} ${image} ${image_config}
echo -e "\n\n${bold}Beginning SDL2 Mixer build...${normal}" echo -e "\n\n${green}Beginning SDL2 Mixer build...${NC}"
get ${mixer_url} ${mixer} ${mixer_config} get ${mixer_url} ${mixer} ${mixer_config}
echo -e "\n\n${bold}Beginning SDL2 TTF build...${normal}" echo -e "\n\n${green}Beginning SDL2 TTF build...${NC}"
get ${ttf_url} ${ttf} ${ttf_config} get ${ttf_url} ${ttf} ${ttf_config}
echo -e "\n\n${bold}SDL2 Libraries Complete....${normal}" echo -e "\n\n${green}SDL2 Libraries Complete....${NC}"
# Make sure Lib locations are updated
sudo ldconfig
# **************************************************************************************** # ****************************************************************************************
fi fi
cd ~
# Download RetroFE source # Download RetroFE source
echo -e "\n\n${bold}Downloading RetroFE...${normal}" echo -e "\n\n${green}Downloading RetroFE...${NC}"
hg clone --debug -v https://bitbucket.org/teamretro/retrofe hg clone --debug -v https://bitbucket.org/teamretro/retrofe
cd retrofe cd retrofe
# Generate Make files for RetroFE # Generate Make files for RetroFE
echo -e "\n\n${bold}Generating make files...${normal}" echo -e "\n\n${green}Generating make files...${NC}"
cmake RetroFE/Source -BRetroFE/Build -DVERSION_MAJOR=0 -DVERSION_MINOR=0 -DVERSION_BUILD=0 cmake RetroFE/Source -BRetroFE/Build -DVERSION_MAJOR=0 -DVERSION_MINOR=0 -DVERSION_BUILD=0
# Compile RetroFE # Compile RetroFE
echo -e "\n\n${bold}Compiling RetroFE and creating a full environment...${normal}" echo -e "\n\n${green}Compiling RetroFE and creating a full environment...${NC}"
cmake --build RetroFE/Build cmake --build RetroFE/Build
# Install Basic folders and menu # Install Basic folders and menu
python Scripts/Package.py --os=linux --build=full python Scripts/Package.py --os=linux --build=full
# Print the time elapsed # Print the time elapsed
ELAPSED_TIME=$(($SECONDS - $START_TIME)) ELAPSED_TIME=$(($SECONDS - $START_TIME))
echo -e "\n${bold}Finished in $(($ELAPSED_TIME/60/60)) hr, $(($ELAPSED_TIME/60%60)) min, and $(($ELAPSED_TIME%60)) sec${normal}\n" echo -e "\n${bold}Finished in $(($ELAPSED_TIME/60/60)) hr, $(($ELAPSED_TIME/60%60)) min, and $(($ELAPSED_TIME%60)) sec${normal}\n"
#Final Message #Final Message
echo -e "Type ${bold}./Artifacts/linux/RetroFE/retrofe${normal} to start..." echo -e "Copy ${bold}./retrofe/Artifacts/linux/RetroFE/${normal} to wherever you like or"
echo -e "Type ${bold}./retrofe/Artifacts/linux/RetroFE/retrofe${normal} to start..."