1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-02-01 20:31:51 +00:00

Update generate-app-headers.sh

This commit is contained in:
CanbiZ 2025-01-24 14:47:51 +01:00 committed by GitHub
parent 7c3ad9cfcf
commit 7723269bbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,13 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Base directory for headers
headers_dir="./ct/headers"
# Ensure the headers directory exists
mkdir -p "$headers_dir"
# Find all .sh files in ./ct directory, sorted alphabetically # Find all .sh files in ./ct directory, sorted alphabetically
find ./ct -type f -name "*.sh" | sort | while read -r script; do find ./ct -type f -name "*.sh" | sort | while read -r script; do
# Extract the APP name from the APP line # Extract the APP name from the APP line
app_name=$(grep -oP '^APP="\K[^"]+' "$script" 2>/dev/null) app_name=$(grep -oP '^APP="\K[^"]+' "$script" 2>/dev/null)
if [[ -n "$app_name" ]]; then if [[ -n "$app_name" ]]; then
# Define the output file name based on the .sh file # Define the output file name in the headers directory
output_file="${script%.sh}.app" output_file="${headers_dir}/$(basename "${script%.*}")"
# Check if the output file already exists # Check if the output file already exists
if [[ ! -f "$output_file" ]]; then if [[ ! -f "$output_file" ]]; then