Last active
June 5, 2020 07:37
-
-
Save voodoojello/4f992213d0043d131ac3 to your computer and use it in GitHub Desktop.
A simple Bash script for caching and testing Ubuntu Touch channels on Nexus devices. See https://developer.ubuntu.com/en/start/ubuntu-for-devices/installing-ubuntu-for-devices/ for dependencies.
This file contains 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 | |
# | |
# ubuntu-touch-tester.sh | |
# | |
# A simple script to cache and install available | |
# Ubuntu Touch images on select Nexus devices. | |
# | |
# For more info see: | |
# https://developer.ubuntu.com/en/start/ubuntu-for-devices/devices/ | |
# | |
# For dependencies see: | |
# https://developer.ubuntu.com/en/start/ubuntu-for-devices/installing-ubuntu-for-devices/ | |
# | |
# modified: Sun Nov 29 07:39:49 CST 2015 | |
# author: mark page [m.e.page_at_gmail.com] | |
# | |
declare -a devices=( mako flo manta ); | |
declare -a channels=( devel-proposed devel rc-proposed rc stable ); | |
clear | |
echo "========================================" | |
echo " Ubuntu Touch Tester" | |
echo "========================================" | |
echo | |
echo "Available Devices" | |
echo | |
echo " [1] Nexus 4 (mako)" | |
echo " [2] Nexus 7 2013 (flo)" | |
echo " [3] Nexus 10 (manta)" | |
echo | |
echo -n "Select Device: " | |
read device | |
if ! [[ ${device} =~ ^[1-3]$ ]]; then | |
echo | |
echo "Invalid option, exiting..." | |
echo | |
exit 1 | |
fi | |
for i in ${channels[@]}; do | |
clear | |
echo "Channel: \"$i\" for device \"${devices[$device-1]}\" (update cache only)..." | |
echo | |
sudo ubuntu-device-flash --download-only touch --device=${devices[$device-1]} --channel=ubuntu-touch/$i/ubuntu --bootstrap | |
sleep 5 | |
done | |
clear | |
echo | |
echo "Available Channels (${devices[$device-1]})" | |
echo | |
echo " [1] devel-proposed" | |
echo " [2] devel" | |
echo " [3] rc-proposed" | |
echo " [4] rc" | |
echo " [5] stable" | |
echo | |
echo -n "Select Channel: " | |
read channel | |
if ! [[ ${channel} =~ ^[1-5]$ ]]; then | |
echo | |
echo "Invalid option, exiting..." | |
echo | |
exit 1 | |
fi | |
clear | |
echo "===================================================" | |
echo " WARNING: This will *completely* wipe your device! " | |
echo " Are you absolutely sure you want to do this? " | |
echo "===================================================" | |
echo -n "Type \"yes\" and hit [ENTER] to continue: " | |
read confirm | |
if [ -z "${confirm}" ] || [ "${confirm}" != 'yes' ]; then | |
echo | |
echo "User cancelled, exiting..." | |
echo | |
exit 1 | |
fi | |
clear | |
echo "Formatting \"system\"" | |
sudo fastboot format system | |
clear | |
echo "Formatting \"userdata\"" | |
sudo fastboot format userdata | |
clear | |
echo "Formatting \"cache\"" | |
sudo fastboot format cache | |
clear | |
echo "Flashing device..." | |
sudo ubuntu-device-flash -v touch --channel=ubuntu-touch/${channels[$channel-1]}/ubuntu --bootstrap | |
exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment