Skip to content

Commit

Permalink
added fix for files (#67)
Browse files Browse the repository at this point in the history
Signed-off-by: vviveksharma <[email protected]>
  • Loading branch information
vviveksharma authored Aug 14, 2024
1 parent 144866f commit 577b1f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion services/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ func (server *ApiService) downloadLinuxScript(c *fiber.Ctx) error {
params.LicenseId = ""
}
filePath := "../templates/install.sh.tmpl"
resp, err := server.TemplateRenderer.GetScript(c.Hostname(), params, filePath)
resp, err := server.TemplateRenderer.GetScript(c.BaseURL(), params, filePath)
if err != nil {
return err
}
Expand Down
7 changes: 6 additions & 1 deletion templates/install.ps1.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,12 @@ function Install-Project {
$request = Invoke-WebRequest -Uri $download_url -MaximumRedirection 0 -ErrorAction Ignore
$sourceFileLocation = $request.Headers.Location
$sourceFileName = $sourceFileLocation.SubString($sourceFileLocation.LastIndexOf('/') + 1)
$download_destination = join-path $download_directory $sourceFileName
if (-not [string]::IsNullOrEmpty($filename) -and $filename -ne "download") {
$download_destination = join-path $download_directory $filename
}
else {
$download_destination = join-path $download_directory $sourceFileName
}

if ((test-path $download_destination)) {
Write-Verbose "Found existing installer at $download_destination."
Expand Down
4 changes: 2 additions & 2 deletions templates/install.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ if test "x$download_url_override" = "x"; then
echo "Getting information for $project $channel $version for $platform..."

metadata_filename="$tmp_dir/metadata.txt"
metadata_url="https://{{.BaseUrl}}/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine{{if .LicenseId}}&license_id={{.LicenseId}}{{end}}"
metadata_url="{{.BaseUrl}}/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine{{if .LicenseId}}&license_id={{.LicenseId}}{{end}}"

do_download "$metadata_url" "$metadata_filename"
meta_response=$(cat "$metadata_filename")
Expand Down Expand Up @@ -720,7 +720,7 @@ fi
# $download_filename: Name of the downloaded file on local disk.
# $filetype: Type of the file downloaded.
############
filenameurl="https://{{.BaseUrl}}/$channel/$project/fileName?v=$version&p=$platform&pv=$platform_version&m=$machine{{if .LicenseId}}&license_id={{.LicenseId}}{{end}}"
filenameurl="{{.BaseUrl}}/$channel/$project/fileName?v=$version&p=$platform&pv=$platform_version&m=$machine{{if .LicenseId}}&license_id={{.LicenseId}}{{end}}"
filepath="$tmp_dir/filename.txt"
do_download $filenameurl $filepath
# filename=`echo $download_url | sed -e 's/?.*//' | sed -e 's/^.*\///'`
Expand Down

0 comments on commit 577b1f8

Please sign in to comment.