mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-23 11:46:44 +01:00
Updated install-calibre-server.ps1
This commit is contained in:
parent
0cae40f435
commit
76ae519408
@ -24,28 +24,29 @@ try {
|
|||||||
|
|
||||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
"⏳ (1/5) Updating package infos..."
|
"`n⏳ (1/5) Updating package infos..."
|
||||||
& sudo apt update -y
|
& sudo apt update -y
|
||||||
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
|
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
|
||||||
|
|
||||||
"⏳ (2/5) Installing Calibre package..."
|
"`n⏳ (2/5) Installing Calibre package..."
|
||||||
& sudo apt install calibre -y
|
& sudo apt install calibre -y
|
||||||
if ($lastExitCode -ne "0") { throw "'apt install calibre' failed" }
|
if ($lastExitCode -ne "0") { throw "'apt install calibre' failed" }
|
||||||
|
|
||||||
Write-Host "⏳ (3/5) Searching for Calibre server executable... " -noNewline
|
"`n⏳ (3/5) Searching for Calibre server executable..."
|
||||||
& calibre-server --version
|
& calibre-server --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'calibre-server' - make sure Calibre server is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'calibre-server' - make sure Calibre server is installed and available" }
|
||||||
|
|
||||||
"⏳ (4/5) Creating media folder at: $mediaFolder ... (if non-existent)"
|
"`n⏳ (4/5) Creating media folder at: $mediaFolder ... (if non-existent)"
|
||||||
mkdir $mediaFolder
|
mkdir $mediaFolder
|
||||||
|
|
||||||
"⏳ (5/5) Starting Calibre server as background process..."
|
"`n⏳ (5/5) Starting Calibre server as background process..."
|
||||||
& calibre-server --port $port --num-per-page 100 --userdb $userDB --log $logfile --daemonize $HOME/'Calibre Library'
|
& calibre-server --port $port --num-per-page 100 --userdb $userDB --log $logfile --daemonize $mediaFolder
|
||||||
|
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✅ Installed Calibre server on port $port in $($elapsed)s (media at: $mediaFolder, user DB: $userDB, log to: $logfile)"
|
"✅ Installed and started Calibre server on port $port in $($elapsed)s."
|
||||||
|
" (media at: $mediaFolder, user DB: $userDB, logging to: $logfile)"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user