mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-19 08:52:05 +02:00
Updated the manuals
This commit is contained in:
@@ -6,7 +6,7 @@ This PowerShell script installs and starts a local Calibre server as background
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
/home/markus/Repos/PowerShell/scripts/install-calibre-server.ps1 [[-port] <Int32>] [[-mediaFolder] <String>] [[-userDB] <String>] [[-logfile] <String>] [<CommonParameters>]
|
||||
/Repos/PowerShell/scripts/install-calibre-server.ps1 [[-port] <Int32>] [[-mediaFolder] <String>] [[-userDB] <String>] [[-logfile] <String>] [<CommonParameters>]
|
||||
|
||||
-port <Int32>
|
||||
Specifies the Web port number (8099 by default)
|
||||
@@ -18,26 +18,29 @@ Parameters
|
||||
Accept wildcard characters? false
|
||||
|
||||
-mediaFolder <String>
|
||||
Specifies the file path to the media ('/opt/Calibre Library' by default)
|
||||
|
||||
Required? false
|
||||
Position? 2
|
||||
Default value "$HOME/Calibre Library"
|
||||
Default value /opt/Calibre Library
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-userDB <String>
|
||||
Specifies the file path to the user database ('/opt/CalibreUsers.sqlite' by default)
|
||||
|
||||
Required? false
|
||||
Position? 3
|
||||
Default value "$HOME/CalibreUsers.sqlite"
|
||||
Default value /opt/CalibreUsers.sqlite
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-logfile <String>
|
||||
Specifies the file path to the log file ('/opt/CalibreServer.log' by default)
|
||||
|
||||
Required? false
|
||||
Position? 4
|
||||
Default value "$HOME/CalibreServer.log"
|
||||
Default value /opt/CalibreServer.log
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
@@ -73,6 +76,12 @@ Script Content
|
||||
This PowerShell script installs and starts a local Calibre server as background process.
|
||||
.PARAMETER port
|
||||
Specifies the Web port number (8099 by default)
|
||||
.PARAMETER mediaFolder
|
||||
Specifies the file path to the media ('/opt/Calibre Library' by default)
|
||||
.PARAMETER userDB
|
||||
Specifies the file path to the user database ('/opt/CalibreUsers.sqlite' by default)
|
||||
.PARAMETER logfile
|
||||
Specifies the file path to the log file ('/opt/CalibreServer.log' by default)
|
||||
.EXAMPLE
|
||||
PS> ./install-calibre-server.ps1
|
||||
⏳ (1/5) Updating package infos...
|
||||
@@ -85,38 +94,39 @@ Script Content
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
param([int]$port = 8099, [string]$mediaFolder = "$HOME/Calibre Library", [string]$userDB = "$HOME/CalibreUsers.sqlite", [string]$logfile = "$HOME/CalibreServer.log")
|
||||
param([int]$port = 8099, [string]$mediaFolder = "/opt/Calibre Library", [string]$userDB = "/opt/CalibreUsers.sqlite", [string]$logfile = "/opt/CalibreServer.log")
|
||||
|
||||
try {
|
||||
if (-not $IsLinux) { throw "Sorry, currently only supported on Linux" }
|
||||
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ (1/5) Updating package infos..."
|
||||
"`n⏳ (1/5) Updating package infos..."
|
||||
& sudo apt update -y
|
||||
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
|
||||
|
||||
"⏳ (2/5) Installing Calibre package..."
|
||||
"`n⏳ (2/5) Installing Calibre package..."
|
||||
& sudo apt install calibre -y
|
||||
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
|
||||
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)"
|
||||
mkdir $mediaFolder
|
||||
"`n⏳ (4/5) Creating media folder at: $mediaFolder ... (if non-existent)"
|
||||
& mkdir $mediaFolder
|
||||
|
||||
"⏳ (5/5) Starting Calibre server as background process..."
|
||||
& calibre-server --port $port --num-per-page 100 --userdb $userDB --log $logfile --daemonize $HOME/'Calibre Library'
|
||||
"`n⏳ (5/5) Starting Calibre server as background process..."
|
||||
& sudo calibre-server --port $port --num-per-page 100 --userdb $userDB --log $logfile --daemonize $mediaFolder
|
||||
|
||||
[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
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 as of 11/20/2024 11:51:54)*
|
||||
*(page generated by convert-ps2md.ps1 as of 01/17/2025 08:30:52)*
|
||||
|
Reference in New Issue
Block a user