netbootLLM / scripts /build.sh
Rafael Calleja
fix slash
901e3fc
raw
history blame contribute delete
845 Bytes
#!/bin/sh
# Function to create the structure
generate_structure() {
local dir_path=$1
local base_name=$(basename "$(dirname "$(dirname "$dir_path")")")
local version=$(basename "$(dirname "$dir_path")")
local flavor=$(basename "$dir_path")
# Defining the structure
echo " ${base_name}-${version}-${flavor}-squash-custom:"
echo " path: /${dir_path#./data/}"/
echo " files:"
# Listing files in the directory
for file in "$dir_path"/*; do
echo " - $(basename "$file")"
done
echo " os: ${base_name}-custom"
echo " version: '$version'"
echo " flavor: $flavor"
echo " kernel: ${base_name}-${version}-${flavor}-squash-custom"
echo ""
}
# Iterating over the directories inside 'data'
find ./data -mindepth 4 -maxdepth 4 -type d | while read -r dir; do
generate_structure "$dir"
done