Browse Source

Tidying cryptopp utils

Bob Mottram 7 years ago
parent
commit
f2429555a8
1 changed files with 20 additions and 22 deletions
  1. 20
    22
      src/freedombone-utils-cryptopp

+ 20
- 22
src/freedombone-utils-cryptopp View File

32
 CRYPTOPP_COMMIT='65e91a8caa8c1846cb311bc83d8507e12699d6d3'
32
 CRYPTOPP_COMMIT='65e91a8caa8c1846cb311bc83d8507e12699d6d3'
33
 
33
 
34
 function mesh_install_cryptopp {
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
     fi
38
     fi
38
 
39
 
39
     chroot "$rootdir" apt-get -yq install build-essential
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
     git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
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
 cd $INSTALL_DIR/cryptopp/build
48
 cd $INSTALL_DIR/cryptopp/build
48
 cmake ..
49
 cmake ..
49
-make
50
-if [ ! "$?" = "0" ]; then
50
+if ! make; then
51
     exit 62825
51
     exit 62825
52
 fi
52
 fi
53
 make install
53
 make install
58
 }
58
 }
59
 
59
 
60
 function install_cryptopp {
60
 function install_cryptopp {
61
-    if [ $INSTALLING_MESH ]; then
61
+    if [ "$INSTALLING_MESH" ]; then
62
         mesh_install_cryptopp
62
         mesh_install_cryptopp
63
         return
63
         return
64
     fi
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
             cd $INSTALL_DIR/cryptopp/build
69
             cd $INSTALL_DIR/cryptopp/build
70
             cmake ..
70
             cmake ..
71
-            make
72
-            if [ ! "$?" = "0" ]; then
71
+            if ! make; then
73
                 exit 72581
72
                 exit 72581
74
             fi
73
             fi
75
             make install
74
             make install
80
         return
79
         return
81
     fi
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
     fi
84
     fi
86
 
85
 
87
     apt-get -yq install build-essential
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
     git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
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
     cmake ..
93
     cmake ..
95
-    make
96
-    if [ ! "$?" = "0" ]; then
94
+    if ! make; then
97
         exit 62826
95
         exit 62826
98
     fi
96
     fi
99
     make install
97
     make install