Procházet zdrojové kódy

Tidying cryptopp utils

Bob Mottram před 7 roky
rodič
revize
f2429555a8
1 změnil soubory, kde provedl 20 přidání a 22 odebrání
  1. 20
    22
      src/freedombone-utils-cryptopp

+ 20
- 22
src/freedombone-utils-cryptopp Zobrazit soubor

@@ -32,22 +32,22 @@ CRYPTOPP_REPO="https://github.com/weidai11/cryptopp"
32 32
 CRYPTOPP_COMMIT='65e91a8caa8c1846cb311bc83d8507e12699d6d3'
33 33
 
34 34
 function mesh_install_cryptopp {
35
-    if [ ! -d $rootdir$INSTALL_DIR ]; then
36
-        chroot "$rootdir" mkdir -p $INSTALL_DIR
35
+    # shellcheck disable=SC2154
36
+    if [ ! -d "$rootdir$INSTALL_DIR" ]; then
37
+        chroot "$rootdir" mkdir -p "$INSTALL_DIR"
37 38
     fi
38 39
 
39 40
     chroot "$rootdir" apt-get -yq install build-essential
40 41
 
41
-    git clone $CRYPTOPP_REPO $rootdir$INSTALL_DIR/cryptopp
42
-    cd $rootdir$INSTALL_DIR/cryptopp
42
+    git clone "$CRYPTOPP_REPO" "$rootdir$INSTALL_DIR/cryptopp"
43
+    cd "$rootdir$INSTALL_DIR/cryptopp" || exit 346873625
43 44
     git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
44
-    mkdir $rootdir$INSTALL_DIR/cryptopp/build
45
+    mkdir "$rootdir$INSTALL_DIR/cryptopp/build"
45 46
 
46
-    cat <<EOF > $rootdir/root/install_cryptopp
47
+    cat <<EOF > "$rootdir/root/install_cryptopp"
47 48
 cd $INSTALL_DIR/cryptopp/build
48 49
 cmake ..
49
-make
50
-if [ ! "$?" = "0" ]; then
50
+if ! make; then
51 51
     exit 62825
52 52
 fi
53 53
 make install
@@ -58,18 +58,17 @@ EOF
58 58
 }
59 59
 
60 60
 function install_cryptopp {
61
-    if [ $INSTALLING_MESH ]; then
61
+    if [ "$INSTALLING_MESH" ]; then
62 62
         mesh_install_cryptopp
63 63
         return
64 64
     fi
65 65
 
66
-    if [ -d $INSTALL_DIR/cryptopp ]; then
67
-        if ! grep -q "Crypto++ commit:$CRYPTOPP_COMMIT" $COMPLETION_FILE; then
68
-            set_repo_commit $INSTALL_DIR/cryptopp "Crypto++ commit" "$CRYPTOPP_COMMIT" $CRYPTOPP_REPO
66
+    if [ -d "$INSTALL_DIR/cryptopp" ]; then
67
+        if ! grep -q "Crypto++ commit:$CRYPTOPP_COMMIT" "$COMPLETION_FILE"; then
68
+            set_repo_commit "$INSTALL_DIR/cryptopp" "Crypto++ commit" "$CRYPTOPP_COMMIT" "$CRYPTOPP_REPO"
69 69
             cd $INSTALL_DIR/cryptopp/build
70 70
             cmake ..
71
-            make
72
-            if [ ! "$?" = "0" ]; then
71
+            if ! make; then
73 72
                 exit 72581
74 73
             fi
75 74
             make install
@@ -80,20 +79,19 @@ function install_cryptopp {
80 79
         return
81 80
     fi
82 81
 
83
-    if [ ! -d $INSTALL_DIR ]; then
84
-        mkdir -p $INSTALL_DIR
82
+    if [ ! -d "$INSTALL_DIR" ]; then
83
+        mkdir -p "$INSTALL_DIR"
85 84
     fi
86 85
 
87 86
     apt-get -yq install build-essential
88 87
 
89
-    git_clone $CRYPTOPP_REPO $INSTALL_DIR/cryptopp
90
-    cd $INSTALL_DIR/cryptopp
88
+    git_clone "$CRYPTOPP_REPO" "$INSTALL_DIR/cryptopp"
89
+    cd "$INSTALL_DIR/cryptopp" || exit 257478246
91 90
     git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
92
-    mkdir -p $INSTALL_DIR/cryptopp/build
93
-    cd $INSTALL_DIR/cryptopp/build
91
+    mkdir -p "$INSTALL_DIR/cryptopp/build"
92
+    cd "$INSTALL_DIR/cryptopp/build" || exit 6275425427
94 93
     cmake ..
95
-    make
96
-    if [ ! "$?" = "0" ]; then
94
+    if ! make; then
97 95
         exit 62826
98 96
     fi
99 97
     make install