mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
Created windows related powershell & batch scripts for install/uninstall
This commit is contained in:
parent
fed4544b0e
commit
66e9e6ba8b
BIN
assets/icon.ico
Normal file
BIN
assets/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
39
deploy/win32/spotube/clear-installation.ps1
Normal file
39
deploy/win32/spotube/clear-installation.ps1
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Don't edit this file without understanding, this can lead to major damage to the system
|
||||||
|
# Use uninstall.bat to remove Spotube
|
||||||
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||||
|
if(Test-Path "$ScriptDir\qode.exe"){
|
||||||
|
$WannaRemove = Read-Host -Prompt "Are you sure to uninstall?[y]Yes/[n]No"
|
||||||
|
$WannaRemove = $WannaRemove.Trim().ToLower()
|
||||||
|
if($WannaRemove -eq "y"){
|
||||||
|
echo "Removing all the contents"
|
||||||
|
Get-ChildItem $ScriptDir -Recurse | Remove-Item
|
||||||
|
|
||||||
|
$DeleteData = Read-Host -Prompt "Do you want to delete all data & caches?[y]Yes/[n]No"
|
||||||
|
$DeleteData = $DeleteData.Trim().ToLower()
|
||||||
|
if ($DeleteData -eq "y") {
|
||||||
|
echo "Deleting data & caches"
|
||||||
|
Remove-Item -Path "$Home\.config\spotube" -Recurse
|
||||||
|
Remove-Item -Path "$Home\.cache\spotube" -Recurse
|
||||||
|
echo "Deleted caches & data"
|
||||||
|
}
|
||||||
|
elseif($DeleteData -eq "n") {
|
||||||
|
echo "Ok, keeping those"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Uninstall complete, just delete the Spotube folder now"
|
||||||
|
echo "Will miss you💕!"
|
||||||
|
}
|
||||||
|
elseif($WannaRemove -eq "n"){
|
||||||
|
echo "Thank god you didn't, quitting..."
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw "Script isn't being executed desired location, aborting for abuse"
|
||||||
|
}
|
3
deploy/win32/spotube/install.bat
Normal file
3
deploy/win32/spotube/install.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
Powershell.exe -Command "& {Start-Process Powershell.exe -ArgumentList '-ExecutionPolicy Bypass -File %~dp0make-install.ps1' -Verb RunAs}"
|
79
deploy/win32/spotube/make-install.ps1
Normal file
79
deploy/win32/spotube/make-install.ps1
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# Don't edit this file, this can cause serious damage
|
||||||
|
# Use install.bat to install Spotube
|
||||||
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
|
||||||
|
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
|
||||||
|
$shortcut_paths = @(
|
||||||
|
"$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Spotube.lnk",
|
||||||
|
"$HOME\Desktop\Spotube.lnk"
|
||||||
|
)
|
||||||
|
# for creating shortcuts
|
||||||
|
function CreateShortcut {
|
||||||
|
$Target = "$ScriptDir\qode.exe"
|
||||||
|
$WshShell = New-Object -comObject WScript.Shell
|
||||||
|
|
||||||
|
echo "Creating shortcuts"
|
||||||
|
foreach($shortcut in $shortcut_paths){
|
||||||
|
echo $shortcut
|
||||||
|
$StartShortcut = $WshShell.CreateShortcut($shortcut)
|
||||||
|
$StartShortcut.TargetPath = $Target
|
||||||
|
$StartShortcut.WorkingDirectory = $ScriptDir
|
||||||
|
$StartShortcut.IconLocation = "$ScriptDir\dist\icon.ico"
|
||||||
|
$StartShortcut.Save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$Spotube_Dir = "$Env:Programfiles\Spotube"
|
||||||
|
# extracts & installs spotube
|
||||||
|
function InstallSpotube {
|
||||||
|
param([bool]$PromptLocation)
|
||||||
|
$Spotube_Location=""
|
||||||
|
# checking if reinstalling
|
||||||
|
if($PromptLocation){
|
||||||
|
$Spotube_Location = Read-Host -Prompt "Give an absolute path (e.g C:\My Folder\) to install Spotube or leave it empty to install in {$Spotube_Dir}: "
|
||||||
|
}
|
||||||
|
# now creating/installing spotube
|
||||||
|
if(!$Spotube_Location.Trim()){
|
||||||
|
New-Item -Path $Env:Programfiles -Name "Spotube" -ItemType "directory"
|
||||||
|
[System.IO.Compression.ZipFile]::ExtractToDirectory("$ScriptDir\spotube.data", $Spotube_Dir)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
New-Item -Path Spotube_Location -Name "Spotube" -ItemType "directory"
|
||||||
|
[System.IO.Compression.ZipFile]::ExtractToDirectory("$ScriptDir\spotube.data", "$Spotube_Location\Spotube")
|
||||||
|
}
|
||||||
|
$WannaCreateShortcut = Read-Host -Prompt "Do you want to create shortcuts?[y]Yes/[n]No"
|
||||||
|
$WannaCreateShortcut = $WannaCreateShortcut.Trim().ToLower()
|
||||||
|
if($WannaCreateShortcut -eq "y"){
|
||||||
|
CreateShortcut
|
||||||
|
}
|
||||||
|
elseif($WannaCreateShortcut -eq "n"){
|
||||||
|
echo "Ok, skipping this part"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(Test-Path $Spotube_Dir)){
|
||||||
|
InstallSpotube -PromptLocation $True
|
||||||
|
}
|
||||||
|
# reinstallation procedure
|
||||||
|
else{
|
||||||
|
echo "Spotube already exists in $Env:Programfiles\Spotube"
|
||||||
|
$WannaReplace = Read-Host -Prompt "Do you want to reinstall?[y]Yes/[n]No"
|
||||||
|
$WannaReplace = $WannaReplace.Trim().ToLower()
|
||||||
|
if($WannaReplace -eq "y"){
|
||||||
|
echo "Removing Old Spotube"
|
||||||
|
Remove-Item -Path "$Spotube_Dir" -Recurse
|
||||||
|
echo "Installing New Spotube"
|
||||||
|
InstallSpotube
|
||||||
|
}
|
||||||
|
elseif($WannaReplace -eq "n"){
|
||||||
|
echo "Keeping the older installation, quitting..."
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw "Wrong Option, use either 'y' or 'n', aborting..."
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
0
deploy/win32/spotube/platforms/.gitkeep
Normal file
0
deploy/win32/spotube/platforms/.gitkeep
Normal file
3
deploy/win32/spotube/qode.json
Normal file
3
deploy/win32/spotube/qode.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"distPath": ".\\dist"
|
||||||
|
}
|
0
deploy/win32/spotube/styles/.gitkeep
Normal file
0
deploy/win32/spotube/styles/.gitkeep
Normal file
3
deploy/win32/spotube/uninstall.bat
Normal file
3
deploy/win32/spotube/uninstall.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
powershell.exe -ExecutionPolicy Unrestricted -Command ". '%~dp0clear-installation.ps1'"
|
Loading…
Reference in New Issue
Block a user