mirror of
https://github.com/r4sas/chocolatey-packages
synced 2025-01-20 20:00:21 +00:00
add icon for Start menu shortcuts, manage service using PS commands
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
5700fa9fc7
commit
93192c0bc2
@ -44,9 +44,15 @@ if (-not (Test-Path -Path $startMenuDir)) {
|
|||||||
New-Item -Path $startMenuDir -ItemType Directory
|
New-Item -Path $startMenuDir -ItemType Directory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Get PowerShell executable path
|
||||||
|
$psPath = (Get-Command powershell.exe).Path
|
||||||
|
|
||||||
Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Start service.lnk" `
|
Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Start service.lnk" `
|
||||||
-targetPath "$toolsDir\service-start.bat" -workDirectory "$appDir" -description "Start yggdrasil service" -RunAsAdmin
|
-targetPath $psPath -Arguments "Start-Service -name 'Yggdrasil'" `
|
||||||
|
-workDirectory "$appDir" -description "Start yggdrasil service" -IconLocation "$toolsDir\yggdrasil.ico" -RunAsAdmin
|
||||||
Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Restart service.lnk" `
|
Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Restart service.lnk" `
|
||||||
-targetPath "$toolsDir\service-restart.bat" -workDirectory "$appDir" -description "Restart yggdrasil service" -RunAsAdmin
|
-targetPath $psPath -Arguments "Restart-Service -name 'Yggdrasil'" `
|
||||||
|
-workDirectory "$appDir" -description "Restart yggdrasil service" -IconLocation "$toolsDir\yggdrasil.ico" -RunAsAdmin
|
||||||
Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Stop service.lnk" `
|
Install-ChocolateyShortcut -shortcutFilePath "$startMenuDir\Stop service.lnk" `
|
||||||
-targetPath "$toolsDir\service-stop.bat" -workDirectory "$appDir" -description "Stop yggdrasil service" -RunAsAdmin
|
-targetPath $psPath -Arguments "Stop-Service -name 'Yggdrasil'" `
|
||||||
|
-workDirectory "$appDir" -description "Stop yggdrasil service" -IconLocation "$toolsDir\yggdrasil.ico" -RunAsAdmin
|
||||||
|
@ -7,7 +7,7 @@ $startMenuDir = "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\
|
|||||||
$softwareName = 'Yggdrasil Network*'
|
$softwareName = 'Yggdrasil Network*'
|
||||||
|
|
||||||
# Remove package, it don't touch configs
|
# Remove package, it don't touch configs
|
||||||
Write-Host "We removing package, but doesn't touch your configs. You can still find them in '$confDir' directory"
|
Write-Host "Package is being uninstalled, but configs are preserved. You can still find them in '$confDir' directory"
|
||||||
|
|
||||||
[array]$key = Get-UninstallRegistryKey -SoftwareName $softwareName
|
[array]$key = Get-UninstallRegistryKey -SoftwareName $softwareName
|
||||||
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
@set @_cmd=1 /*
|
|
||||||
@echo off
|
|
||||||
setlocal EnableExtensions
|
|
||||||
title Yggdrasil
|
|
||||||
|
|
||||||
whoami /groups | findstr "S-1-16-12288" >nul && goto :admin
|
|
||||||
if "%~1"=="RunAsAdmin" goto :error
|
|
||||||
|
|
||||||
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
|
|
||||||
cscript /nologo /e:javascript "%~f0" || goto :error
|
|
||||||
exit /b
|
|
||||||
|
|
||||||
:error
|
|
||||||
echo.
|
|
||||||
echo Error: Administrator privileges elevation failed,
|
|
||||||
echo please manually run this script as administrator.
|
|
||||||
echo.
|
|
||||||
goto :end
|
|
||||||
|
|
||||||
:admin
|
|
||||||
sc stop "Yggdrasil"
|
|
||||||
sc start "Yggdrasil"
|
|
||||||
|
|
||||||
:end
|
|
||||||
set /p =Press [Enter] to exit . . .
|
|
||||||
exit /b */
|
|
||||||
|
|
||||||
// JScript, restart batch script as administrator
|
|
||||||
var objShell = WScript.CreateObject('Shell.Application');
|
|
||||||
var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%');
|
|
||||||
objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1);
|
|
@ -1,30 +0,0 @@
|
|||||||
@set @_cmd=1 /*
|
|
||||||
@echo off
|
|
||||||
setlocal EnableExtensions
|
|
||||||
title Yggdrasil
|
|
||||||
|
|
||||||
whoami /groups | findstr "S-1-16-12288" >nul && goto :admin
|
|
||||||
if "%~1"=="RunAsAdmin" goto :error
|
|
||||||
|
|
||||||
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
|
|
||||||
cscript /nologo /e:javascript "%~f0" || goto :error
|
|
||||||
exit /b
|
|
||||||
|
|
||||||
:error
|
|
||||||
echo.
|
|
||||||
echo Error: Administrator privileges elevation failed,
|
|
||||||
echo please manually run this script as administrator.
|
|
||||||
echo.
|
|
||||||
goto :end
|
|
||||||
|
|
||||||
:admin
|
|
||||||
sc start "Yggdrasil"
|
|
||||||
|
|
||||||
:end
|
|
||||||
set /p =Press [Enter] to exit . . .
|
|
||||||
exit /b */
|
|
||||||
|
|
||||||
// JScript, restart batch script as administrator
|
|
||||||
var objShell = WScript.CreateObject('Shell.Application');
|
|
||||||
var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%');
|
|
||||||
objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1);
|
|
@ -1,30 +0,0 @@
|
|||||||
@set @_cmd=1 /*
|
|
||||||
@echo off
|
|
||||||
setlocal EnableExtensions
|
|
||||||
title Yggdrasil
|
|
||||||
|
|
||||||
whoami /groups | findstr "S-1-16-12288" >nul && goto :admin
|
|
||||||
if "%~1"=="RunAsAdmin" goto :error
|
|
||||||
|
|
||||||
echo Requesting privileges elevation for managing the dnscrypt-proxy service . . .
|
|
||||||
cscript /nologo /e:javascript "%~f0" || goto :error
|
|
||||||
exit /b
|
|
||||||
|
|
||||||
:error
|
|
||||||
echo.
|
|
||||||
echo Error: Administrator privileges elevation failed,
|
|
||||||
echo please manually run this script as administrator.
|
|
||||||
echo.
|
|
||||||
goto :end
|
|
||||||
|
|
||||||
:admin
|
|
||||||
sc stop "Yggdrasil"
|
|
||||||
|
|
||||||
:end
|
|
||||||
set /p =Press [Enter] to exit . . .
|
|
||||||
exit /b */
|
|
||||||
|
|
||||||
// JScript, restart batch script as administrator
|
|
||||||
var objShell = WScript.CreateObject('Shell.Application');
|
|
||||||
var ComSpec = WScript.CreateObject('WScript.Shell').ExpandEnvironmentStrings('%ComSpec%');
|
|
||||||
objShell.ShellExecute(ComSpec, '/c ""' + WScript.ScriptFullName + '" RunAsAdmin"', '', 'runas', 1);
|
|
BIN
yggdrasil/tools/yggdrasil.ico
Normal file
BIN
yggdrasil/tools/yggdrasil.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
Loading…
x
Reference in New Issue
Block a user