diff --git a/assets/package/NuGet.Config b/assets/package/NuGet.Config
new file mode 100644
index 0000000..22aed4e
--- /dev/null
+++ b/assets/package/NuGet.Config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/package/chocolatey/oto.nuspec b/assets/package/chocolatey/oto.nuspec
index c86e855..3f5c9a2 100644
--- a/assets/package/chocolatey/oto.nuspec
+++ b/assets/package/chocolatey/oto.nuspec
@@ -26,7 +26,7 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe
- 0.0.282
+ 0.0.287
diff --git a/assets/package/chocolatey/tools/chocolateyinstall.ps1 b/assets/package/chocolatey/tools/chocolateyinstall.ps1
index 6fb018b..681b7d4 100644
--- a/assets/package/chocolatey/tools/chocolateyinstall.ps1
+++ b/assets/package/chocolatey/tools/chocolateyinstall.ps1
@@ -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."
}
diff --git a/assets/package/chocolateyinstall_template.ps1 b/assets/package/chocolateyinstall_template.ps1
new file mode 100644
index 0000000..6d6c5af
--- /dev/null
+++ b/assets/package/chocolateyinstall_template.ps1
@@ -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!"
diff --git a/assets/package/oto_install.bat b/assets/package/oto_install.bat
new file mode 100644
index 0000000..0a44cb7
--- /dev/null
+++ b/assets/package/oto_install.bat
@@ -0,0 +1,2 @@
+choco source add -n="oto" -s="http://toki-labs.com:5001/v3/index.json"
+choco install oto --source="oto"
\ No newline at end of file
diff --git a/assets/package/oto_template.nuspec b/assets/package/oto_template.nuspec
new file mode 100644
index 0000000..47a9ad8
--- /dev/null
+++ b/assets/package/oto_template.nuspec
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ oto
+
+
+
+ [VERSION]
+
+
+
+
+
+
+
+ oto (Install)
+ toki
+
+ https://toki-labs.com/oto
+
+
+
+
+
+
+
+
+
+
+ oto
+ Automation tool
+ Automation tool for multi platforms
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/package/oto_update.bat b/assets/package/oto_update.bat
new file mode 100644
index 0000000..fe030b1
--- /dev/null
+++ b/assets/package/oto_update.bat
@@ -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"
\ No newline at end of file