2024-12-20 14:53:02 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
function configure() {
|
|
|
|
|
echo "cp .post-commit-hook .git/hooks/post-commit">./configure.sh
|
|
|
|
|
|
|
|
|
|
read -p "Enter a name for this environment [development]: " envName
|
2024-12-20 14:55:49 -05:00
|
|
|
local envName=${envName:-development}
|
2024-12-20 14:53:02 -05:00
|
|
|
echo "git config set toolbox-dev-env.name ${envName}">>./configure.sh
|
|
|
|
|
|
|
|
|
|
read -p "Enter path of base image [registry.fedoraproject.org/fedora-toolbox]: " baseImage
|
|
|
|
|
local baseImage=${baseImage:-registry.fedoraproject.org/fedora-toolbox}
|
|
|
|
|
echo "git config set toolbox-dev-env.base-image.name ${baseImage}">>./configure.sh
|
|
|
|
|
|
|
|
|
|
read -p "Would you like to use a command to determine the base image version [y/N] " -n 1 -r
|
|
|
|
|
echo
|
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
|
|
|
read -p "Enter command to determine base image version: " baseImageVersionCommand
|
|
|
|
|
echo "git config set toolbox-dev-env.base-image.version-script '${baseImageVersionCommand}'">>./configure.sh
|
|
|
|
|
echo "git config unset toolbox-dev-env.base-image.version">>./configure.sh
|
|
|
|
|
else
|
|
|
|
|
read -p "Enter base image version: " baseImageVersion
|
|
|
|
|
echo "git config set toolbox-dev-env.base-image.version ${baseImageVersion}">>./configure.sh
|
|
|
|
|
echo "git config unset toolbox-dev-env.base-image.version-script">>./configure.sh
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function main() {
|
|
|
|
|
trap "rm -f configure.sh" 1 2 3
|
|
|
|
|
|
|
|
|
|
configure
|
|
|
|
|
chmod +x ./configure.sh
|
|
|
|
|
bash ./configure.sh
|
|
|
|
|
|
|
|
|
|
echo "Setup is now completed. Please commit 'configure.sh' to persist the configuration"
|
|
|
|
|
rm setup.sh
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main $@
|