Browse Source

Look for and run the correct executable name.

master
poikilos 3 years ago
parent
commit
2cb322091c
  1. 1
      docker/finetestserver.rc
  2. 61
      docker/lmk.devuan-chimaera.sh
  3. 2
      docker/server-finetest-devuan-chimaera/build-and-check.sh

1
docker/finetestserver.rc

@ -0,0 +1 @@
finetestserver_bin=/opt/linux-minetest-kit/minetest/bin/finetestserver

61
docker/lmk.devuan-chimaera.sh

@ -27,6 +27,8 @@ if [ ! -f "$this_rc" ]; then
fi fi
source $this_rc source $this_rc
if [ $? -ne 0 ]; then exit 1; fi if [ $? -ne 0 ]; then exit 1; fi
source finetestserver.rc
if [ $? -ne 0 ]; then exit 1; fi
if [ ! -d "$libraries_image_dir" ]; then if [ ! -d "$libraries_image_dir" ]; then
echo "Error: $0 must run from the directory containing the container image directory: $libraries_image_dir" echo "Error: $0 must run from the directory containing the container image directory: $libraries_image_dir"
exit 1 exit 1
@ -139,12 +141,11 @@ END
# ^ output is $container_name # ^ output is $container_name
if [ "@$container_Id" != "@" ]; then if [ "@$container_Id" != "@" ]; then
echo "* The container already appears to be set up." echo "* The container already appears to be set up, so checking for the image will not be attempted."
exit 0 else
fi echo "There is no container_Id for container_name=$container_name, so checking for image:"
echo "There is no container_Id for container_name=$container_name, so checking for image:" sudo docker image inspect $server_image --format "* docker is looking for the image..."
sudo docker image inspect $server_image --format "* docker is looking for the image..." if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
echo "NOT FOUND, so:" echo "NOT FOUND, so:"
echo "* building $server_image ($server_image_dir inherits $libraries_image, so using built libraries from that should work)..." echo "* building $server_image ($server_image_dir inherits $libraries_image, so using built libraries from that should work)..."
if [ ! -d "$server_image_dir" ]; then if [ ! -d "$server_image_dir" ]; then
@ -157,19 +158,24 @@ if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
else else
echo "* using existing $server_image" echo "* using existing $server_image"
fi
fi fi
if [ "@$container_Id" = "@" ]; then if [ "@$container_Id" = "@" ]; then
# sudo docker run --name $container_name $libraries_image $run_all_build_commands_script # sudo docker run --name $container_name $libraries_image $run_all_build_commands_script
# ^ build was moved to the Dockerfile # ^ build was moved to the Dockerfile
if [ "@$finetestserver_bin" = "@" ]; then
echo "Error: The image is not fully described since finetestserver_bin is blank. No container will be created."
exit 1
fi
echo "* creating container $container_name from image $server_image" echo "* creating container $container_name from image $server_image"
sudo docker run --name $container_name $server_image /opt/linux-minetest-kit/minetest/minetestserver sudo docker run --name $container_name $server_image $finetestserver_bin
code=$? code=$?
if [ $code -ne 0 ]; then if [ $code -ne 0 ]; then
cat <<END cat <<END
* building within the container FAILED * $finetestserver_bin FAILED
- Remove the container as follows: - Remove the container as follows:
sudo docker rm --force $container_name sudo docker rm --force $container_name
@ -179,17 +185,23 @@ if [ "@$container_Id" = "@" ]; then
sudo docker image prune --force sudo docker image prune --force
# --force: Don't prompt for confirmation. # --force: Don't prompt for confirmation.
- Then try again: - Then you may try again:
$0 $0
- However, first view errors and note the reason for the problem.
- If the program didn't complete startup view the startup error via:
sudo docker start $container_name --attach
- If the progam has an "ERROR[Main]" error, you need to edit
minetest.conf and then try the start subcommand above again.
END END
# exit $code exit $code
else else
echo "* building within the container completed OK" echo "* $finetestserver_bin completed OK"
fi fi
else else
echo "* The container already appears to be set up." echo "* using existing container named $container_name with Id $container_Id."
exit 0 # exit 0
fi fi
echo echo
# echo "If the build output appeared successful, ignore the error above and create the minetest client image as follows:" # echo "If the build output appeared successful, ignore the error above and create the minetest client image as follows:"
@ -244,14 +256,21 @@ How to use the image:
sudo docker ps -a sudo docker ps -a
# ^ List containers and show NAMES (The name is necessary for certain subcommands such as exec which operate on a running container). # ^ List containers and show NAMES (The name is necessary for certain subcommands such as exec which operate on a running container).
# -a: Show all containers including stopped ones.
sudo docker start $container_name sudo docker start $container_name
# ^ Start a container. This will merely run $run_all_build_commands_script again since that is the container's main process. # ^ Start a container. This will merely run $run_all_build_commands_script again since that is the container's main process.
sudo docker start $container_name --attach
# ^ Show messages while starting a container.
sudo docker logs $container_Id
# ^ Show logs for a container.
sudo docker attach $container_name sudo docker attach $container_name
# ^ attach the current terminal to a running container. # ^ attach the current terminal to a running container.
sudo docker run $container_name sudo docker run --name $container_name $server_image $finetestserver_bin
# ^ "run" is merely a combination of "create" and "start" # ^ "run" is merely a combination of "create" and "start"
sudo docker -w $contained_repo exec $container_name ls -l $contained_repos sudo docker -w $contained_repo exec $container_name ls -l $contained_repos
@ -283,6 +302,18 @@ How to use the image:
# ^ Delete a container by its name. # ^ Delete a container by its name.
# --force: kill and delete running containers as well. # --force: kill and delete running containers as well.
sudo docker image inspect $libraries_image
sudo docker image inspect $server_image
# ^ Get JSON metadata for the image.
sudo docker container inspect $container_name
# ^ Get JSON metadata for the container.
- If the program didn't complete startup view the startup error via:
sudo docker start $container_name --attach
- If the progam has any "ERROR[Main]" error(s), you need to edit
minetest.conf and then try the start subcommand above again.
END END

2
docker/server-finetest-devuan-chimaera/build-and-check.sh

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
./mtcompile-program.pl build --finetest --server ./mtcompile-program.pl build --finetest --server
echo "Done './mtcompile-program.pl build --finetest --server' (returned $?)" echo "Done './mtcompile-program.pl build --finetest --server' (returned $?)"
good_flag_file_name=multicraftserver good_flag_file_name=finetestserver
good_flag_file=minetest/bin/$good_flag_file_name good_flag_file=minetest/bin/$good_flag_file_name
if [ -f "$good_flag_file" ]; then if [ -f "$good_flag_file" ]; then
echo "* forcing OK return since found \"$good_flag_file\" in `pwd`" echo "* forcing OK return since found \"$good_flag_file\" in `pwd`"

Loading…
Cancel
Save