7 # Every package should define these variables
8 $pkg_cmd_name = "gitea"
10 $pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\gitea.exe"
11 $pkg_dst = "$pkg_dst_cmd"
13 $pkg_src_cmd = "$Env:USERPROFILE\.local\opt\gitea-v$Env:WEBI_VERSION\bin\gitea.exe"
14 $pkg_src_bin = "$Env:USERPROFILE\.local\opt\gitea-v$Env:WEBI_VERSION\bin"
15 $pkg_src_dir = "$Env:USERPROFILE\.local\opt\gitea-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 echo "Downloading gitea from $Env:WEBI_PKG_URL to $pkg_download"
26 & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
27 & move "$pkg_download.part" "$pkg_download"
30 IF (!(Test-Path -Path "$pkg_src_cmd"))
32 echo "Installing gitea"
34 # TODO: create package-specific temp directory
38 # Remove any leftover tmp cruft
39 Remove-Item -Path ".\gitea-*" -Recurse -ErrorAction Ignore
40 Remove-Item -Path ".\gitea.exe" -Recurse -ErrorAction Ignore
42 # Move single binary into root of temporary folder
43 & move "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" "gitea.exe"
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 "gitea.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 Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse