espup icon indicating copy to clipboard operation
espup copied to clipboard

Setup user environment

Open SergioGasquez opened this issue 1 year ago • 0 comments

This PR basically copies how rustup handles the user environment modification.

  • Added a --no-modify-env flag that avoids modifying the user environment.
  • In Unix systems, we will try to detect the available shells, and write the source command in the shell rc files.
    • Uninstall command will clear the rc files too.
    • Two exports scripts, .sh and .fish are generated $HOME/.rustup/toolchain/<esp_toolchain>
      • In case the user is using the --no-modify-env flag, he needs to source one of these files.
  • In Windows systems, we will set the proper environment variables, unless the -no-modify-env flag is used. (we already do this)
    • Uninstall command will remove the proper environment variables
    • Two export scripts, .bat and .ps1, are generated under $HOME/.rustup/toolchain/<esp_toolchain>
      • In case the user is using the --no-modify-env flag, he needs to source one of these files.
  • Adjusted the logs to be more like rustup

This would be the usual output of espup install for a Unix system:

[info]: Installing the Espressif Rust ecosystem
[info]: Checking Rust installation
[info]: Installing Xtensa Rust 1.73.0.1 toolchain
[info]: Installing Xtensa LLVM
[info]: Installing RISC-V Rust targets ('riscv32imc-unknown-none-elf' and 'riscv32imac-unknown-none-elf') for 'nightly' toolchain
[info]: Installing GCC (xtensa-esp-elf)
[info]: Installing GCC (riscv32-esp-elf)
[info]: Downloading 'rust.tar.xz'
[info]: Downloading 'xtensa-esp-elf.tar.xz'
[info]: Downloading 'idf_tool_xtensa_elf_clang.tar.xz'
[info]: Downloading 'riscv32-esp-elf.tar.xz'
[info]: Installing 'rust' component for Xtensa Rust toolchain
[info]: Downloading 'rust-src.tar.xz'
[info]: Installing 'rust-src' component for Xtensa Rust toolchain
[info]: Installation successfully completed!
        To get started you may need to restart your current shell.
        To configure your current shell, run:
        '. /home/esp/.rustup/toolchains/esp/env' or '. /home/esp/.rustup/toolchains/esp/env.fish' depending on your shell

SergioGasquez avatar Oct 21 '23 14:10 SergioGasquez