Procházet zdrojové kódy

Generate cryptpad api config file after upgrades

Bob Mottram před 7 roky
rodič
revize
dd43031028
1 změnil soubory, kde provedl 14 přidání a 10 odebrání
  1. 14
    10
      src/freedombone-app-cryptpad

+ 14
- 10
src/freedombone-app-cryptpad Zobrazit soubor

76
     fi
76
     fi
77
 }
77
 }
78
 
78
 
79
+function cryptpad_generate_api_config {
80
+    if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
81
+        mkdir -p $CRYPTPAD_DIR/customize/api
82
+    fi
83
+    wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
84
+    if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
85
+        echo $'Unable to wget api/config'
86
+        exit 89252
87
+    fi
88
+    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
89
+}
90
+
79
 function upgrade_cryptpad {
91
 function upgrade_cryptpad {
80
     CURR_CRYPTPAD_COMMIT=$(get_completion_param "cryptpad commit")
92
     CURR_CRYPTPAD_COMMIT=$(get_completion_param "cryptpad commit")
81
     if [[ "$CURR_CRYPTPAD_COMMIT" == "$CRYPTPAD_COMMIT" ]]; then
93
     if [[ "$CURR_CRYPTPAD_COMMIT" == "$CRYPTPAD_COMMIT" ]]; then
90
 
102
 
91
     cd $CRYPTPAD_DIR
103
     cd $CRYPTPAD_DIR
92
     npm install
104
     npm install
93
-    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
105
+    cryptpad_generate_api_config
94
     su -c 'bower install' - cryptpad
106
     su -c 'bower install' - cryptpad
95
 
107
 
96
     systemctl start cryptpad
108
     systemctl start cryptpad
544
 
556
 
545
     sleep 6
557
     sleep 6
546
 
558
 
547
-    if [ ! -d $CRYPTPAD_DIR/customize/api ]; then
548
-        mkdir -p $CRYPTPAD_DIR/customize/api
549
-    fi
550
-    wget 127.0.0.1:$CRYPTPAD_PORT/api/config -O $CRYPTPAD_DIR/customize/api/config
551
-    if [ ! -f $CRYPTPAD_DIR/customize/api/config ]; then
552
-        echo $'Unable to wget api/config'
553
-        exit 89252
554
-    fi
555
-    chown -R cryptpad:cryptpad $CRYPTPAD_DIR
559
+    cryptpad_generate_api_config
556
 
560
 
557
     # install again
561
     # install again
558
     cd $CRYPTPAD_DIR
562
     cd $CRYPTPAD_DIR