1
1
#! /bin/bash
2
2
3
- # Specify the directory path
4
- directory=" /opt/aptos/data"
3
+ # Specify the directory paths
4
+ data_dir=" /opt/aptos/data"
5
+ genesis_dir=" /opt/aptos/genesis"
5
6
6
- # Check if the directory exists
7
- if [ ! -d " $directory " ]; then
8
- # Create the directory if it doesn't exist
9
- if mkdir -p " $directory " 2> /dev/null; then
10
- echo " Directory '$directory ' created."
11
- else
12
- echo " Failed to create directory '$directory '. Please check permissions and try again with appropriate privileges (e.g., using sudo)."
7
+ # Check if the data directory exists
8
+ if [ ! -d " $data_dir " ]; then
9
+ # Create the data directory if it doesn't exist
10
+ if mkdir -p " $data_dir " 2> /dev/null; then
11
+ echo " Directory '$data_dir ' created."
12
+ else
13
+ echo " Failed to create directory '$data_dir '. Please check permissions and try again with appropriate privileges (e.g., using sudo)."
14
+ exit 1
15
+ fi
16
+ else
17
+ echo " Directory '$data_dir ' already exists."
18
+ fi
19
+
20
+ # Check if the genesis directory exists
21
+ if [ ! -d " $genesis_dir " ]; then
22
+ # Create the genesis directory if it doesn't exist
23
+ if mkdir -p " $genesis_dir " 2> /dev/null; then
24
+ echo " Directory '$genesis_dir ' created."
25
+ else
26
+ echo " Failed to create directory '$genesis_dir '. Please check permissions and try again with appropriate privileges (e.g., using sudo)."
27
+ exit 1
28
+ fi
29
+ else
30
+ echo " Directory '$genesis_dir ' already exists."
31
+ fi
32
+
33
+ # Download the genesis.blob file
34
+ echo " Downloading genesis.blob..."
35
+ curl -s https://devnet.aptoslabs.com/genesis.blob -o " $genesis_dir /genesis.blob"
36
+ if [ $? -eq 0 ]; then
37
+ echo " genesis.blob downloaded successfully."
38
+ else
39
+ echo " Failed to download genesis.blob. Please check your internet connection and try again."
13
40
exit 1
14
- fi
41
+ fi
42
+
43
+ # Download the waypoint.txt file
44
+ echo " Downloading waypoint.txt..."
45
+ curl -s https://devnet.aptoslabs.com/waypoint.txt -o " $genesis_dir /waypoint.txt"
46
+ if [ $? -eq 0 ]; then
47
+ echo " waypoint.txt downloaded successfully."
15
48
else
16
- echo " Directory '$directory ' already exists."
17
- fi
49
+ echo " Failed to download waypoint.txt. Please check your internet connection and try again."
50
+ exit 1
51
+ fi
0 commit comments