Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script #1

Open
wants to merge 61 commits into
base: main
Choose a base branch
from
Open

Add script #1

wants to merge 61 commits into from

Conversation

DelevoXDG
Copy link
Contributor

@DelevoXDG DelevoXDG commented Dec 16, 2024

starknetup.sh Outdated Show resolved Hide resolved
@DelevoXDG DelevoXDG requested a review from THenry14 January 24, 2025 09:40
starknetup.sh Outdated Show resolved Hide resolved
starknetup.sh Outdated Show resolved Hide resolved
starknetup.sh Outdated Show resolved Hide resolved
starknetup.sh Outdated Show resolved Hide resolved
starknetup.sh Outdated Show resolved Hide resolved
starknetup.sh Outdated Show resolved Hide resolved
fi
}

assert_not_installed_outside_asdf() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function's body seems overcomplicated for what it is supposed to do.

Copy link
Contributor Author

@DelevoXDG DelevoXDG Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure it is? Do you have any simplifications in mind?

I think the sh syntax might make it appear so, but we have pretty simple logic there IMO

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For starters you can try to hold a list of tools, cmds and instructions in variables you iterate over. That way you could simplify the outer for loop and get rid of the case conditional. Like this:

    local installed_tools=""
    local tools=("scarb" "starknet-foundry")
    local tool_cmds=("scarb" "snforge sncast")
    local uninstall_instructions=("$SCARB_UNINSTALL_INSTRUCTIONS" "$STARKNET_FOUNDRY_UNINSTALL_INSTRUCTIONS")

    for i in "${!tools[@]}"; do
        local tool=${tools[i]}
        local cmds=${tool_cmds[i]}
        local uninst_instructions=${uninstall_instructions[i]}

        if ! check_asdf_plugin_installed "$tool"; then
        (.....)

not sure you can do something about nested if-for-if, probably not much

@maciektr
Copy link
Collaborator

When run with

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/software-mansion/starknetup/4ad983fcf34306ea3f809f0be98a2f5804223118/starknetup.sh | bash

I get

root@fa7d42801b6b:/# curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/software-mansion/starknetup/4ad983fcf34306ea3f809f0be98a2f5804223118/starknetup.sh | bash
starknetup: asdf-vm is required. Do you want to install it now? (y/N):
starknetup: cancelled asdf-vm installation. Please install it manually and re-run this script. For installation instructions, refer to https://asdf-vm.com/guide/getting-started.html.

But I cannot choose "yes" - it goes straight to the second message.

curl -sS --fail "https://api.github.com/repos/${_repo}/releases/latest" | awk -F'"' '/"tag_name"/ {print $4}'
}

install_universal_sierra_compiler() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what I am doing wrong, but USC does not seem to be installed? 🤔

root@fa7d42801b6b:/# bash install.sh
Location of scarb plugin: /root/.asdf/plugins/scarb
Updating scarb to main
Already on 'main'
Your branch is up to date with 'origin/main'.
scarb 2.9.2 is already installed
Location of starknet-foundry plugin: /root/.asdf/plugins/starknet-foundry
Updating starknet-foundry to main
Already on 'main'
Your branch is up to date with 'origin/main'.
redirect url: https://github.com/foundry-rs/starknet-foundry/releases/tag/v0.36.0
starknet-foundry 0.36.0 is already installed
redirect url: https://github.com/foundry-rs/starknet-foundry/releases/tag/v0.36.0
starknetup: Installation complete. Run 'source /root/.bashrc' or start a new terminal session to use the installed tools.
root@fa7d42801b6b:/# source /root/.bashrc
root@fa7d42801b6b:/# universal-sierra-compiler
bash: universal-sierra-compiler: command not found

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be caused by:

root@fa7d42801b6b:/# curl -sSL --fail https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh
Downloading and extracting universal-sierra-compiler-v2.3.0-aarch64-unknown-linux-gnu...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 3314k  100 3314k    0     0  3006k      0  0:00:01  0:00:01 --:--:-- 11.3M
universal-sierra-compiler: could not detect shell, manually add /root/.local/bin to your PATH.

But the error msg is not shown to the user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Starknetup installation script
4 participants