More bash script adjustments for linux

This commit is contained in:
2024-09-10 05:17:55 -04:00
parent 1afb7289ca
commit 4f296cd96d
2 changed files with 28 additions and 21 deletions

View File

@@ -1,31 +1,40 @@
#!/bin/bash #!/bin/bash
set -e
path_root="$(git rev-parse --show-toplevel)" path_root="$(git rev-parse --show-toplevel)"
path_backend="$path_root/backend" path_backend="$path_root/backend"
path_build="$path_root/build" path_build="$path_root/build"
path_scripts="$path_root/scripts" path_scripts="$path_root/scripts"
path_thirdparty="$path_root/thirdparty" path_thirdparty="$path_root/thirdparty"
path_sokol="$path_thirdparty/sokol" path_sokol="."
path_sokol_examples="$path_sokol/examples" path_sokol_examples="./examples"
if [ -d "$path_sokol" ] && [ -d "$path_sokol/sokol" ]; then echo "Checking sokol directory structure..."
if [ ! -d "$path_sokol" ]; then
echo "Error: $path_sokol does not exist."
exit 1
fi
if [ -d "$path_sokol/sokol" ]; then
echo "Found nested sokol directory. Restructuring..."
mv "$path_sokol/sokol/"* "$path_sokol/" mv "$path_sokol/sokol/"* "$path_sokol/"
rmdir "$path_sokol/sokol" rmdir "$path_sokol/sokol"
rm -rf "$path_sokol_examples" echo "Nested sokol directory removed."
fi
# pushd "$path_sokol"
# Convert build_clibs_linux.sh to Unix line endings
if command -v dos2unix &> /dev/null; then
dos2unix "./build_clibs_linux.sh"
else else
sed -i 's/\r$//' "./build_clibs_linux.sh" echo "No nested sokol directory found. Skipping restructure."
fi fi
# Make sure the script is executable if [ -d "$path_sokol_examples" ]; then
chmod +x "./build_clibs_linux.sh" echo "Removing examples directory..."
rm -rf "$path_sokol_examples"
echo "Examples directory removed."
else
echo "No examples directory found. Skipping removal."
fi
pushd "$path_sokol"
check_and_install() { check_and_install() {
if ! dpkg -s $1 &> /dev/null; then if ! dpkg -s $1 &> /dev/null; then
@@ -50,4 +59,4 @@ check_and_install() {
# Run the build script # Run the build script
./build_clibs_linux.sh ./build_clibs_linux.sh
# popd popd

View File

@@ -102,10 +102,8 @@ update_git_repo() {
verify_path() { verify_path() {
local path="$1" local path="$1"
if [ -d "$path" ]; then if [ ! -d "$path" ]; then
return 0 mkdir -p "$path"
echo "Created directory: $path"
fi fi
}
mkdir -p "$path"
return 1
}