-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate-release-link.sh
More file actions
executable file
·84 lines (64 loc) · 2.64 KB
/
update-release-link.sh
File metadata and controls
executable file
·84 lines (64 loc) · 2.64 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
#!/bin/bash
release_version=$1
mac_link_dymension=$2
mac_link_near=$3
windows_download_link_dymension=$4
windows_preview_link_dymension=$5
windows_download_link_near=$6
windows_preview_link_near=$7
if [ -z "${release_version}" ]; then
echo "Please specify the release version"
exit 0
fi
if [ -z "${mac_link_dymension}" ]; then
echo "Please specify the mac link for dymension"
exit 0
fi
if [ -z "${mac_link_near}" ]; then
echo "Please specify the mac link for near"
exit 0
fi
if [ -z "${windows_download_link_dymension}" ]; then
echo "Please specify the windows link for dymension"
exit 0
fi
if [ -z "${windows_preview_link_dymension}" ]; then
echo "Please specify the windows preview link for dymension"
exit 0
fi
if [ -z "${windows_download_link_near}" ]; then
echo "Please specify the windows link for near"
exit 0
fi
if [ -z "${windows_preview_link_near}" ]; then
echo "Please specify the windows preview link for near"
exit 0
fi
mac_link_dymension_escaped=$(printf '%s\n' "$mac_link_dymension" | sed -e 's/[\/&]/\\&/g')
mac_link_near_escaped=$(printf '%s\n' "$mac_link_near" | sed -e 's/[\/&]/\\&/g')
windows_download_link_dymension_escaped=$(printf '%s\n' "$windows_download_link_dymension" | sed -e 's/[\/&]/\\&/g')
windows_preview_link_dymension_escaped=$(printf '%s\n' "$windows_preview_link_dymension" | sed -e 's/[\/&]/\\&/g')
windows_download_link_near_escaped=$(printf '%s\n' "$windows_download_link_near" | sed -e 's/[\/&]/\\&/g')
windows_preview_link_near_escaped=$(printf '%s\n' "$windows_preview_link_near" | sed -e 's/[\/&]/\\&/g')
files=(
"README.md"
"node-hosting/start-a-node/README.md"
"node-hosting/start-a-node/start-a-node-windows.md"
"node-hosting/start-a-node/start-a-node-mac.md"
# "node-hosting/start-a-node/start-a-node-linux.md"
)
for file in "${files[@]}"
do
echo "processing file: $file"
cp "templates/$file" "gitbook/$file"
# replace file links
sed -i "s/RELEASE_VERSION/$release_version/g" "gitbook/$file"
sed -i "s/MAC_LINK_DYMENSION/$mac_link_dymension_escaped/g" "gitbook/$file"
sed -i "s/MAC_LINK_NEAR/$mac_link_near_escaped/g" "gitbook/$file"
sed -i "s/WINDOWS_DOWNLOAD_LINK_DYMENSION/$windows_download_link_dymension_escaped/g" "gitbook/$file"
sed -i "s/WINDOWS_PREVIEW_LINK_DYMENSION/$windows_preview_link_dymension_escaped/g" "gitbook/$file"
sed -i "s/WINDOWS_DOWNLOAD_LINK_NEAR/$windows_download_link_near_escaped/g" "gitbook/$file"
sed -i "s/WINDOWS_PREVIEW_LINK_NEAR/$windows_preview_link_near_escaped/g" "gitbook/$file"
# sed -i "s/LINUX_DOWNLOAD_LINK/$linux_download_link_escaped/g" "gitbook/$file"
# sed -i "s/LINUX_PREVIEW_LINK/$linux_preview_link_escaped/g" "gitbook/$file"
done