qq2clone/gen_all.bash

40 lines
1003 B
Bash
Executable File

#!/bin/bash
# Generate an installer script using the most recent version of qq2clone
declare -a arc_files=( qq2clone lv_api_do qq2clone.1
qq2clone-completion.bash )
declare -a req_files=( "${arc_files[@]}" inst_fragment.bash lv_api_do.c man.pandoc )
has_req=1
for file in "${req_files[@]}"; do
if [[ ! -e "$file" ]]; then
has_req=0
echo "Current working directory missing file '$file'"
fi
done
((has_req)) || exit 1
echo "Generating script"
{
echo "#!/bin/bash"
echo
echo "# This script generated automatically by gen_installer.bash"
echo
echo "archive='"
tar -cz "${arc_files[@]}" | base64
echo "'"
echo
cat inst_fragment.bash
} > qq2clone_installer.bash
chmod +x qq2clone_installer.bash
# Generate manual from pandoc source in two formats
echo "Generating manual"
pandoc -s -f markdown -t markdown_strict -o man.md man.pandoc
pandoc -s -f markdown -t man -o qq2clone.1 man.pandoc
# Compile lv_api_do
echo "Compiling lv_api_do"
gcc lv_api_do.c -o lv_api_do -lvirt