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

is there any support or way to use for .7z files? #235

Closed
candrapersada opened this issue Oct 23, 2024 · 21 comments
Closed

is there any support or way to use for .7z files? #235

candrapersada opened this issue Oct 23, 2024 · 21 comments

Comments

@candrapersada
Copy link

candrapersada commented Oct 23, 2024

is there any support or way to use --install for .7z files?
and how to use for ffmpeg.exe ffplay.exe and ffprobe.exe one download?

@devmatteini
Copy link
Owner

Hi @candrapersada!

is there any support or way to use --install for .7z files?

Currently no, but I think it can be added.
Can you share repositories that distribute .7z files in their releases?

and how to use for ffmpeg.exe ffplay.exe and ffprobe.exe one download?

I'm not sure what you mean. If you want to download and install executable files check out examples

@devmatteini
Copy link
Owner

devmatteini commented Oct 27, 2024

Hi @candrapersada! You can download latest release 0.6.3 to install from 7-Zip files.

In order to work, you need to install 7z and make sure it's available in your PATH.

Let me know if there are any issues!

@candrapersada
Copy link
Author

how to update from 0.6.2 to 0.6.3?

@devmatteini
Copy link
Owner

@candrapersada
Copy link
Author

candrapersada commented Oct 29, 2024

will there be a feature to update dra easily without manually moving ./dra new somewhere in PATH?

@devmatteini
Copy link
Owner

I don't think so. The way you update dra depends on how you installed it, and dra doesn't know how you installed it.

If you used a package manager, like Homebrew or pacman, use that to update dra.
If you installed a prebuild binary, you have to do the commands I explained before.
If you installed a debain package, you have to download and install it.

@candrapersada
Copy link
Author

dra download -a -i devmatteini/dra
./dra --version
# should print 0.6.3
Error copying C:\Users\Username\AppData\Local\Temp\dra-9234acf0aee64a40ad801a7fb1eaf858\dra-0.6.3-x86_64-pc-windows-msvc\dra.exe to C:\Users\Username\bin\dra.exe:
  The process cannot access the file because it is being used by another process. (os error 32)

@devmatteini
Copy link
Owner

I suppose you are in this directory: C:\Users\Username\bin where dra is located.

You cannot replace dra with a new version while the dra process is running.

You need to go to another directory, run the dra command I told you and then move the new dra.exe to C:\Users\Username\bin

@candrapersada
Copy link
Author

candrapersada commented Oct 29, 2024

is it possible to add dra-x86_64-pc-windows-msvc.zip without the version number in the release so I can use this
curl -L "https://github.com/devmatteini/dra/releases/latest/download/dra-x86_64-pc-windows-msvc.zip" -o "dra-x86_64-pc-windows-msvc.zip"
to download if dra is not on PATH?
like curl -L "https://github.com/devmatteini/dra-tests/releases/latest/download/helloworld.zip" -o "helloworld.zip"

@devmatteini
Copy link
Owner

I use this on linux for the first time dra installation: https://github.com/devmatteini/dotfiles/blob/7fe2d8af46e21364386c8bbc9850576226ed2289/bootstrap/dependencies.sh#L18-L23

You can modify it to work on windows.

To update it I use dra download -a -i devmatteini/dra && mv dra ~/.local/bin

@candrapersada
Copy link
Author

  # Download latest linux musl release asset (https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8)
  curl -s https://api.github.com/repos/devmatteini/dra/releases/latest \
  | grep "browser_download_url.*x86_64-unknown-linux-musl" \
  | cut -d : -f 2,3 \
  | tr -d \" \
  | wget -O "$ARCHIVE" -i -

how to use in windows?

@devmatteini
Copy link
Owner

In git bash you can use it like this:

curl -s https://api.github.com/repos/devmatteini/dra/releases/latest \
  | grep "browser_download_url.*x86_64-pc-windows-msvc" \
  | cut -d : -f 2,3 \
  | tr -d \" \
  | xargs -I {} curl -Lo dra.zip {}

I don't use windows very often so I can't help you with powershell or command prompt.

But again I'm not quite sure what you are trying to solve. If you try to explain your problem, maybe I can help you.

@candrapersada
Copy link
Author

candrapersada commented Oct 30, 2024

install and update dra without using a browser by using a .bat file or .sh file

@devmatteini
Copy link
Owner

If you use a .sh file, use the above script:

curl -s https://api.github.com/repos/devmatteini/dra/releases/latest \
  | grep "browser_download_url.*x86_64-pc-windows-msvc" \
  | cut -d : -f 2,3 \
  | tr -d \" \
  | xargs -I {} curl -Lo dra.zip {}

This will install and update dra to the latest version available.

@candrapersada
Copy link
Author

candrapersada commented Oct 30, 2024

how to use wget curl script

function download {
    url=$1
    filename=$2

    if [ -x "$(which wget)" ] ; then
        wget -q $url -O $2
    elif [ -x "$(which curl)" ]; then
        curl -o $2 -sfL $url
    else
        echo "Could not find curl or wget, please install one." >&2
    fi
}
# to use in the script:
download https://url /local/path/to/download

from linux or windows

@devmatteini
Copy link
Owner

function download_dra() {
  filename=$1

  TMP_DIR=$(mktemp --directory)
  ARCHIVE="$TMP_DIR/dra.zip"

  curl -s https://api.github.com/repos/devmatteini/dra/releases/latest \
  | grep "browser_download_url.*x86_64-pc-windows-msvc" \
  | cut -d : -f 2,3 \
  | tr -d \" \
  | xargs -I {} curl -Lo "$ARCHIVE" {}

  unzip -j "$ARCHIVE" -d "$TMP_DIR"
  mv "$TMP_DIR"/dra.exe "$filename"
}

download_dra "/some/path/to/dra.exe"

Once you have dra installed, you can you use it to download other tools from GitHub.

@candrapersada
Copy link
Author

candrapersada commented Oct 30, 2024

what I mean is Trying to do a script to download a file using wget, or curl if wget doesn't exist in Linux and Windows. How do I have the script check for existence of wget?

    if [ -x "$(which wget)" ] ; then
        wget -q $url -O $2
    elif [ -x "$(which curl)" ]; then
        curl -o $2 -sfL $url
    else
        echo "Could not find curl or wget, please install one." >&2
    fi

download_dra

@devmatteini
Copy link
Owner

You should search that question on google:
https://stackoverflow.com/questions/592620/how-can-i-check-if-a-program-exists-from-a-bash-script

If you have questions related to dra I will help you further, otherwise sorry but I don't have time to help you.

@candrapersada
Copy link
Author

how to clean TMP_DIR aftar download

@devmatteini
Copy link
Owner

You don't have to. Temporary files are deleted automatically on a regular basis

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

No branches or pull requests

2 participants