mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-16 15:41:52 +02:00
Updated the Markdown manuals
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
*install-calibre-server.ps1*
|
||||
================
|
||||
|
||||
This PowerShell script installs and starts a local Calibre server as background process (using Web port 8099 by default).
|
||||
This PowerShell script installs and starts a local Calibre server as background process.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./install-calibre-server.ps1 [[-Port] <Int32>] [[-UserDB] <String>] [[-Logfile] <String>] [<CommonParameters>]
|
||||
PS> ./install-calibre-server.ps1 [[-port] <Int32>] [[-mediaFolder] <String>] [[-userDB] <String>] [[-logfile] <String>] [<CommonParameters>]
|
||||
|
||||
-Port <Int32>
|
||||
-port <Int32>
|
||||
Specifies the Web port number (8099 by default)
|
||||
|
||||
Required? false
|
||||
@ -17,18 +17,26 @@ PS> ./install-calibre-server.ps1 [[-Port] <Int32>] [[-UserDB] <String>] [[-Logfi
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-UserDB <String>
|
||||
-mediaFolder <String>
|
||||
|
||||
Required? false
|
||||
Position? 2
|
||||
Default value "$HOME/Calibre Library"
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-userDB <String>
|
||||
|
||||
Required? false
|
||||
Position? 3
|
||||
Default value "$HOME/CalibreUsers.sqlite"
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-Logfile <String>
|
||||
-logfile <String>
|
||||
|
||||
Required? false
|
||||
Position? 3
|
||||
Position? 4
|
||||
Default value "$HOME/CalibreServer.log"
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
@ -42,6 +50,8 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./install-calibre-server.ps1
|
||||
⏳ (1/5) Updating package infos...
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
@ -58,13 +68,15 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs Calibre server (needs admin rights)
|
||||
Installs the Calibre server (needs admin rights)
|
||||
.DESCRIPTION
|
||||
This PowerShell script installs and starts a local Calibre server as background process (using Web port 8099 by default).
|
||||
This PowerShell script installs and starts a local Calibre server as background process.
|
||||
.PARAMETER port
|
||||
Specifies the Web port number (8099 by default)
|
||||
.EXAMPLE
|
||||
PS> ./install-calibre-server.ps1
|
||||
⏳ (1/5) Updating package infos...
|
||||
...
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -73,36 +85,40 @@ Script Content
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
param([int]$Port = 8099, [string]$UserDB = "$HOME/CalibreUsers.sqlite", [string]$Logfile = "$HOME/CalibreServer.log")
|
||||
param([int]$port = 8099, [string]$mediaFolder = "$HOME/Calibre Library", [string]$userDB = "$HOME/CalibreUsers.sqlite", [string]$logfile = "$HOME/CalibreServer.log")
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
if ($IsLinux) {
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ (1/5) Updating package infos..."
|
||||
& sudo apt update -y
|
||||
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
|
||||
"⏳ (1/5) Updating package infos..."
|
||||
& sudo apt update -y
|
||||
if ($lastExitCode -ne "0") { throw "'apt update' failed" }
|
||||
|
||||
"⏳ (2/5) Installing the Calibre package..."
|
||||
& sudo apt install calibre -y
|
||||
if ($lastExitCode -ne "0") { throw "'apt install calibre' failed" }
|
||||
"⏳ (2/5) Installing Calibre..."
|
||||
& sudo apt install calibre -y
|
||||
if ($lastExitCode -ne "0") { throw "'apt install calibre' failed" }
|
||||
|
||||
"⏳ (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" }
|
||||
"⏳ (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 folder 'Calibre Library' in your home directory..."
|
||||
mkdir $HOME/'Calibre Library'
|
||||
"⏳ (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'
|
||||
"⏳ (5/5) Starting Calibre server as background process..."
|
||||
& calibre-server --port $port --num-per-page 100 --userdb $userDB --log $logfile --daemonize $HOME/'Calibre Library'
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ installed Calibre in $Elapsed sec (Web port $Port, user DB at $UserDB, log file at $Logfile)"
|
||||
exit 0 # success
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Installed Calibre server on Web port $port in $elapsed sec (media folder: $mediaFolder, user database: $userDB, log file: $logfile)"
|
||||
exit 0 # success
|
||||
} else {
|
||||
throw "Currently only supported on Linux"
|
||||
}
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of install-calibre-server.ps1 as of 10/19/2023 08:11:38)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of install-calibre-server.ps1 as of 12/07/2023 20:24:17)*
|
||||
|
Reference in New Issue
Block a user