3 $VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
4 $EXENAME = "$Env:PKG_NAME.exe"
6 IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
9 echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
10 & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
11 & move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
14 IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
16 echo "Installing $Env:PKG_NAME"
17 # TODO: temp directory
22 # Remove any leftover tmp cruft
23 Remove-Item -Path "$Env:PKG_NAME-v*" -Recurse -ErrorAction Ignore
26 # Windows BSD-tar handles zip. Imagine that.
27 echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
28 & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
29 # Move single binary into root of temporary folder
30 & move "$EXENAME" "$VERNAME"
33 # Settle unpacked archive into place
34 echo "New Name: $VERNAME"
35 echo "New Location: $Env:USERPROFILE\.local\xbin\$VERNAME"
36 Move-Item -Path "$VERNAME" -Destination "$Env:USERPROFILE\.local\xbin"
42 echo "Copying into '$Env:USERPROFILE\.local\bin\$EXENAME' from '$Env:USERPROFILE\.local\xbin\$VERNAME'"
43 Remove-Item -Path "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse -ErrorAction Ignore
44 Copy-Item -Path "$Env:USERPROFILE\.local\xbin\$VERNAME" -Destination "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse