-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·110 lines (70 loc) · 2.6 KB
/
make.sh
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
##!/usr/bin/env bash
shopt -s extglob
shopt -s extquote
# shopt -s xpg_echo
set -f
declare -rx target='target/x86_64-unknown-linux-gnu'
# declare -rx target='target/x86_64-fortanix-unknown-sgx'
declare -rx build='debug'
declare -rx app_name='darkproto-proposal'
# declare -rx app_name="${1:-$app_name_def}"
if [[ "$1" == "help" || "$1" == "h" || "$1" == "?" || "$1" == "" ]]; then
echo
echo -e "bash $0 [ help/h/? | fmt | check | build | build release | submodules | submodules update | exec | exec_logging | exec_logging_cliout ]\n"
elif [[ "$1" == "fmt" ]]; then
echo "--check works since cargo-fmt 1.4.38"
cargo fmt -v --all --check ;
read -n 1 -s -p "Proceed with cargo fmt? [Enter/y|n] : " choice_fmt
echo -e "\n"
if [[ $choice_fmt == "y" || $choice_fmt == "" ]]; then
cargo fmt -v --all ;
else
echo
echo "Canceled"
fi
elif [[ "$1" == "check" ]]; then
cargo check ;
cargo clippy ;
elif [[ "$1" == "build" && "$2" == "" ]]; then
cargo build
elif [[ "$1" == "build" && "$2" == "release" ]]; then
cargo build --release
elif [[ "$1" == "submodules" && "$2" == "" ]]; then
git submodule status;
git submodule summary;
elif [[ "$1" == "submodules" && "$2" == "update" ]]; then
git submodule sync;
git submodule update --recursive --init;
elif [[ "$1" == "exec" ]]; then
read -n 1 -s -p "Proceed with command passing? [Enter/y|n] : " choice_exec
echo -e "\n"
if [[ $choice_exec == "y" || $choice_exec == "" ]]; then
./"${target}"/"${build}"/"${app_name}" "${@:2}"
else
echo
echo "Canceled"
fi
elif [[ "$1" == "exec_logging" ]]; then
read -n 1 -s -p "Proceed with command passing? [Enter/y|n] : " choice_exec
echo -e "\n"
if [[ $choice_exec == "y" || $choice_exec == "" ]]; then
sudo mkdir -v -p /var/log/"${app_name}"/
sudo chown -v -R $USER:$USER /var/log/"${app_name}"/
./"${target}"/"${build}"/"${app_name}" "${@:2}" >> /var/log/"${app_name}"/"${app_name}"."${build}".log 2>&1 & disown
else
echo
echo "Canceled"
fi
elif [[ "$1" == "exec_logging_cliout" ]]; then
read -n 1 -s -p "Proceed with command passing? [Enter/y|n] : " choice_exec
echo -e "\n"
if [[ $choice_exec == "y" || $choice_exec == "" ]]; then
sudo mkdir -v -p /var/log/"${app_name}"/
sudo chown -v -R $USER:$USER /var/log/"${app_name}"/
./"${target}"/"${build}"/"${app_name}" "${@:2}" 2>&1 | tee -a /var/log/"${app_name}"/"${app_name}"."${build}".log & disown
else
echo
echo "Canceled"
fi
fi