bugfix(shfmt) update install.ps1 (fix #314)
authorliudonghua <liudonghua123@gmail.com>
Wed, 17 Nov 2021 03:29:20 +0000 (11:29 +0800)
committerAJ ONeal <aj@therootcompany.com>
Sun, 21 Nov 2021 03:51:34 +0000 (03:51 +0000)
shfmt/install.ps1

index 5811886bc637705323be33b6dbce62eeaf068eeb..447d70d4c9153aa41d4f171c9c9dcfbb72ad3695 100644 (file)
@@ -27,18 +27,20 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
 IF (!(Test-Path -Path "$pkg_src_cmd"))
 {
     echo "Installing shfmt"
-    pushfmtd .local\tmp
+    
+    # TODO: create package-specific temp directory
+    # Enter tmp
+    pushd .local\tmp
 
-        Remove-Item -Path ".\shfmt-v*" -Recurse -ErrorAction Ignore
-        Remove-Item -Path ".\shfmt.exe" -Recurse -ErrorAction Ignore
-
-        echo "Unpacking $pkg_download"
-        & tar xf "$pkg_download"
+        # Move single binary into root of temporary folder
+        & move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" "shfmt.exe"
 
+        # Settle unpacked archive into place
         echo "Install Location: $pkg_src_cmd"
         New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
-        Move-Item -Path ".\shfmt-*\shfmt.exe" -Destination "$pkg_src_bin"
+        Move-Item -Path "shfmt.exe" -Destination "$pkg_src_bin"
 
+    # Exit tmp
     popd
 }