7 # Every package should define these variables
8 $pkg_cmd_name = "delta"
10 $pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\delta.exe"
11 $pkg_dst = "$pkg_dst_cmd"
13 $pkg_src_cmd = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION\bin\delta.exe"
14 $pkg_src_bin = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION\bin"
15 $pkg_src_dir = "$Env:USERPROFILE\.local\opt\delta-v$Env:WEBI_VERSION"
16 $pkg_src = "$pkg_src_cmd"
18 New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
19 $pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
22 IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
24 # TODO: arch detection
25 # useragent -A was causing download to fail at 1kb
26 echo "Downloading delta from $Env:WEBI_PKG_URL to $pkg_download"
27 & curl.exe -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
28 & move "$pkg_download.part" "$pkg_download"
31 IF (!(Test-Path -Path "$pkg_src_cmd"))
33 echo "Installing delta"
35 # TODO: create package-specific temp directory
39 # Remove any leftover tmp cruft
40 Remove-Item -Path ".\delta-v*" -Recurse -ErrorAction Ignore
41 Remove-Item -Path ".\delta.exe" -Recurse -ErrorAction Ignore
43 # Unpack archive file into this temporary directory
44 # Windows BSD-tar handles zip. Imagine that.
45 echo "Unpacking $pkg_download"
46 & tar xf "$pkg_download"
48 # Settle unpacked archive into place
49 echo "Install Location: $pkg_src_cmd"
50 New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
51 Move-Item -Path ".\delta-*\delta.exe" -Destination "$pkg_src_bin"
57 echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
58 Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
59 Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse