mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-16 09:50:02 +01:00
Update start-ipfs-server.ps1 and publish-to-ipfs.ps1
This commit is contained in:
parent
2de3ecc59c
commit
b5d19fdde2
@ -24,26 +24,25 @@ try {
|
||||
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ Step 1/3: Searching for IPFS executable..."
|
||||
Write-Host "⏳ (1/3) Searching for IPFS executable..." -NoNewline
|
||||
& ipfs --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
|
||||
|
||||
if (test-path "$FilePattern" -pathType container) {
|
||||
""
|
||||
"⏳ Step 2/3: Publishing folder $FilePattern/..."
|
||||
"⏳ (2/3) Publishing folder $FilePattern/..."
|
||||
& ipfs add -r "$FilePattern" > $HashList
|
||||
[int]$Count = 1
|
||||
""
|
||||
"⏳ Step 3/3: Calculating digital forensics hashes to $DF_HASHES ..."
|
||||
"⏳ (3/3) Calculating digital forensics hashes to $DF_HASHES ..."
|
||||
& nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$FilePattern" > $DF_Hashes
|
||||
} else {
|
||||
$FileList = (get-childItem "$FilePattern")
|
||||
foreach ($File in $FileList) {
|
||||
if (test-path "$FilePattern" -pathType container) {
|
||||
"⏳ Step 2/3: Publishing folder $File/..."
|
||||
"⏳ (2/3) Publishing folder $File/..."
|
||||
& ipfs add -r "$File" >> $HashList
|
||||
} else {
|
||||
"⏳ Step 3/3: Publishing file $File..."
|
||||
"⏳ (3/3) Publishing file $File..."
|
||||
& ipfs add "$File" >> $HashList
|
||||
}
|
||||
}
|
||||
|
@ -14,14 +14,13 @@
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ Step 1/5: Searching for IPFS executable..."
|
||||
Write-Host "⏳ (1/5) Searching for IPFS executable... " -noNewline
|
||||
& ipfs --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
|
||||
""
|
||||
"⏳ Step 2/5: Initializing IPFS with server profile..."
|
||||
"⏳ (2/5) Initializing IPFS with server profile..."
|
||||
& ipfs init --profile server
|
||||
|
||||
"⏳ Step 3/5: Configuring IPFS..."
|
||||
"⏳ (3/5) Configuring IPFS..."
|
||||
& ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
|
||||
if ($lastExitCode -ne "0") { throw "'ipfs config Addresses.API' failed (exit code $lastExitCode)" }
|
||||
|
||||
@ -41,11 +40,10 @@ try {
|
||||
& ipfs config --json Swarm.Transports.Network.Websocket 'false'
|
||||
if ($lastExitCode -ne "0") { throw "'ipfs config Swarm.Transports.Network.Websocket' failed (exit code $lastExitCode)" }
|
||||
""
|
||||
"⏳ Step 4/5: Increasing UDP receive buffer size..."
|
||||
Write-Host "⏳ (4/5) Increasing UDP receive buffer size..." -noNewline
|
||||
& sudo sysctl -w net.core.rmem_max=2500000
|
||||
if ($lastExitCode -ne "0") { throw "'sysctl' failed (exit code $lastExitCode)" }
|
||||
""
|
||||
"⏳ Step 5/5: Starting IPFS daemon..."
|
||||
"⏳ (5/5) Starting IPFS daemon..."
|
||||
# Start-Process nohup 'ipfs daemon'
|
||||
Start-Process nohup -ArgumentList 'ipfs','daemon' -RedirectStandardOutput "$HOME/console.out" -RedirectStandardError "$HOME/console.err"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user