dra icon indicating copy to clipboard operation
dra copied to clipboard

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

Open candrapersada opened this issue 1 year ago • 2 comments

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?

candrapersada avatar Oct 23 '24 03:10 candrapersada

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 avatar Oct 23 '24 12:10 devmatteini

https://github.com/AnimMouse/ffmpeg-stable-autobuild/releases/download/2024-10-05-20-03-a319c0f-7.1/ffmpeg-7.1-a319c0f-win64-nonfree.7z

https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/20241023/mpv-x86_64-20241023-git-165159f.7z

https://github.com/FreeTubeApp/FreeTube/releases/download/v0.21.3-beta/freetube-0.21.3-win-x64-portable.7z

candrapersada avatar Oct 23 '24 12:10 candrapersada

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!

devmatteini avatar Oct 27 '24 18:10 devmatteini

how to update from 0.6.2 to 0.6.3?

candrapersada avatar Oct 28 '24 04:10 candrapersada

  • You download dra the same way as the first time (https://github.com/devmatteini/dra#installation)
  • You can use dra to update itself:
    dra download -a -i devmatteini/dra
    ./dra --version
    # should print 0.6.3
    
    Remember to move ./dra somewhere in your PATH

devmatteini avatar Oct 28 '24 08:10 devmatteini

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

candrapersada avatar Oct 29 '24 02:10 candrapersada

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.

devmatteini avatar Oct 29 '24 08:10 devmatteini

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)

candrapersada avatar Oct 29 '24 09:10 candrapersada

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

devmatteini avatar Oct 29 '24 12:10 devmatteini

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"

candrapersada avatar Oct 29 '24 13:10 candrapersada

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

devmatteini avatar Oct 29 '24 13:10 devmatteini

  # 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?

candrapersada avatar Oct 29 '24 13:10 candrapersada

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.

devmatteini avatar Oct 29 '24 18:10 devmatteini

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

candrapersada avatar Oct 30 '24 01:10 candrapersada

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.

devmatteini avatar Oct 30 '24 08:10 devmatteini

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

candrapersada avatar Oct 30 '24 08:10 candrapersada

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.

devmatteini avatar Oct 30 '24 20:10 devmatteini

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

candrapersada avatar Oct 30 '24 21:10 candrapersada

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.

devmatteini avatar Oct 30 '24 22:10 devmatteini

how to clean TMP_DIR aftar download

candrapersada avatar Oct 30 '24 22:10 candrapersada

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

devmatteini avatar Oct 30 '24 22:10 devmatteini