# ^ Execute a command in a running container (exec shows an error if the container isn't running).
# ^ Execute a command in a running container (exec shows an error if the container isn't running).
# This will not work if the run/start command that started the container isn't a command that keeps it open (runs indefinitely)!
# This will not work if the run/start command that started the container isn't a command that keeps it open (runs indefinitely)!
# If you need a container that has changes after $run_all_build_commands_script runs, you must use the "commit" subcommand.
# If you need a container that has changes after $run_all_build_commands_script runs or runs a different command, you must use the "commit" subcommand to create a new image.
# w: working directory
# w: working directory
sudo docker stop $container_name
sudo docker stop $container_name
@ -135,11 +152,16 @@ How to use the image:
# ^ Run an interactive terminal (Type 'exit' to exit)
# ^ Run an interactive terminal (Type 'exit' to exit)
# (based on <https://phoenixnap.com/kb/docker-run-command-with-examples>)
# (based on <https://phoenixnap.com/kb/docker-run-command-with-examples>)
@ -19,33 +19,7 @@ echo "* checking for $contained_good_repo_flag_path on the destination..."
ls $contained_good_repo_flag_path > /dev/null
ls $contained_good_repo_flag_path > /dev/null
if[$? -ne 0];then
if[$? -ne 0];then
echo"NOT FOUND"
echo"NOT FOUND"
printf"Warning: the Docker image isn't up to date. Unzipping manually..."
exit1
printf"checking for unzip..."
container_unzip="`which unzip`"
if["@$container_unzip"="@"];then
echo"NOT FOUND. Installing..."
# This should never happen if the Dockerfile was used.
apt-get update
if[$? -ne 0];thenexit 1;fi
apt-get install -y unzip
if[$? -ne 0];thenexit 1;fi
container_unzip="`which unzip`"
if["@$container_unzip"="@"];then
echo"Error: Installing unzip in the container did not succeed. Install unzip inside the container manually then try again, or extract linux-minetest-kit such that $contained_good_repo_flag_path exists."
# -d: is destination, like -C or --directory for tar.
# -v: verbose (prevents extraction)
if[$? -ne 0];then
echo"Error: unzip failed within the container. Install unzip inside the container manually then try again, or extract linux-minetest-kit such that $contained_good_repo_flag_path exists."
exit1
fi
else
else
echo"FOUND (already extracted)"
echo"FOUND (already extracted)"
fi
fi
@ -59,38 +33,6 @@ else
echo"* detected $contained_good_repo_flag_path (So the source directory is assumed to be ok)"
echo"* detected $contained_good_repo_flag_path (So the source directory is assumed to be ok)"
fi
fi
if["@$contained_user"="@"];then
echo"Error: contained_user can't be blank, or checking for the user within the container will not work."
exit1
fi
id -u $contained_user
if[$? -ne 0];then
printf"* creating $contained_user in container $container_name..."