open/lego-config.sh
QunSheng Lin e220b36391
Some checks are pending
Build / build_app (push) Waiting to run
Build / build (386, linux) (push) Blocked by required conditions
Build / build (amd64, darwin) (push) Blocked by required conditions
Build / build (amd64, linux) (push) Blocked by required conditions
Build / build (arm, 5, linux) (push) Blocked by required conditions
Build / build (arm, 6, linux) (push) Blocked by required conditions
Build / build (arm, 7, linux) (push) Blocked by required conditions
Build / build (arm64, darwin) (push) Blocked by required conditions
Build / build (arm64, linux) (push) Blocked by required conditions
Build / build (loong64, linux) (push) Blocked by required conditions
Build / build (mips, linux) (push) Blocked by required conditions
Build / build (mips64, linux) (push) Blocked by required conditions
Build / build (mips64le, linux) (push) Blocked by required conditions
Build / build (mipsle, linux) (push) Blocked by required conditions
Build / build (riscv64, linux) (push) Blocked by required conditions
Build / docker-build (push) Blocked by required conditions
Build Documents / build (push) Waiting to run
nginx_ui_cn
2025-02-28 19:15:32 +08:00

44 lines
1.1 KiB
Bash

#!/bin/bash
# Download go-acme/lego repository
download_and_extract() {
local repo_url="https://github.com/go-acme/lego/archive/refs/heads/master.zip"
local target_dir="$1"
# Check if wget and unzip are installed
if ! command -v wget >/dev/null || ! command -v unzip >/dev/null; then
echo "Please ensure wget and unzip are installed."
exit 1
fi
# Download and extract the source code
wget -q -O lego-master.zip "$repo_url"
unzip -q lego-master.zip -d "$target_dir"
rm lego-master.zip
}
# Copy .toml files from providers to the specified directory
copy_toml_files() {
local source_dir="$1/lego-master/providers"
local target_dir="internal/cert/config"
# Remove the lego-master folder
if [ ! -d "$target_dir" ]; then
mkdir -p "$target_dir"
fi
# Copy .toml files
find "$source_dir" -type f -name "*.toml" -exec cp {} "$target_dir" \;
}
# Remove the lego-master folder
remove_lego_master_folder() {
local folder="$1/lego-master"
rm -rf "$folder"
}
destination="./tmp"
download_and_extract "$destination"
copy_toml_files "$destination"
remove_lego_master_folder "$destination"