-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.sh
More file actions
executable file
·92 lines (76 loc) · 2.79 KB
/
example.sh
File metadata and controls
executable file
·92 lines (76 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# Enable debug mode - print timestamp function
debug_print() {
local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
echo "[DEBUG][${timestamp}] $1"
}
# Error function with timestamp
error_print() {
local timestamp=$(date +"%Y-%m-%d %H:%M:%S")
echo "[ERROR][${timestamp}] $1" >&2
}
debug_print "Script starting: $(basename "$0")"
# Check if bun is installed
debug_print "Checking if bun is installed"
if ! command -v bun &> /dev/null; then
error_print "bun is not installed. Please install bun first: https://bun.sh/docs/installation"
exit 1
fi
debug_print "bun is installed: $(bun --version)"
# Print all commands before execution and exit on error
set -ex
# Get the directory where this script is located
debug_print "Getting script directory"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
debug_print "Script directory: ${script_dir}"
cd "${script_dir}"
debug_print "Changed working directory to: $(pwd)"
# Delete /tmp/docusaurus_test recursively if it exists
debug_print "Checking if /tmp/docusaurus_test exists"
if [ -d "/tmp/docusaurus_test" ]; then
debug_print "Removing existing /tmp/docusaurus_test directory"
rm -rf /tmp/docusaurus_test
debug_print "Removal complete"
else
debug_print "/tmp/docusaurus_test does not exist, no need to remove"
fi
# Create destination directory
debug_print "Creating destination directory: /tmp/docusaurus_test"
mkdir -p /tmp/docusaurus_test
debug_print "Directory created"
# Copy template and example directories to /tmp/docusaurus_test using rsync
debug_print "Copying template directory contents to destination root"
rsync -a "${script_dir}/template/" /tmp/docusaurus_test/
debug_print "Template directory contents copied to root"
debug_print "Copying example directory contents to destination root"
rsync -a "${script_dir}/example/" /tmp/docusaurus_test/
debug_print "Example directory contents copied to root"
# List files in the destination to verify copy
debug_print "Contents of /tmp/docusaurus_test: $(ls -la /tmp/docusaurus_test)"
# Change to the destination directory
debug_print "Changing to destination directory"
cd /tmp/docusaurus_test
debug_print "Current directory: $(pwd)"
# Run bun install
debug_print "Running bun install to install dependencies"
bun install
debug_print "bun install completed"
# Execute build.sh
# debug_print "Executing build.sh"
# if [ -f "./build.sh" ]; then
# ./build.sh
# debug_print "build.sh execution completed"
# else
# error_print "build.sh not found in current directory"
# exit 1
# fi
# Execute develop.sh
debug_print "Executing develop.sh"
if [ -f "./develop.sh" ]; then
./develop.sh
debug_print "develop.sh execution completed"
else
error_print "develop.sh not found in current directory"
exit 1
fi
debug_print "Script execution completed: $(basename "$0")"