#!/bin/bash # Function to read input with prompt read_input() { read -p "$1: " $2 } # Read inputs read_input "Enter the path to the folder containing executable and dependencies" folder_path read_input "Enter the name for the output executable script (without extension)" script_name read_input "Enter the path to the executable to run within the bundled script (e.g., ./executable)" executable_path # Validate if the executable exists if [ ! -f "$executable_path" ]; then echo "Error: Executable '$executable_path' not found. Please provide a valid path." exit 1 fi # Get the absolute path of the folder containing the executable folder_path=$(dirname "$executable_path") # Create temporary directory and prepare for bundling temp_dir=$(mktemp -d) cp -r "$folder_path" "$temp_dir/" # Create tar archive, base64 encode it, and embed in the script base64_encoded=$(tar -czf - -C "$temp_dir" "$(basename "$folder_path")" | base64) cat
#!/bin/bash
# Function to read input with prompt
read_input() {
read -p "$1: " $2
}
# Read inputs
read_input "Enter the path to the folder containing executable and dependencies" folder_path
read_input "Enter the name for the output executable script (without extension)" script_name
read_input "Enter the path to the executable to run within the bundled script (e.g., ./executable)" executable_path
# Validate if the executable exists
if [ ! -f "$executable_path" ]; then
echo "Error: Executable '$executable_path' not found. Please provide a valid path."
exit 1
fi
# Get the absolute path of the folder containing the executable
folder_path=$(dirname "$executable_path")
# Create temporary directory and prepare for bundling
temp_dir=$(mktemp -d)
cp -r "$folder_path" "$temp_dir/"
# Create tar archive, base64 encode it, and embed in the script
base64_encoded=$(tar -czf - -C "$temp_dir" "$(basename "$folder_path")" | base64)
cat