Revised the installation file for Powershell for more clear readability during the installation process
This commit is contained in:
+25
-8
@@ -11,20 +11,37 @@ function Install-Obsidian-Windows {
|
||||
Write-Output "Chocolatey is not installed. Installing Chocolatey..."
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
||||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
|
||||
$script = (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')
|
||||
Invoke-Command -ScriptBlock ([ScriptBlock]::Create($script))
|
||||
}
|
||||
choco install -y wget jq
|
||||
choco install -y jq
|
||||
|
||||
Write-Output "Downloading Obsidian installer..."
|
||||
wget https://github.com/obsidianmd/obsidian-releases/releases/download/v1.6.3/Obsidian.1.6.3.exe -OutFile ObsidianInstaller.exe
|
||||
Invoke-WebRequest -Uri "https://github.com/obsidianmd/obsidian-releases/releases/download/v1.6.3/Obsidian.1.6.3.exe" -OutFile "ObsidianInstaller.exe"
|
||||
|
||||
# Check if the installer was downloaded
|
||||
if (Test-Path "ObsidianInstaller.exe") {
|
||||
Write-Output "Running Obsidian installer..."
|
||||
Start-Process -FilePath .\ObsidianInstaller.exe -ArgumentList "/S" -NoNewWindow -Wait
|
||||
$startProcess = Start-Process -FilePath .\ObsidianInstaller.exe -ArgumentList "/S" -PassThru -Wait
|
||||
Write-Output "Installer exit code: $($startProcess.ExitCode)"
|
||||
|
||||
# Check if Obsidian was installed and create a symbolic link for testing
|
||||
if (Test-Path "C:\Program Files\Obsidian\Obsidian.exe") {
|
||||
# Check for Obsidian executable in possible installation paths
|
||||
$obsidianPaths = @(
|
||||
"C:\Program Files\Obsidian\Obsidian.exe",
|
||||
"$env:LOCALAPPDATA\Programs\Obsidian\Obsidian.exe",
|
||||
"$env:LOCALAPPDATA\Obsidian\Obsidian.exe"
|
||||
)
|
||||
|
||||
$obsidianInstalled = $false
|
||||
foreach ($path in $obsidianPaths) {
|
||||
if (Test-Path $path) {
|
||||
$obsidianInstalled = $true
|
||||
Write-Output "Obsidian found at $path"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if ($obsidianInstalled) {
|
||||
Write-Output "Obsidian installed successfully."
|
||||
} else {
|
||||
Write-Output "Obsidian installation failed."
|
||||
@@ -36,7 +53,7 @@ function Install-Obsidian-Windows {
|
||||
}
|
||||
}
|
||||
|
||||
function Install-Plugins {
|
||||
function Install-Plugin {
|
||||
Write-Output "Installing plugins..."
|
||||
|
||||
# Kill Obsidian process if running
|
||||
@@ -79,4 +96,4 @@ if (-Not (Test-Administrator)) {
|
||||
|
||||
# Directly run Windows installation and plugin configuration
|
||||
Install-Obsidian-Windows
|
||||
Install-Plugins
|
||||
Install-Plugin
|
||||
|
||||
Reference in New Issue
Block a user