Skip to content

Commit

Permalink
meta-lxatac-software: containers: shellcheck container-{start,update}.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Leonard Göhrs <[email protected]>
  • Loading branch information
hnez committed Dec 15, 2023
1 parent bfc19c0 commit a3e4cfd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ if podman ps -a | grep -q debian; then
else
echo "INFO: No Debian container present. Starting a new one using Podman."
echo "ATTENTION: Container installation might require Internet access and correct system time!"
podman run -it --name=debian --hostname "${HOSTNAME}-debian" --privileged --network=host --volume=/home/:/home/ --volume=/srv/:/srv/ debian
hostname="$(hostname)"
podman run -it --name=debian --hostname "${hostname}-debian" --privileged --network=host --volume=/home/:/home/ --volume=/srv/:/srv/ debian

podmanerr=$?

if [ $podmanerr -ne 0 ]; then
echo "FAIL: Podman run failed with error code" $podmanerr
if [ "${podmanerr}" -ne 0 ]; then
echo "FAIL: Podman run failed with error code" "${podmanerr}"
echo "INFO: Checking the obligatory internet connection..."
wget -q --spider https://hub.docker.com

if [ $? -eq 0 ]; then

if wget -q --spider "https://hub.docker.com"; then
echo "INFO: Got connection with hub.docker.com"
echo "FAIL: Internet connection seems present, but podman failed anyways. Terminate."
else
echo "FAIL: Can not establish a connection to hub.docker.com"
echo "INFO: Try to connect to pengutronix.de"
wget -q --spider https://pengutronix.de

if [ $? -eq 0 ]; then

if wget -q --spider "https://pengutronix.de"; then
echo "INFO: Got connection with pengutronix.de"
echo "FAIL: Internet connection seems present, but hub.docker.com can not be reached to pull an image. Terminate."
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
#!/bin/sh

echo "ATTENTION: Container update requires Internet access and correct system time!"

echo "ATTENTION: Container update requires Internet access and correct system time!"

wget -q --spider https://hub.docker.com

if [ $? -eq 0 ]; then
if wget -q --spider "https://hub.docker.com"; then
echo "INFO: Got connection with hub.docker.com"
else
echo "FAIL: Can not establish a connection to hub.docker.com"
echo "INFO: Try to connect to pengutronix.de"
wget -q --spider https://pengutronix.de

if [ $? -eq 0 ]; then
if wget -q --spider "https://pengutronix.de"; then
echo "INFO: Got connection with pengutronix.de"
echo "FAIL: Internet connection seems present, but hub.docker.com can not be reached to pull an image. Terminate."
else
Expand Down

0 comments on commit a3e4cfd

Please sign in to comment.