This commit is contained in:
parent
3a33936cd4
commit
f45378237c
10 changed files with 9620 additions and 32 deletions
|
|
@ -100,28 +100,14 @@ current_config=$(cat "$CONFIG_FILE")
|
|||
# Create the compiled installer
|
||||
print_status "Compiling installer with embedded configuration..."
|
||||
|
||||
# Create temporary file for processing
|
||||
temp_file=$(mktemp)
|
||||
|
||||
# Process the template and replace the placeholder
|
||||
{
|
||||
# Read template line by line
|
||||
while IFS= read -r line; do
|
||||
# Check if this line starts the here document
|
||||
if [[ "$line" == *"sudo tee \"\$config_dir/paths.json\""* ]]; then
|
||||
echo "$line"
|
||||
# Skip the next line (PATHS_JSON_PLACEHOLDER)
|
||||
read -r placeholder_line
|
||||
# Output the current configuration
|
||||
echo "$current_config"
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done < "$TEMPLATE_FILE"
|
||||
} > "$temp_file"
|
||||
|
||||
# Move to final location
|
||||
mv "$temp_file" "$OUTPUT_FILE"
|
||||
# Create the compiled installer by replacing the placeholder using awk
|
||||
awk -v json="$current_config" '
|
||||
/PATHS_JSON_PLACEHOLDER/ {
|
||||
print json
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' "$TEMPLATE_FILE" > "$OUTPUT_FILE"
|
||||
|
||||
# Make it executable
|
||||
chmod +x "$OUTPUT_FILE"
|
||||
|
|
|
|||
|
|
@ -184,8 +184,9 @@ install_apt_layer() {
|
|||
sudo mkdir -p "$config_dir"
|
||||
|
||||
# Create paths.json configuration
|
||||
sudo tee "$config_dir/paths.json" >/dev/null << 'PATHS_JSON_PLACEHOLDER'
|
||||
sudo tee "$config_dir/paths.json" >/dev/null <<EOF
|
||||
PATHS_JSON_PLACEHOLDER
|
||||
EOF
|
||||
|
||||
# Set proper permissions
|
||||
sudo chmod 644 "$config_dir/paths.json"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue