master
sh 48 lines 1.24 KB
Raw
1 #!/bin/bash
2
3 mylocation=$(dirname "${0}")
4
5 # Check if both parameters are provided
6 if [ $# -ne 2 ]; then
7 echo "Error: Incorrect number of parameters."
8 echo "Usage: $0 <source_directory> <destination_directory>"
9 exit 1
10 fi
11
12 # Get the parameters
13 src_dir="$1"
14 dest_dir="$2"
15
16 # Get the directory of this script
17 SCRIPT_DIR="$(dirname "$0")"
18
19 # Create a temporary batch file
20 temp_bat=$(mktemp --suffix=.bat)
21
22 # Write the contents to the temporary batch file
23 # Use cygpath directly within the heredoc
24 cat << EOF > "$temp_bat"
25 @echo off
26 set "PATH=%SYSTEMROOT%;$("${mylocation}/../../../packaging/windows/find-sdk-path.sh" --sdk -w);$("${mylocation}/../../../packaging/windows/find-sdk-path.sh" --visualstudio -w)"
27 call "$(cygpath -w -a "$SCRIPT_DIR/wevt_netdata_compile.bat")" "$(cygpath -w -a "$src_dir")" "$(cygpath -w -a "$dest_dir")"
28 EOF
29
30 # Execute the temporary batch file
31 echo
32 echo "Executing Windows Batch File..."
33 echo
34 cat "$temp_bat"
35 cmd.exe //c "$(cygpath -w -a "$temp_bat")"
36 exit_status=$?
37
38 # Remove the temporary batch file
39 rm "$temp_bat"
40
41 # Check the exit status
42 if [ $exit_status -eq 0 ]; then
43 echo "nd_wevents_compile.bat executed successfully."
44 else
45 echo "nd_wevents_compile.bat failed with exit status $exit_status."
46 fi
47
48 exit $exit_status