我正在尝试通过自动化安装mysql-workbench-community
和。但是,当我运行时,我收到错误postman
snap
snap install mysql-workbench-community --classic
error: too early for operation, device not yet seeded or device model not acknowledged
snap install mysql-workbench-community --classic
如果我尝试第二次或第三次运行,它最终会安装。
作为目前的解决方法,我创建了一个循环来检查是否snap
已安装,如果已安装则退出循环。如果未安装,它将尝试安装snap
30 次,然后才会失败。
脚本如下:
#!/bin/bash
counter=0
dnf install epel-release -y
dnf install snapd -y
if [ ! -L /snap ]; then
ln -s /var/lib/snapd/snap /snap
fi
systemctl enable --now snapd.socket
echo -n "Installing MySQL Workbench ... "
while true
do
if snap list 2>/dev/null | grep -q mysql-workbench-community; then
break
else
snap install mysql-workbench-community --classic
let "counter+=1"
sleep 5
fi
if [ $counter = 30 ]; then
exit 10
fi
done
echo "OK"
snap connect mysql-workbench-community:password-manager-service
snap connect mysql-workbench-community:ssh-keys
echo -n "Installing Postman ... "
while true
do
if snap list 2>/dev/null | grep -q postman; then
break
else
snap install postman --classic
let "counter+=1"
sleep 5
fi
if [ $counter = 30 ]; then
exit 10
fi
done
echo "OK"
我很好奇为什么我必须snap
在它工作之前安装几次,以及可以做什么,这样我就不需要创建循环。