build: add even more hack to this very ugly shell script.