7 # Every package should define these variables
8 $pkg_cmd_name = "awless"
10 $pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\awless.exe"
11 $pkg_dst_bin = "$Env:USERPROFILE\.local\bin"
12 $pkg_dst = "$pkg_dst_cmd"
14 $pkg_src_cmd = "$Env:USERPROFILE\.local\opt\awless-v$Env:WEBI_VERSION\bin\awless.exe"
15 $pkg_src_bin = "$Env:USERPROFILE\.local\opt\awless-v$Env:WEBI_VERSION\bin"
16 $pkg_src_dir = "$Env:USERPROFILE\.local\opt\awless-v$Env:WEBI_VERSION"
17 $pkg_src = "$pkg_src_cmd"
19 $pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
22 IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE")) {
23 # TODO: arch detection
24 echo "Downloading awless from $Env:WEBI_PKG_URL to $pkg_download"
25 & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
26 & move "$pkg_download.part" "$pkg_download"
29 IF (!(Test-Path -Path "$pkg_src_cmd")) {
30 echo "Installing awless"
32 # TODO: create package-specific temp directory
36 # Remove any leftover tmp cruft
37 Remove-Item -Path ".\awless-v*" -Recurse -ErrorAction Ignore
38 Remove-Item -Path ".\awless.exe" -Recurse -ErrorAction Ignore
40 # Unpack archive file into this temporary directory
41 # Windows BSD-tar handles zip. Imagine that.
42 echo "Unpacking $pkg_download"
43 & tar xf "$pkg_download"
45 # Settle unpacked archive into place
46 echo "Install Location: $pkg_src_cmd"
47 New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
48 Move-Item -Path ".\awless.exe" -Destination "$pkg_src_bin"
54 echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
55 Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
56 New-Item "$pkg_dst_bin" -ItemType Directory -Force | out-null
57 Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse