Last active
December 12, 2019 02:17
-
-
Save frgomes/aa3a3e091ca12ab755b4a2633b3b3797 to your computer and use it in GitHub Desktop.
bash - install RetroPie on UDOO Bold V8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## | |
## This script is instended to install RetroPie on a newly installed Debian Buster box. | |
## | |
## Hardware requirements: | |
## This script is known to work well with UDOO Bolt V8, which has an AMD Ryzen 1000 SoC. | |
## | |
## Software Requirements: | |
## | |
## 1. Copy this script onto the target device. | |
## You can either copy this script using a USB stick, copying it straight onto /root or | |
## maybe allow access to an administrator account via OpenSSH. | |
## | |
## 2. A bare minimum Debian Buster installation, containing just the base system and OpenSSH server. | |
## Not even KDE or graphics drivers are necessary, since this script takes care of: | |
## 2.1. Linux kernel upgrade | |
## 2.2. Installation of non-free firmware | |
## 2.3. Installation of AMD GPU drivers | |
## 2.4. Creation of a separate user "retropie" | |
## 2.5. Install RetroPie under user "retropie" | |
## 2.6. Put /etc/retropie/config under Git source control | |
## 2.7. Put /opt/retropie/configs under Git source control | |
## 2.8. Put /home/retropie/.config under Git source control | |
## | |
## In case you'd like to allow SSH access from the command line, you can try to obtain | |
## an IP address via DHCP, employing dhclient like the example below: | |
## # ### running as root: | |
## # ip addr | |
## # dhclient enp4s0 | |
## # ip addr | |
## | |
function install_retropie_etckeeper { | |
sudo apt install -y etckeeper | |
sudo etckeeper init | |
sudo etckeeper commit "first commit" | |
} | |
function __install_retropie_apt_sources { | |
cat << EOD | |
deb http://deb.debian.org/debian/ buster main non-free contrib | |
deb-src http://deb.debian.org/debian/ buster main non-free contrib | |
deb http://security.debian.org/debian-security buster/updates main contrib non-free | |
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free | |
# buster-updates, previously known as 'volatile' | |
deb http://deb.debian.org/debian/ buster-updates main contrib non-free | |
deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free | |
# buster-backports | |
deb http://deb.debian.org/debian buster-backports main contrib non-free | |
deb-src http://deb.debian.org/debian buster-backports main contrib non-free | |
EOD | |
} | |
function install_retropie_apt_sources { | |
__install_retropie_apt_sources | sudo tee /etc/apt/sources.list > /dev/null | |
sudo apt update | |
} | |
function install_retropie_upgrade_kernel { | |
__install_retropie_apt_sources | sudo tee /etc/apt/sources.list > /dev/null | |
sudo apt update | |
sudo apt install -t buster-backports -y linux-image-amd64 linux-headers-amd64 firmware-amd-graphics | |
} | |
function install_retropie_perform_reboot_after_kernel_upgrade { | |
sync; sync; sync; sleep 3 | |
sudo reboot | |
} | |
function install_retropie_basic_requirements { | |
sudo apt install -y sudo fail2ban | |
sudo apt install -y zile tree htop psutils | |
sudo apt install -y kde-standard | |
sudo apt install -y atool arc arj lzip lzop nomarch rar rpm unace unalz unrar lbzip2 zip unzip p7zip p7zip-rar unrar-free | |
} | |
function install_retropie_amdgpu { | |
sudo apt install -y firmware-linux firmware-linux-nonfree firmware-amd-graphics libdrm-amdgpu1 xserver-xorg-video-amdgpu | |
sudo apt install -y mesa-vulkan-drivers libvulkan1 vulkan-tools vulkan-utils vulkan-validationlayers | |
sudo apt install -y mesa-opencl-icd | |
} | |
function install_retropie_perform_reboot_after_amdgpu { | |
sync; sync; sync; sleep 3 | |
sudo reboot | |
} | |
function install_retropie_create_user_for_retropie { | |
sudo useradd -m -s /bin/bash -u 2000 -c RetroPie -G sudo retropie | |
echo "Enter password for user retropie" | |
sudo passwd retropie | |
sudo su - retropie -c 'ssh-keygen -t rsa -b 4096' | |
sudo etckeeper commit "user retropie is now created" | |
} | |
function install_retropie_requirements_for_retropie { | |
sudo dpkg --add-architecture i386 | |
sudo apt update | |
sudo etckeeper commit "dpkt --add-architecture i386" | |
sudo apt install -y git dialog xmlstarlet | |
} | |
function install_retropie_application { | |
if [ ! -d ~retropie/RetroPie-Setup ] ;then | |
sudo --user retropie git clone --depth=1 https://github.com/RetroPie/RetroPie-Setup.git ~retropie/RetroPie-Setup | |
fi | |
sudo --user retropie --login sudo ~retropie/RetroPie-Setup/retropie_setup.sh | |
} | |
function install_retropie_source_control_of_configurations { | |
sudo etckeeper commit -a -m "first commit of retropie configurations" | |
if [ -d /opt/retropie/configs ] ;then | |
cd /opt/retropie/configs | |
sudo git init /opt/retropie/configs | |
sudo git -C /opt/retropie/configs add . | |
sudo git -C /opt/retropie/configs commit -a -m "first commit of retropie configurations" | |
else | |
echo "ERROR: could not find directory: /opt/retropie/config" | |
fi | |
if [ -d ~retropie/.config ] ;then | |
sudo --user retropie git init ~retropie/.config | |
sudo --user retropie git -C ~retropie/.config add . | |
sudo --user retropie git -C ~retropie/.config commit -a -m "first commit of retropie configurations" | |
else | |
echo "ERROR: could not find directory: ~retropie/.config" | |
fi | |
} | |
function install_retropie_nfs_requirements { | |
sudo apt install -y nfs-common resolvconf | |
} | |
function install_retropie_nfs_mountpoints { | |
sudo mkdir -p /mnt/omv/Software | |
echo "192.168.0.2 omv.local omv" | sudo tee -a /etc/hosts > /dev/null | |
echo "omv.local:/export/Software /mnt/omv/Software nfs rsize=8192,wsize=8192,timeo=14,intr" | sudo tee -a /etc/fstab > /dev/null | |
} | |
function install_retropie_nfs_mount { | |
sudo mount -t nfs -a | |
} | |
function install_retropie_copy_bios { | |
sudo --user retropie cp -p /mnt/omv/Software/RetroPie/BIOS/psx/SCPH1001.BIN ~retropie/RetroPie/BIOS | |
} | |
function install_retropie_copy_roms { | |
sudo --user retropie 7z x -o/home/retropie/RetroPie/roms/snes '/mnt/omv/Software/RetroPie/roms/snes/Lemmings.7z' | |
sudo --user retropie 7z x -o/home/retropie/RetroPie/roms/snes '/mnt/omv/Software/RetroPie/roms/snes/Lost Vikings II, The.7z' | |
sudo --user retropie 7z x -o/home/retropie/RetroPie/roms/psx '/mnt/omv/Software/RetroPie/roms/psx/Crash Bandicoot (USA).7z' | |
} | |
##TODO: install and configure PCSX2 | |
#function install_retropie_install_playstation2_emulator{ | |
# sudo apt install -y pcsx2 | |
# cp /mnt/omv/Software/RetroPie/BIOS/ps2/SCPH-70004_BIOS_V12_PAL_200.* . | |
#} | |
function install_retropie { | |
echo "Please call function by function manually since reboots are necessary." | |
} | |
if [ $_ != $0 ] ;then | |
# echo "Script is being sourced: list available functions" | |
self=$(readlink -f "${BASH_SOURCE[0]}"); dir=$(dirname $self) | |
# echo $dir | |
# echo $self | |
fgrep "function " $self | fgrep -v "function __" | cut -d' ' -f2 | head -n -2 | |
else | |
# echo "Script is a subshell: execute last function" | |
self=$(readlink -f "${BASH_SOURCE[0]}"); dir=$(dirname $self) | |
# echo $dir | |
# echo $self | |
cmd=$(fgrep "function " $self | cut -d' ' -f2 | head -n -2 | tail -1) | |
# echo $cmd | |
$cmd $* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment