-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrunch-setup.sh
66 lines (49 loc) · 2.03 KB
/
brunch-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# Script to setup a Brunch ISO and flash it to a USB
# Check if script is being ran as root
#if [ "$EUID" -ne 0 ]
# then echo "Please run this script as root (sudo at the start of it)."
# exit
#fi
# CD to the home directory - just in case
mkdir ~/Downloads
cd ~/Downloads
# This isn't strictly neccessary but is good system maintenance
sudo apt -y upgrade
sudo apt -y update
# Install a few apt packages for building the Brunch ISO
sudo apt -y install pv tar cgpt wget unzip
# Check if the zip file is not downloaded; if so do it
if [ ! -f hatch-kohaku.zip ]; then
# Important for debugging
echo "Hatch image file not downloaded; downloading now..."
# Curl the latest hatch image URL from a Github Gist
hatchUrl=$(curl https://gist.githubusercontent.com/MilkyDeveloper/505b23bd60ccb52cc7f8fcf9ae8251cb/raw/736556ee8a7558b0cc3c3ab20cf6970e58615480/hatch-url)
# And now just download it with wget
wget -O hatch-kohaku.zip $hatchUrl
fi
# Unzip our file (specify -o to overwrite all files - no user input required)
# This method of detecting the zip is pretty fuzzy but fine for normal use
#if [ ! -f chrome ]; then
# unzip -o hatch-kohaku.zip
#fi
# However, Wildcards need a different method
if compgen -G "*.bin" > /dev/null; then
echo "Image already has been unzipped, continuing."
else
echo "Image has not been unzipped, unzipping now."
unzip -o hatch-kohaku.zip
fi
# Now that we've unzipped the image, we can use ls and some wilcards to find the name
chromeosLoc=$(ls chromeos_*.bin)
# Check if we've already download the brunch image, if not do so
if [ ! -f brunch.tar.gz ]; then
# Curl the latest brunch URL from a Github Gist
brunchUrl=$(curl https://gist.githubusercontent.com/MilkyDeveloper/ae6262bb02cd75d3296c8510012e71d7/raw/cfd606be25cb97e55ad6a020883c845f749ab9fa/brunch-url)
# And now just download it with wget
wget -O brunch.tar.gz $brunchUrl
# Unzip it
tar zxvf brunch.tar.gz
fi
# And now finally run brunch
sudo bash chromeos-install.sh -src $chromeosLoc -dst brunch-chromeos.bin