windows package update
This commit is contained in:
parent
9e3f914a07
commit
302fab7309
7 changed files with 163 additions and 18 deletions
5
assets/package/NuGet.Config
Normal file
5
assets/package/NuGet.Config
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<configuration>
|
||||
<packageSources>
|
||||
<add key="InsecureSource" value="http://toki-labs.com:5001/v3/index.json" allowInsecureConnections="true" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -26,7 +26,7 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe
|
|||
<!-- version should MATCH as closely as possible with the underlying software -->
|
||||
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
|
||||
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
|
||||
<version>0.0.282</version>
|
||||
<version>0.0.287</version>
|
||||
<!-- <packageSourceUrl>Where is this Chocolatey package located (think GitHub)? packageSourceUrl is highly recommended for the community feed</packageSourceUrl>-->
|
||||
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
|
||||
<!--<owners>__REPLACE_YOUR_NAME__</owners>-->
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
$ErrorActionPreference = 'Stop' # Stop on all errors
|
||||
$ErrorActionPreference = 'Stop' # Stop on all errors
|
||||
|
||||
# Define the package arguments
|
||||
$packageArgs = @{
|
||||
packageName = $env:ChocolateyPackageName
|
||||
unzipLocation = Join-Path $env:LOCALAPPDATA 'com.toki-labs.oto'
|
||||
url = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.284.zip'
|
||||
url64bit = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.284.zip'
|
||||
url = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.287.zip'
|
||||
url64bit = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.287.zip'
|
||||
checksum = '' # Optional: Provide checksum if available
|
||||
checksumType = 'sha256' # Adjust if checksum is provided
|
||||
validExitCodes= @(0) # Only exit code 0 is considered valid
|
||||
|
|
@ -42,21 +42,19 @@ if (Test-Path -Path $otoPath) {
|
|||
|
||||
# Step 3: Execute startup script if it exists
|
||||
$startupScriptPath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto/startup/com.toki-labs.oto.ps1"
|
||||
$otoExePath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto/oto.exe"
|
||||
# $otoExePath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto/oto.exe"
|
||||
if (Test-Path $startupScriptPath) {
|
||||
Write-Host "Found startup script at $startupScriptPath."
|
||||
|
||||
if (Test-Path $otoExePath) {
|
||||
Write-Host "Found oto.exe at $otoExePath. Starting scheduler in background..."
|
||||
try {
|
||||
Start-Process -FilePath $otoExePath -ArgumentList "scheduler -s" -NoNewWindow -PassThru | Out-Null
|
||||
Write-Host "Successfully started oto.exe scheduler in background."
|
||||
} catch {
|
||||
Write-Host "Error starting oto.exe scheduler: $_"
|
||||
}
|
||||
} else {
|
||||
Write-Host "oto.exe not found at $otoExePath. Skipping scheduler start."
|
||||
}
|
||||
Write-Host "Found startup script at $startupScriptPath. Attempting to run as non-admin user..."
|
||||
|
||||
# 현재 시간 기준으로 1분 뒤의 시간 계산
|
||||
$currentTime = Get-Date
|
||||
$futureTime = $currentTime.AddMinutes(1).ToString("HH:mm")
|
||||
|
||||
# schtasks 명령어로 작업 생성 및 실행
|
||||
$taskName = "RunStartupScript_" + [guid]::NewGuid().ToString()
|
||||
schtasks /Create /F /RU "$env:USERNAME" /SC ONCE /ST $futureTime /TN $taskName /TR "powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"$startupScriptPath`""
|
||||
schtasks /Run /TN $taskName
|
||||
schtasks /Delete /F /TN $taskName
|
||||
} else {
|
||||
Write-Host "Startup script not found at $startupScriptPath. Skipping execution."
|
||||
}
|
||||
|
|
|
|||
62
assets/package/chocolateyinstall_template.ps1
Normal file
62
assets/package/chocolateyinstall_template.ps1
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
$ErrorActionPreference = 'Stop' # Stop on all errors
|
||||
|
||||
# Define the package arguments
|
||||
$packageArgs = @{
|
||||
packageName = $env:ChocolateyPackageName
|
||||
unzipLocation = Join-Path $env:LOCALAPPDATA 'com.toki-labs.oto'
|
||||
url = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v[VERSION].zip'
|
||||
url64bit = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v[VERSION].zip'
|
||||
checksum = '' # Optional: Provide checksum if available
|
||||
checksumType = 'sha256' # Adjust if checksum is provided
|
||||
validExitCodes= @(0) # Only exit code 0 is considered valid
|
||||
}
|
||||
|
||||
# Ensure the destination folder exists
|
||||
if (-Not (Test-Path -Path $packageArgs.unzipLocation)) {
|
||||
New-Item -ItemType Directory -Path $packageArgs.unzipLocation -Force | Out-Null
|
||||
}
|
||||
|
||||
# Use Chocolatey helper function to download and unzip the file
|
||||
Install-ChocolateyZipPackage `
|
||||
$packageArgs.packageName `
|
||||
$packageArgs.url `
|
||||
$packageArgs.unzipLocation `
|
||||
-url64 $packageArgs.url64bit `
|
||||
-checksum $packageArgs.checksum `
|
||||
-checksumType $packageArgs.checksumType
|
||||
|
||||
# Add the oto.exe to the PATH environment variable
|
||||
$otoPath = $packageArgs.unzipLocation
|
||||
if (Test-Path -Path $otoPath) {
|
||||
Write-Host "Adding $otoPath to the PATH environment variable..."
|
||||
$currentPath = [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User)
|
||||
if (-Not ($currentPath -split ';' | ForEach-Object { $_.Trim() } | Where-Object { $_ -ieq $otoPath })) {
|
||||
[System.Environment]::SetEnvironmentVariable('Path', "$currentPath;$otoPath", [System.EnvironmentVariableTarget]::User)
|
||||
Write-Host "oto.exe has been added to the PATH."
|
||||
} else {
|
||||
Write-Host "oto.exe is already in the PATH."
|
||||
}
|
||||
} else {
|
||||
Write-Host "Error: oto.exe not found in $packageArgs.unzipLocation."
|
||||
}
|
||||
|
||||
# Step 3: Execute startup script if it exists
|
||||
$startupScriptPath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto/startup/com.toki-labs.oto.ps1"
|
||||
# $otoExePath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto/oto.exe"
|
||||
if (Test-Path $startupScriptPath) {
|
||||
Write-Host "Found startup script at $startupScriptPath. Attempting to run as non-admin user..."
|
||||
|
||||
# 현재 시간 기준으로 1분 뒤의 시간 계산
|
||||
$currentTime = Get-Date
|
||||
$futureTime = $currentTime.AddMinutes(1).ToString("HH:mm")
|
||||
|
||||
# schtasks 명령어로 작업 생성 및 실행
|
||||
$taskName = "RunStartupScript_" + [guid]::NewGuid().ToString()
|
||||
schtasks /Create /F /RU "$env:USERNAME" /SC ONCE /ST $futureTime /TN $taskName /TR "powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"$startupScriptPath`""
|
||||
schtasks /Run /TN $taskName
|
||||
schtasks /Delete /F /TN $taskName
|
||||
} else {
|
||||
Write-Host "Startup script not found at $startupScriptPath. Skipping execution."
|
||||
}
|
||||
|
||||
Write-Host "Installation completed successfully!"
|
||||
2
assets/package/oto_install.bat
Normal file
2
assets/package/oto_install.bat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
choco source add -n="oto" -s="http://toki-labs.com:5001/v3/index.json"
|
||||
choco install oto --source="oto"
|
||||
77
assets/package/oto_template.nuspec
Normal file
77
assets/package/oto_template.nuspec
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Read this before creating packages: https://docs.chocolatey.org/en-us/create/create-packages -->
|
||||
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://community.chocolatey.org/packages). -->
|
||||
|
||||
<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment -->
|
||||
|
||||
<!--
|
||||
This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Reference. Chocolatey uses a special version of NuGet.Core that allows us to do more than was initially possible. As such there are certain things to be aware of:
|
||||
|
||||
* the package xmlns schema url may cause issues with nuget.exe
|
||||
* Any of the following elements can ONLY be used by choco tools - projectSourceUrl, docsUrl, mailingListUrl, bugTrackerUrl, packageSourceUrl, provides, conflicts, replaces
|
||||
* nuget.exe can still install packages with those elements but they are ignored. Any authoring tools or commands will error on those elements
|
||||
-->
|
||||
|
||||
<!-- You can embed software files directly into packages, as long as you are not bound by distribution rights. -->
|
||||
<!-- * If you are an organization making private packages, you probably have no issues here -->
|
||||
<!-- * If you are releasing to the community feed, you need to consider distribution rights. -->
|
||||
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
|
||||
<metadata>
|
||||
<!-- == PACKAGE SPECIFIC SECTION == -->
|
||||
<!-- This section is about this package, although id and version have ties back to the software -->
|
||||
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
|
||||
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
|
||||
<id>oto</id>
|
||||
<!-- version should MATCH as closely as possible with the underlying software -->
|
||||
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
|
||||
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
|
||||
<version>[VERSION]</version>
|
||||
<!-- <packageSourceUrl>Where is this Chocolatey package located (think GitHub)? packageSourceUrl is highly recommended for the community feed</packageSourceUrl>-->
|
||||
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
|
||||
<!--<owners>__REPLACE_YOUR_NAME__</owners>-->
|
||||
<!-- ============================== -->
|
||||
|
||||
<!-- == SOFTWARE SPECIFIC SECTION == -->
|
||||
<!-- This section is about the software itself -->
|
||||
<title>oto (Install)</title>
|
||||
<authors>toki</authors>
|
||||
<!-- projectUrl is required for the community feed -->
|
||||
<projectUrl>https://toki-labs.com/oto</projectUrl>
|
||||
<!-- There are a number of CDN Services that can be used for hosting the Icon for a package. More information can be found here: https://docs.chocolatey.org/en-us/create/create-packages#package-icon-guidelines -->
|
||||
<!-- Here is an example using Githack -->
|
||||
<!--<iconUrl>http://rawcdn.githack.com/__REPLACE_YOUR_REPO__/master/icons/oto.png</iconUrl>-->
|
||||
<!-- <copyright>Year Software Vendor</copyright> -->
|
||||
<!-- If there is a license Url available, it is required for the community feed -->
|
||||
<!-- <licenseUrl>Software License Location __REMOVE_OR_FILL_OUT__</licenseUrl>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>-->
|
||||
<!--<projectSourceUrl>Software Source Location - is the software FOSS somewhere? Link to it with this</projectSourceUrl>-->
|
||||
<!--<docsUrl>At what url are the software docs located?</docsUrl>-->
|
||||
<!--<mailingListUrl></mailingListUrl>-->
|
||||
<!--<bugTrackerUrl></bugTrackerUrl>-->
|
||||
<tags>oto</tags>
|
||||
<summary>Automation tool</summary>
|
||||
<description>Automation tool for multi platforms</description>
|
||||
<!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> -->
|
||||
<!-- =============================== -->
|
||||
|
||||
<!-- Specifying dependencies and version ranges? https://docs.nuget.org/create/versioning#specifying-version-ranges-in-.nuspec-files -->
|
||||
<!--<dependencies>
|
||||
<dependency id="" version="__MINIMUM_VERSION__" />
|
||||
<dependency id="" version="[__EXACT_VERSION__]" />
|
||||
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_INCLUSIVE]" />
|
||||
<dependency id="" version="[_MIN_VERSION_INCLUSIVE, MAX_VERSION_EXCLUSIVE)" />
|
||||
<dependency id="" />
|
||||
<dependency id="chocolatey-core.extension" version="1.1.0" />
|
||||
</dependencies>-->
|
||||
<!-- chocolatey-core.extension - https://community.chocolatey.org/packages/chocolatey-core.extension -->
|
||||
|
||||
<!--<provides>NOT YET IMPLEMENTED</provides>-->
|
||||
<!--<conflicts>NOT YET IMPLEMENTED</conflicts>-->
|
||||
<!--<replaces>NOT YET IMPLEMENTED</replaces>-->
|
||||
</metadata>
|
||||
<files>
|
||||
<!-- this section controls what actually gets packaged into the Chocolatey package -->
|
||||
<file src="tools\**" target="tools" />
|
||||
</files>
|
||||
</package>
|
||||
1
assets/package/oto_update.bat
Normal file
1
assets/package/oto_update.bat
Normal file
|
|
@ -0,0 +1 @@
|
|||
nuget push -ConfigFile "C:\Users\r0bin\AppData\Local\NuGet\NuGet.Config" -Source http://toki-labs.com:5001/v3/index.json -ApiKey a24d504c7fee0df0aea22c16b4bfcbb09701a79d "C:\works\oto_cli\assets\package\chocolatey\oto.0.0.287.nupkg"
|
||||
Loading…
Reference in a new issue