File size: 827 Bytes
8932891
 
 
 
 
 
 
 
 
 
e4a5291
 
 
8932891
 
 
e4a5291
8932891
 
e4a5291
 
 
 
8932891
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

# 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}-custom:"
  echo "    path: /${dir_path#./}"
  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}-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