mvp
This commit is contained in:
		
							parent
							
								
									61b773ac6d
								
							
						
					
					
						commit
						c402593a34
					
				
					 6 changed files with 77 additions and 53 deletions
				
			
		
							
								
								
									
										24
									
								
								tools/download-sdk.nu
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								tools/download-sdk.nu
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
#!/usr/bin/env nu
 | 
			
		||||
 | 
			
		||||
def main [version: string] {
 | 
			
		||||
  let sdk_path = $"~/.local/bin/PlaydateSDK-($version)" | path expand
 | 
			
		||||
  if ($sdk_path | path exists) {
 | 
			
		||||
    print $"SDK already installed at ($sdk_path)"
 | 
			
		||||
    return
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  let sdk_url = $"https://download.panic.com/playdate_sdk/Linux/PlaydateSDK-($version).tar.gz"
 | 
			
		||||
  let out_path = mktemp --tmpdir $"PlaydateSDK-($version)-XXX.tar.gz"
 | 
			
		||||
  
 | 
			
		||||
  http get $sdk_url | save --raw --progress --force $out_path
 | 
			
		||||
 | 
			
		||||
  let parent_dir = $sdk_path | path dirname
 | 
			
		||||
  mkdir $parent_dir
 | 
			
		||||
  let uncompress = tar xf $out_path --directory $parent_dir | complete
 | 
			
		||||
  if $uncompress.exit_code != 0 {
 | 
			
		||||
    print --stderr $uncompress.stderr
 | 
			
		||||
    exit 1
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  run-external sudo $"($sdk_path)/setup.sh"
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue