0

Unpacked the game, running sh start.sh results in:

start.sh: 2: cd: can't cd to start.sh
./hoi4: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory

start.sh:

#!/bin/bash
GAMEDIR=$(cd "${0%/*}" && echo $PWD)
cd "$GAMEDIR"
export LC_ALL=C
exec ./hoi4 "$@" 

The expectation was that the question would be accepted as error specific question.

janat08
  • 188

1 Answers1

1

The specific error you're getting is because of the way you are trying to execute the script (and the rather strange way the script is written).

When a script is run, positional parameter 0 contains the name by which the script was invoked, e.g. path/to/start.sh - or simply ./start.sh if it is called from the current directory. The parameter expansion syntax ${0%/*} removes the shortest suffix from $0 matching /* leaving (respectively) path/to or just . and the script then attempts to change to this directory - in other words, to the parent directory of start.sh

However, when you use sh start.sh (as well as executing the script using sh instead of the intended /bin/bash), $0 equals start.sh. Since there's no matching /, ${0%/*} doesn't remove anything from $0, resulting in the script trying to execute the command cd start.sh which obviously fails because start.sh is a file not a directory.

The solution is to execute the script the way the author presumably intended - that is, by ensuring it is executable

chmod +x start.sh

and then executing it directly, e.g.

./start.sh
steeldriver
  • 136,215
  • 21
  • 243
  • 336
  • Right one less error. – janat08 Jun 09 '16 at 02:20
  • After: http://askubuntu.com/questions/386281/error-while-loading-shared-libraries-libglu-so-1 for libglu issue.

    I'm now getting libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast

    – janat08 Jun 09 '16 at 02:36