binary-cipher / RetroPie-Setup-Ubuntu

Scripts to automate the installation on RetroPie on Ubuntu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RetroPie-Setup-Ubuntu

Script to automate the installation on RetroPie on Ubuntu 20.04, with the end-state user experience nearly identical to a Raspberry Pi installation, but with the power and flexibility of x86.

This script was inspired by feedback provided on the RetroPie forums, and does the following:

  • Disables sudo password prompts
  • Installs the minimal OS dependecies needed to install OpenBox and run RetroPie
  • Installs the RetroPie 'basic' packages
  • Install the latest video drivers for Intel, Nvidia, and Vulkan
  • Applies the RetroPie-PacMan Plymouth theme to run during startup / shutdown
  • Hides all GRUB and kernel text output during startup/shutdown
  • Enables autologin and boots directly into OpenBox / EmulationStation
  • Hides all terminal window 'chrome' in OpenBox (menu, scrollbar, cursor) when launching emulators
  • Uses 'unclutter' to show the mouse cursor only when it is being moved
  • Enables 1080p resolution for GRUB and X Windows to improve the user experience & performance on 4K displays (user configurable)

The script also provides the ability for additional customizations, optionally executing external scripts at the beginning and end of the installation process. A library of user-submitted sctips is available to get you started. See the Optional Scripts section for more information.

Of course, your mileage may vary when using the master retropie_setup_ubuntu.sh script. It has been organized into functions to improve readability. If you don't want to run the full script, you can copy/paste the sections that apply to the specific changes you wish to make. Just note that many of these command would need to be run in sudo if executed independently and variable substitution may be required.

Installing the Base OS

Download a copy of Ubuntu 20.04

These scripts are intended for one of the following Ubuntu 20.04 installations:

Manual Ubuntu Install

Perform a basic install of Ubuntu with these basic options

  • Language: english
  • Keyboard: english
  • Hostname: retropie
  • Username: pi
  • Password: raspberry
  • Partition Scheme: entire disk (preferred, not required)
  • Optional Install: openssh-server (recommended for remote access, copy/paste)

Automated Ubuntu Install - Live Server

If you are familiar with the use of autoinstall files to automate Ubuntu installs (no support here), you can use the example autoinstall-user-data file to perform a basic install against the Live Server installer. Use at your own risk!!!

Automated Ubuntu Install - Legacy Mini & Legacy Server

If you are familiar with the use of preseed files to automate Ubuntu installs (no support here), you can use the example retropie.preseed file to perform a basic install against the Legacy Server or Mini installer. Use at your own risk!!!

RetroPie-Setup-Ubuntu

  • Log in as the pi user

  • Download the bootstrap script

    wget -q https://raw.githubusercontent.com/MizterB/RetroPie-Setup-Ubuntu/master/bootstrap.sh

  • Run the bootstrap script

    sudo bash ./bootstrap.sh

    Optionally, you can override the Git repository (-r) and branch (-b) used by the bootstrap script. This is helpful if you want to bootstrap from your own fork or a different branch. The available options can be passed as follows:

    sudo bash ./bootstrap.sh -r https://github.com/<USERNAME>/RetroPie-Setup-Ubuntu -b <BRANCHNAME>

  • Configure Optional Scripts, if desired

  • Run the installer script as sudo

    sudo ./RetroPie-Setup-Ubuntu/retropie_setup_ubuntu.sh

Optional Scripts

The main retropie_setup_ubuntu.sh script is intended to create a Ubuntu environment that closely mimcs the basic RetroPie image for Raspberry Pi. However, some users have suggested additional tweaks and features that further customize the Ubuntu environment beyond this scope, as well as experimental changes that may be incorporated into the master script in the future. The optional_scripts directory provides the ability include these additional changes in the installation process, or to write your own scripts based on your needs.

The Library

Inside optional_scripts/library, you will find a collection of additional scripts that further extend the installation process. While the script names are intended to be descriptive, additional details for each script are included at the beginning of each file.

Pre-Install and Post-Install Scripts

The optional_scripts/pre_install and optional_scripts/post_install directories can be populated with BASH scripts that are run at the very beginning and end of the master installation process. Scripts in these directories will be executed in alphabetical order, so if the order is important to you, you can prepend the file names with a number (e.g. 01-myscript.sh) for greater control.

If you want to include a Library script in your pre or post-install proceess, the easiest way to do this is to simply copy it into the appropriate folder. Alternatively, you can also move the Library scripts or create symbolic links to them.

You can also write your own custom scripts and place them in these directories. Use the scripts in the Library as an example. Note that variables defined in the master script (USER_HOME, SCRIPT_DIR, etc.) are also available to the custom scripts, and that all output will be automatically written to both the console and log file.

Additionally, you can create a single pre/post-install script that calls multiple Library scripts by using the source command. Note that paths should be relative to the retropie_setup_ubuntu.sh script. For example:

#!/bin/bash
###############################################################################
# This is an example script that wraps multiple Library scripts
# that disable system services
###############################################################################
echo "--------------------------------------------------------------------------------"
echo "| Disabling multiple services via Library scripts"
echo "--------------------------------------------------------------------------------"
echo -e "\n\n"
source ./optional_scripts/library/disable_apparmor.sh
source ./optional_scripts/library/disable_avahi_daemon.sh
source ./optional_scripts/library/disable_bluetooth.sh
source ./optional_scripts/library/disable_modemmanager.sh
source ./optional_scripts/library/disable_samba.sh
echo -e "FINISHED $BASH_SOURCE \n\n"

Submissions Welcome!

If you have master script changes or additional fetaures that you would like to include in the Library, please share! Pull Requests are preferred.

Calling Single Functions or Optional Scripts

Running the installer script retropie_setup_ubuntu.sh without any arguments results in the full installer logic being executed. But you can also pass individual function names as arguments, and the script will just execute those functions. For example:

sudo retropie_setup_ubuntu.sh "set_resolution_xwindows 720x480"

or

sudo retropie_setup_ubuntu.sh "run_optional_scripts optional_scripts/pre_install/pre_install.sh"

or

sudo retropie_setup_ubuntu.sh "run_optional_scripts optional_scripts/library/enable_wifi.sh"

A couple of things to note...

  • Take care when running a function or script more than once - depending on the steps it takes, it could create duplicate configuration entries and break your system!
  • When calling an optional script, the script path should be absolute, or relative to the current directory. This means that you can also run arbitrary scripts from outside the Retropie-Setup-Ubuntu directory structure if desired.

CHANGELOG

20200923

  • 20.04 promoted to master branch
  • Instructions for multiple 20.04 install methods, including autoinstall example
  • New bootstrap installation process
  • Customizations possible through pre_install and post_install script directories
  • Library of optional scripts
  • Log file is timestamped
  • Script runtime is now calculated
  • Prevent running as root user, only allow sudo as normal user
  • MANY THANKS TO @etheling FOR MULTIPLE RECOMMENDATIONS FOR THIS RELEASE!

20200521

  • Validated against Ubuntu 20.04 LTS
  • Verbose logging to both console and file
  • Improved modularity, formatting, and commenting of functions
  • Installs the same base packages as the official RetroPie image
  • Installs latest Intel video driver
  • Option to reboot after install
  • Disabled screen blanking
  • Safely enable 1080p resolution in GRUB, if available - user can override resolution in script
  • Safely enable 1080p resolution in X Windows, if available - user can override resolution in script
  • MANY THANKS TO @movisman FOR HIS CODE OPTIMIZATION AND NEW FUNCTIONS!

20190728

  • Changed name to reflect support for both Server and Mini versions of Ubuntu
  • Addded retropie.preseed file to standardize basic OS install & config
  • Installs the basic_install RetroPie meta-package, rather than its individual parts
  • Improved hiding of boot messages
  • Updated autostart logic, moved EmaulationStation launch into RetroPie's autostart.sh file
  • Enabled install of updated video drivers and Vulkan by default
  • Removed install of Ultimarc-linux and RetroPie launchingimages package.

20190530

  • Initial release

About

Scripts to automate the installation on RetroPie on Ubuntu


Languages

Language:Shell 100.0%