This commit is contained in:
Darren 2023-10-06 19:54:23 +08:00 committed by GitHub
parent 61a3de3856
commit 2221b3065e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 24 deletions

View file

@ -1,2 +1,2 @@
1. Fix install error: print version at Ubuntu
2. Fix install error: cockpit can not start at Ubuntu
1. Fix install: timeout for install Docker
2. Fix install: export apt lock check

View file

@ -90,6 +90,25 @@ echo Install from url: $artifact_url
# Define common functions
Wait_apt() {
# Function to check if apt is locked
local lock_files=("/var/lib/dpkg/lock" "/var/lib/apt/lists/lock")
for lock_file in "${lock_files[@]}"; do
while fuser "${lock_file}" >/dev/null 2>&1 ; do
echo "${lock_file} is locked by another process. Waiting..."
sleep 5
done
done
echo "APT locks are not held by any processes. You can proceed."
}
export -f Wait_apt
install_tools(){
echo_prefix_tools=$'\n[Tools] - '
echo "$echo_prefix_tools Starting install necessary tool..."
@ -268,7 +287,7 @@ install_backends() {
if [ ! -z "$container_names" ]; then
echo "Deleting containers:"
echo $container_names
docker rm $container_names
docker rm -f $container_names 2>/dev/null
else
echo "No containers to delete."
fi
@ -291,7 +310,7 @@ install_systemd() {
fi
sudo cp -r $install_path/systemd/script/* "$systemd_path"
sudo cp -f "$systemd_path/websoft9.service" /lib/systemd/system/
sudo cp -f "$install_path/systemd/websoft9.service" /lib/systemd/system/
if [ $? -ne 0 ]; then
echo "Failed to copy Systemd service file."
exit 1

View file

@ -29,21 +29,6 @@ export PATH
docker_packages="docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
echo_prefix_docker=$'\n[Docker] - '
# Function to check if apt is locked
Wait_apt() {
local lock_files=("/var/lib/dpkg/lock" "/var/lib/apt/lists/lock")
for lock_file in "${lock_files[@]}"; do
while fuser "${lock_file}" >/dev/null 2>&1 ; do
echo "${lock_file} is locked by another process. Waiting..."
sleep 5
done
done
echo "APT locks are not held by any processes. You can proceed."
}
docker_exist() {
# 检查 `docker` 命令是否存在
if ! command -v docker &> /dev/null; then
@ -83,7 +68,6 @@ Install_Docker(){
# For Ubuntu, Debian, or Raspbian
if type apt >/dev/null 2>&1; then
Wait_apt
apt update
# Wait for apt to be unlocked
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
@ -111,7 +95,11 @@ if docker_exist; then
echo "Docker installed, but cannot upgrade"
fi
else
Install_Docker
export -f Install_Docker
timeout 300 bash -c Install_Docker
if [ $? -eq 124 ]; then
echo "Install Docker timed out, Docker packages maybe can't download"
fi
fi
}
@ -122,8 +110,8 @@ if docker_exist; then
sudo systemctl enable docker
sudo systemctl restart docker
else
echo "Docker start failed, exit..."
exit
echo "Docker not installed or start failed, exit..."
exit 1
fi
}

View file

@ -1,5 +1,5 @@
{
"version": "0.8.26-rc5",
"version": "0.8.26-rc6",
"plugins": {
"portainer": "0.0.6",
"nginx": "0.0.5",