Automate downloading Linux binaries #3029
Comments
|
I did a quick look around and found these. |
|
@fdncred how would |
|
@wycats I haven't looked into it enough to know. These links are just starting points. More research is required. But I figure it would work like updating any other process that is in use. On Linux/Mac one could probably use |
|
very interesting. found here. #[cfg(unix)]
fn restart_process(current_exe: PathBuf, logger: &Logger) {
use std::os::unix::process::CommandExt as _;
logger.headline(&format!("Waiting 5s before restarting {:?} ...", current_exe));
thread::sleep(Duration::from_secs(5));
let err = std::process::Command::new(current_exe)
.args(std::env::args().into_iter().skip(1))
.exec();
panic!("Failed to restart: {}", err);
} |
|
@fdncred great job digging into this! |
|
While we're trying to figure out self-updating, could we create a |
|
Here's a start to a nushell script that could work. If def get-latest [] {
let metadata = $(fetch https://api.github.com/repos/nushell/nushell/releases/latest)
let release_name = $(echo $metadata | get name | split row ' ' | nth 0)
let body = $(echo $metadata | get body)
let asset_info = $(echo $metadata | get assets | where name =~ 'linux.tar.gz')
let download_url = $(echo $asset_info | get browser_download_url)
let file_name = $(echo $asset_info | get name)
echo $(build-string "Release name is " $release_name $(char newline) $(char newline))
echo $(build-string $body $(char newline) $(char newline) "Downloading...")
let redirected_url = $(fetch $download_url --raw)
let real_download_url = $(echo $redirected_url | xpath '//@href' | get '//@href')
fetch $real_download_url | save $file_name
# Remaining to do
# tar xf $file_name
# parse the $file_name to get the folder like going
# from: nu_0_27_0_linux.tar.gz
# to: nu_0_27_0_linux
# cp nu_0_27_0_linux/nushell-0.27.0/* ~/.cargo/bin
# exec ~/.cargo/bin/nu
} |
|
A different (but not competing) idea: how hard would it be to get nushell on Linux homebrew? |
Is your feature request related to a problem? Please describe.
Today, we make it very easy to get the binaries onto a Mac machine, but the same is not true about Linux. Instead, the Linux instructions ask the user to manually download the binaries from release and put them in an appropriate location. Speaking for myself, this is an annoying, somewhat error-prone process, and it tends to cause me to delay doing upgrades.
Describe the solution you'd like
Automate the process of downloading the binaries from the releases tab and copying them into
~/.local/bin.The main wrinkle is that updating a binary that is currently used as the shell doesn't "just work", and we need to find a solution to make that possible.
One possibility is to copy the binaries into
~/.local/share/nu. The next time nushell boots, if any binaries are found in~/.local/share/nu, exec a process that copies them into~/.local/bin, and then exec the newnubinary. There may be other canonical solutions to this problem, and we should of course use a canonical solution if one exists.Ideally, nushell would know how to update itself in the background, so that you wouldn't have to do anything other than use
nuas usual to get the updates.Describe alternatives you've considered
nuauto-update itself is pretty nice.The text was updated successfully, but these errors were encountered: