Files
Cody Boone Ferguson 539e1dce7f Add 2014/endoh1/try.sh, fix rake.sh, format/typos
The rake.sh script had a typo where '1>&2' was just '1>2'.

The README.md and spoilers.md files were format and typo checked.

I believe this should complete 2014/endoh1.
2023-12-05 11:14:24 -08:00

45 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
if ! type -P rake >/dev/null 2>&1; then
echo "'rake' cannot be found." 1>&2
echo "'rake' must be installed to run make rake or $0." 1>&2
echo "" 1>&2
if ! type -P gem >/dev/null 2>&1; then
echo "" 1>&2
echo "'gem' cannot be found." 1>&2
echo "To install 'rake' you will need the 'gem' tool." 1>&2
echo "Please see the following GitHub repo for rubygems:" 1>&2
echo "" 1>&2
echo " https://github.com/rubygems/rubygems" 1>&2
echo "" 1>&2
echo "and then run:" 1>&2
echo "" 1>&2
echo " cd rubygems && exe/gem install rake" 1>&2
echo "" 1>&2
echo "and then try running make rake or running $0 again." 1>&2
else
echo "Please run the following command as root or via sudo:" 1>&2
echo ""
echo " gem install rake" 1>&2
echo "" 1>&2
echo "and then try running make rake or running $0 again" 1>&2
fi
exit 1
elif ! rake 2>&1; then
echo "" 1>&2
echo "It appears that using rake failed. Please try running the following" 1>&2
echo "command as root or via sudo: " 1>&2
echo "" 1>&2
echo " gem install ruby-minisat" 1>&2;
echo "" 1>&2
echo "and then try running make rake or $0 again" 1>&2
exit 1
elif [[ ! -x prog ]]; then
echo "" 1>&2
echo "could not compile prog" 1>&2
exit 1
else
./prog 1>&2
exit "$?"
fi