|
12 | 12 | unameOut="$(uname -s)" |
13 | 13 | case "${unameOut}" in |
14 | 14 | Linux*) |
15 | | - su -c "apt update && apt install sudo -y" |
16 | | - sudo apt install tzdata -y |
| 15 | + # Check the version of Linux |
| 16 | + if grep -q "Arch" /etc/os-release; then |
| 17 | + if [ "$CI" = "true" ]; then |
| 18 | + echo "Running in Docker Container." |
| 19 | + # Update the core and extra databases |
| 20 | + pacman -Sy --noconfirm |
| 21 | + pacman -S --noconfirm git wget flex bison gperf python python-pip python-setuptools cmake ninja ccache libffi openssl dfu-util libusb |
| 22 | + pacman -S --noconfirm python-virtualenv |
| 23 | + pacman -Syu --noconfirm |
| 24 | + else |
| 25 | + echo "Running on Arch Linux host." |
| 26 | + # Update the core and extra databases |
| 27 | + su -c "pacman -Sy" |
| 28 | + |
| 29 | + if [ -z "$(command -v sudo)" ]; then |
| 30 | + # Steps to be taken if sudo is not installed |
| 31 | + su -c "pacman -S --noconfirm sudo" |
| 32 | + su -c "usermod -aG wheel $USER" |
| 33 | + echo 'wheel ALL=(ALL:ALL) ALL' | su -c "EDITOR='tee -a' visudo" |
| 34 | + echo "Reboot and run this script again for changes to take place" |
| 35 | + exit 0 |
| 36 | + fi |
| 37 | + |
| 38 | + sudo pacman -S --noconfirm tzdata |
| 39 | + |
| 40 | + # Time to change the system time |
| 41 | + currentTimezone="$(readlink /etc/localtime)" |
| 42 | + sudo ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime |
| 43 | + sudo hwclock --systohc |
| 44 | + |
| 45 | + sudo groupadd -f uucp |
| 46 | + sudo usermod -aG uucp $USER || echo "Failed to add user to uucp group" |
| 47 | + sudo pacman -S --noconfirm git wget flex bison gperf python python-pip python-setuptools cmake ninja ccache libffi openssl dfu-util libusb |
| 48 | + sudo pacman -S --noconfirm python-virtualenv |
| 49 | + sudo pacman -Syu |
| 50 | + |
| 51 | + # Change system time back to original |
| 52 | + sudo ln -fs "$currentTimezone" /etc/localtime |
| 53 | + fi |
| 54 | + elif grep -q -E "Ubuntu|Debian" /etc/os-release; then |
| 55 | + |
| 56 | + echo "Running on Ubuntu host." |
| 57 | + su -c "apt update && apt install sudo -y" |
| 58 | + sudo apt install tzdata -y |
17 | 59 |
|
18 | | - # Set timezone non-interactively |
19 | | - export DEBIAN_FRONTEND=noninteractive |
20 | | - sudo ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime |
21 | | - echo "Etc/UTC" | sudo tee /etc/timezone > /dev/null |
22 | | - sudo dpkg-reconfigure --frontend noninteractive tzdata |
| 60 | + # Set timezone non-interactively |
| 61 | + export DEBIAN_FRONTEND=noninteractive |
| 62 | + sudo ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime |
| 63 | + echo "Etc/UTC" | sudo tee /etc/timezone > /dev/null |
| 64 | + sudo dpkg-reconfigure --frontend noninteractive tzdata |
23 | 65 |
|
24 | | - sudo usermod -aG dialout $USER || echo "Failed to add user to dialout group" |
25 | | - sudo apt install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 -y |
26 | | - sudo apt install python3-venv -y |
| 66 | + sudo usermod -aG dialout $USER || echo "Failed to add user to dialout group" |
| 67 | + sudo apt install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 -y |
| 68 | + sudo apt install python3-venv -y |
| 69 | + fi |
27 | 70 | ;; |
28 | 71 | Darwin*) |
29 | 72 | if brew --version | grep -q 'Homebrew'; then |
|
43 | 86 | pushd "$HOME"/esp || (echo "Error: Cannot Make Directory" && exit 1) |
44 | 87 |
|
45 | 88 | # Clone ESP-IDF Repository |
46 | | - git clone -b release/v5.1 --recursive https://github.com/espressif/esp-idf.git |
| 89 | + git clone -b release/v5.1 --recursive https://github.com/espressif/esp-idf.git --depth 1 |
47 | 90 | cd $HOME/esp/esp-idf |
48 | 91 | ./install.sh esp32 |
49 | 92 |
|
|
0 commit comments