Add script for installing dependencies
This commit is contained in:
		
				
					committed by
					
						
						Jeremy Soller
					
				
			
			
				
	
			
			
			
						parent
						
							2ac214352b
						
					
				
				
					commit
					55b6256ed6
				
			
							
								
								
									
										11
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								README.md
									
									
									
									
									
								
							@@ -13,15 +13,8 @@ laptops.
 | 
			
		||||
 | 
			
		||||
## Dependencies
 | 
			
		||||
 | 
			
		||||
The complete set of dependencies can be installed using the `deps.sh` script
 | 
			
		||||
from the [Open Firmware](https://github.com/system76/firmware-open) repo.
 | 
			
		||||
 | 
			
		||||
Dependencies specific to EC development can be installed with:
 | 
			
		||||
Install dependencies using the provided script:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo apt install \
 | 
			
		||||
  avr-libc \
 | 
			
		||||
  avrdude \
 | 
			
		||||
  gcc-avr \
 | 
			
		||||
  sdcc
 | 
			
		||||
./scripts/deps.sh
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										56
									
								
								scripts/deps.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										56
									
								
								scripts/deps.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-only
 | 
			
		||||
 | 
			
		||||
set -eE
 | 
			
		||||
 | 
			
		||||
function msg {
 | 
			
		||||
  echo -e "\x1B[1m$*\x1B[0m" >&2
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
trap 'msg "\x1B[31mFailed to install dependencies!"' ERR
 | 
			
		||||
 | 
			
		||||
source /etc/os-release
 | 
			
		||||
 | 
			
		||||
msg "Installing system build dependencies"
 | 
			
		||||
if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
 | 
			
		||||
    sudo apt-get install \
 | 
			
		||||
        --no-install-recommends \
 | 
			
		||||
        --yes \
 | 
			
		||||
        avr-libc \
 | 
			
		||||
        avrdude \
 | 
			
		||||
        curl \
 | 
			
		||||
        gcc-avr \
 | 
			
		||||
        make \
 | 
			
		||||
        sdcc
 | 
			
		||||
elif [[ "${ID}" =~ "fedora" ]] || [[ "${ID_LIKE}" =~ "fedora" ]]; then
 | 
			
		||||
    sudo dnf install \
 | 
			
		||||
        --assumeyes \
 | 
			
		||||
        avr-gcc \
 | 
			
		||||
        avr-libc \
 | 
			
		||||
        avrdude \
 | 
			
		||||
        curl \
 | 
			
		||||
        make \
 | 
			
		||||
        sdcc
 | 
			
		||||
else
 | 
			
		||||
    msg "Please add support for your distribution to:"
 | 
			
		||||
    msg "scripts/deps.sh"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
msg "Initializing submodules"
 | 
			
		||||
git submodule update --init --recursive
 | 
			
		||||
 | 
			
		||||
msg "Installing Rust"
 | 
			
		||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
 | 
			
		||||
  | sh -s -- -y --default-toolchain nightly
 | 
			
		||||
 | 
			
		||||
msg "Loading Rust environment"
 | 
			
		||||
source "${HOME}/.cargo/env"
 | 
			
		||||
 | 
			
		||||
msg "Installing pinned Rust toolchain"
 | 
			
		||||
rustup toolchain install "$(cat rust-toolchain)"
 | 
			
		||||
 | 
			
		||||
msg "Installing source for pinned Rust toolchain"
 | 
			
		||||
rustup component add --toolchain "$(cat rust-toolchain)" rust-src
 | 
			
		||||
 | 
			
		||||
msg "\x1B[32mSuccessfully installed dependencies"
 | 
			
		||||
		Reference in New Issue
	
	Block a user