Skip to content

Commit 1882707

Browse files
more places to wait lock to be released
1 parent 653c24e commit 1882707

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

install-pwsh.sh

+12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ sudo add-apt-repository --yes universe
2222
if apt-cache policy powershell | grep -q "Candidate:"; then
2323
echo "PowerShell is available in the repository. Installing..."
2424
# Install PowerShell from the repository
25+
echo "================= Wait for dpkg to release lock ================="
26+
while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do
27+
echo "Waiting for other software managers to finish..."
28+
sleep 5
29+
done
2530
sudo apt-get install -y powershell
2631
else
2732
echo "PowerShell is not available in the repository. Falling back to manual installation..."
@@ -73,6 +78,13 @@ else
7378
echo "Installing PowerShell package..."
7479
sudo dpkg -i "$tmpDir/powershell.deb"
7580

81+
# Install PowerShell from the repository
82+
echo "================= Wait for dpkg to release lock ================="
83+
while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1 ; do
84+
echo "Waiting for other software managers to finish..."
85+
sleep 5
86+
done
87+
7688
# Resolve missing dependencies and finish the install (if necessary)
7789
echo "Resolving missing dependencies..."
7890
sudo apt-get install -f

0 commit comments

Comments
 (0)