소스 검색

string comparison fix (#1220)

mmetc 3 년 전
부모
커밋
9c9639d19b
1개의 변경된 파일12개의 추가작업 그리고 13개의 파일을 삭제
  1. 12 13
      debian/postinst

+ 12 - 13
debian/postinst

@@ -18,7 +18,7 @@ if [ "$1" = configure ]; then
         /usr/bin/cscli hub upgrade
         /usr/bin/cscli hub upgrade
         systemctl start crowdsec
         systemctl start crowdsec
     fi
     fi
-    
+
     . /usr/share/crowdsec/wizard.sh -n
     . /usr/share/crowdsec/wizard.sh -n
     if ! [[ -f /etc/crowdsec/acquis.yaml ]]; then
     if ! [[ -f /etc/crowdsec/acquis.yaml ]]; then
         echo Creating /etc/crowdsec/acquis.yaml
         echo Creating /etc/crowdsec/acquis.yaml
@@ -36,7 +36,7 @@ if [ "$1" = configure ]; then
     if [[ -f /etc/crowdsec/online_api_credentials.yaml ]]; then
     if [[ -f /etc/crowdsec/online_api_credentials.yaml ]]; then
         chmod 600 /etc/crowdsec/online_api_credentials.yaml
         chmod 600 /etc/crowdsec/online_api_credentials.yaml
     fi
     fi
-    
+
     if [[ ! -f /etc/crowdsec/local_api_credentials.yaml ]] || [[ ! -f /etc/crowdsec/online_api_credentials.yaml ]]; then
     if [[ ! -f /etc/crowdsec/local_api_credentials.yaml ]] || [[ ! -f /etc/crowdsec/online_api_credentials.yaml ]]; then
         if [[ ! -f /etc/crowdsec/local_api_credentials.yaml ]] ; then
         if [[ ! -f /etc/crowdsec/local_api_credentials.yaml ]] ; then
             install -m 600 /dev/null  /etc/crowdsec/local_api_credentials.yaml
             install -m 600 /dev/null  /etc/crowdsec/local_api_credentials.yaml
@@ -47,41 +47,41 @@ if [ "$1" = configure ]; then
 
 
         db_input medium crowdsec/lapi || true
         db_input medium crowdsec/lapi || true
         db_go || true
         db_go || true
-        
+
         db_get crowdsec/lapi
         db_get crowdsec/lapi
         LAPI=$RET
         LAPI=$RET
 
 
         if  [ "$LAPI" = true ]; then
         if  [ "$LAPI" = true ]; then
             db_input medium crowdsec/capi || true
             db_input medium crowdsec/capi || true
             db_go || true
             db_go || true
-            
+
             db_get crowdsec/capi
             db_get crowdsec/capi
             CAPI=$RET
             CAPI=$RET
-            
+
             cscli machines add -a
             cscli machines add -a
-        
+
             if [ "$CAPI" = true ]; then
             if [ "$CAPI" = true ]; then
                 cscli capi register
                 cscli capi register
             fi
             fi
-           
+
         else
         else
             db_input medium crowdsec/lapi_host || true
             db_input medium crowdsec/lapi_host || true
             db_go || true
             db_go || true
-            
+
             db_get crowdsec/lapi_host
             db_get crowdsec/lapi_host
             LAPI_HOST=$RET
             LAPI_HOST=$RET
             sed -i "s/127.0.0.1:8080/$LAPI_HOST/g" /etc/crowdsec/config.yaml
             sed -i "s/127.0.0.1:8080/$LAPI_HOST/g" /etc/crowdsec/config.yaml
         fi
         fi
     fi
     fi
+
     echo Updating hub
     echo Updating hub
     /usr/bin/cscli hub update
     /usr/bin/cscli hub update
-    if [ $COLLECTIONS=true ]; then
+    if [ "$COLLECTIONS" = true ]; then
         set +e
         set +e
         CSCLI_BIN_INSTALLED="/usr/bin/cscli" SILENT=true install_collection
         CSCLI_BIN_INSTALLED="/usr/bin/cscli" SILENT=true install_collection
         set -e
         set -e
-    fi   
-        
-    
+    fi
+
     if [[ -f /var/lib/crowdsec/data/crowdsec.db.backup ]]; then
     if [[ -f /var/lib/crowdsec/data/crowdsec.db.backup ]]; then
         cp /var/lib/crowdsec/data/crowdsec.db.backup /var/lib/crowdsec/data/crowdsec.db
         cp /var/lib/crowdsec/data/crowdsec.db.backup /var/lib/crowdsec/data/crowdsec.db
         rm -f /var/lib/crowdsec/data/crowdsec.db.backup
         rm -f /var/lib/crowdsec/data/crowdsec.db.backup
@@ -97,5 +97,4 @@ if [ "$1" = configure ]; then
     fi
     fi
 fi
 fi
 
 
-
 echo "You can always run the configuration again interactively by using '/usr/share/crowdsec/wizard.sh -c"
 echo "You can always run the configuration again interactively by using '/usr/share/crowdsec/wizard.sh -c"