Преглед изворни кода

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram пре 8 година
родитељ
комит
79ddfdf178

+ 1
- 1
src/freedombone-app-gnusocial Прегледај датотеку

@@ -37,7 +37,7 @@ GNUSOCIAL_DOMAIN_NAME=
37 37
 GNUSOCIAL_CODE=
38 38
 GNUSOCIAL_ONION_PORT=8087
39 39
 GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
40
-GNUSOCIAL_COMMIT='d61375cb7fd9e3ac2dbba2b22d0d6461fb753892'
40
+GNUSOCIAL_COMMIT='d9fbc17f7745edb3e3eeddf6485f70b187df762f'
41 41
 GNUSOCIAL_ADMIN_PASSWORD=
42 42
 
43 43
 GNUSOCIAL_BACKGROUND_IMAGE_URL=

+ 48
- 18
src/freedombone-app-gogs Прегледај датотеку

@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
34 34
 SHOW_ON_ABOUT=1
35 35
 
36 36
 GOGS_USERNAME='gogs'
37
-GOGS_VERSION='0.11.4'
37
+GOGS_VERSION='0.11.29'
38 38
 
39 39
 GIT_DOMAIN_NAME=
40 40
 GIT_CODE=
@@ -158,9 +158,17 @@ function upgrade_gogs {
158 158
         return
159 159
     fi
160 160
 
161
-    GOGS_CONFIG_FILE=/home/${GOGS_USERNAME}/custom/conf/app.ini
161
+    GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
162
+    GOGS_CONFIG_FILE=$GOGS_CONFIG_PATH/app.ini
162 163
     cp $GOGS_CONFIG_FILE $INSTALL_DIR/gogs_config.ini
163 164
 
165
+    if [ -d $INSTALL_DIR/gogs-repositories ]; then
166
+        rm -rf $INSTALL_DIR/gogs-repositories
167
+    fi
168
+    if [ -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
169
+        mv /home/${GOGS_USERNAME}/gogs-repositories $INSTALL_DIR
170
+    fi
171
+
164 172
     gogs_parameters
165 173
     echo "gogs binary upgrade: ${GOGS_BIN}"
166 174
 
@@ -199,8 +207,23 @@ function upgrade_gogs {
199 207
         rm ${GOGS_FILE}
200 208
     fi
201 209
 
210
+    if [ ! -d ${GOGS_CONFIG_PATH} ]; then
211
+        mkdir -p ${GOGS_CONFIG_PATH}
212
+    fi
213
+
202 214
     cp $INSTALL_DIR/gogs_config.ini $GOGS_CONFIG_FILE
215
+    if [ ! -f $GOGS_CONFIG_FILE ]; then
216
+        echo $'Gogs ini file not upgraded'
217
+        exit 873535
218
+    fi
203 219
     rm $INSTALL_DIR/gogs_config.ini
220
+    if [ -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
221
+        rm -rf /home/${GOGS_USERNAME}/gogs-repositories
222
+    fi
223
+    if [ -d $INSTALL_DIR/gogs-repositories ]; then
224
+        mv $INSTALL_DIR/gogs-repositories /home/${GOGS_USERNAME}/gogs-repositories
225
+    fi
226
+    chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
204 227
 
205 228
     sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
206 229
     systemctl restart mariadb
@@ -233,26 +256,26 @@ function restore_local_gogs {
233 256
     if ! grep -q "gogs domain" ${COMPLETION_FILE}; then
234 257
         return
235 258
     fi
236
-    if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
237
-        return
238
-    fi
239 259
 
240 260
     if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then
241 261
         function_check gogs_create_database
242 262
         gogs_create_database
243 263
 
264
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
265
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
266
+
244 267
         function_check restore_database
245 268
         restore_database gogs ${GIT_DOMAIN_NAME}
246 269
         temp_restore_dir=/root/tempgogs
247 270
         if [ -d ${USB_MOUNT}/backup/gogs ]; then
248 271
             echo $"Restoring Gogs settings"
249
-            if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
250
-                mkdir -p /home/${GOGS_USERNAME}/custom
272
+            if [ ! -d $GOGS_CONFIG_PATH ]; then
273
+                mkdir -p $GOGS_CONFIG_PATH
251 274
             fi
252
-            if [ ! -d ${temp_restore_dir}/home/${GOGS_USERNAME}/custom ]; then
253
-                cp -r ${temp_restore_dir}/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom
275
+            if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
276
+                cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
254 277
             else
255
-                cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/custom/
278
+                cp -r /root/tempgogs/* /home/${GOGS_USERNAME}/custom/
256 279
             fi
257 280
             if [ ! "$?" = "0" ]; then
258 281
                 function_check set_user_permissions
@@ -264,10 +287,13 @@ function restore_local_gogs {
264 287
             echo $"Restoring Gogs repos"
265 288
             function_check restore_directory_from_usb
266 289
             restore_directory_from_usb ${temp_restore_dir}repos gogsrepos
267
-            if [ ! -d ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories ]; then
290
+            if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
291
+                mkdir /home/${GOGS_USERNAME}/gogs-repositories
292
+            fi
293
+            if [ -d ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories ]; then
268 294
                 cp -r ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
269 295
             else
270
-                cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/gogs-repositories/
296
+                cp -r ${temp_restore_dir}repos/* /home/${GOGS_USERNAME}/gogs-repositories/
271 297
             fi
272 298
             if [ ! "$?" = "0" ]; then
273 299
                 function_check set_user_permissions
@@ -300,11 +326,10 @@ function restore_local_gogs {
300 326
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
301 327
         fi
302 328
 
303
-        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
304
-        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
305 329
         MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
306 330
         sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
307 331
         MARIADB_PASSWORD=
332
+        systemctl restart gogs
308 333
     fi
309 334
 }
310 335
 
@@ -344,11 +369,14 @@ function restore_remote_gogs {
344 369
         function_check gogs_create_database
345 370
         gogs_create_database
346 371
 
372
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
373
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
374
+
347 375
         function_check restore_database_from_friend
348 376
         restore_database_from_friend gogs ${GIT_DOMAIN_NAME}
349 377
         if [ -d ${SERVER_DIRECTORY}/backup/gogs ]; then
350
-            if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
351
-                mkdir -p /home/${GOGS_USERNAME}/custom
378
+            if [ ! -d $GOGS_CONFIG_PATH ]; then
379
+                mkdir -p $GOGS_CONFIG_PATH
352 380
             fi
353 381
             if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
354 382
                 cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
@@ -360,6 +388,9 @@ function restore_remote_gogs {
360 388
             fi
361 389
             echo $"Restoring Gogs repos"
362 390
             restore_directory_from_friend /root/tempgogsrepos gogsrepos
391
+            if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
392
+                mkdir /home/${GOGS_USERNAME}/gogs-repositories
393
+            fi
363 394
             if [ -d /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories ]; then
364 395
                 cp -r /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
365 396
             else
@@ -388,11 +419,10 @@ function restore_remote_gogs {
388 419
             echo $"Restore of Gogs complete"
389 420
         fi
390 421
 
391
-        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
392
-        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
393 422
         MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
394 423
         sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
395 424
         MARIADB_PASSWORD=
425
+        systemctl restart gogs
396 426
     fi
397 427
 }
398 428
 

+ 19
- 19
src/freedombone-app-syncthing Прегледај датотеку

@@ -251,10 +251,10 @@ function upgrade_syncthing {
251 251
 }
252 252
 
253 253
 function backup_local_syncthing {
254
-    if [ -d /var/lib/syncthing/SyncShared ]; then
254
+    if [ -d $SYNCTHING_SHARED_DATA ]; then
255 255
         function_check backup_directory_to_usb
256
-        backup_directory_to_usb /var/lib/syncthing/SyncShared syncthingshared
257
-        backup_directory_to_usb /root/.config/syncthing syncthingconfig
256
+        backup_directory_to_usb $SYNCTHING_SHARED_DATA syncthingshared
257
+        backup_directory_to_usb $SYNCTHING_CONFIG_PATH syncthingconfig
258 258
     fi
259 259
 
260 260
     for d in /home/*/ ; do
@@ -294,10 +294,10 @@ function restore_local_syncthing {
294 294
         restore_directory_from_usb ${temp_restore_dir}config syncthingconfig
295 295
         #cp -r ${temp_restore_dir}config/* /
296 296
 
297
-        if [ ! -d /root/.config/syncthing ]; then
298
-            mkdir -p /root/.config/syncthing
297
+        if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
298
+            mkdir -p $SYNCTHING_CONFIG_PATH
299 299
         fi
300
-        cp -r ${temp_restore_dir}config/* /root/.config/syncthing/
300
+        cp -r ${temp_restore_dir}config/* $SYNCTHING_CONFIG_PATH/
301 301
 
302 302
         if [ ! "$?" = "0" ]; then
303 303
             set_user_permissions
@@ -314,10 +314,10 @@ function restore_local_syncthing {
314 314
         restore_directory_from_usb ${temp_restore_dir}shared syncthingshared
315 315
         #cp -r ${temp_restore_dir}shared/* /
316 316
 
317
-        if [ ! -d /var/lib/syncthing/SyncShared ]; then
318
-            mkdir -p /var/lib/syncthing/SyncShared
317
+        if [ ! -d $SYNCTHING_SHARED_DATA ]; then
318
+            mkdir -p $SYNCTHING_SHARED_DATA
319 319
         fi
320
-        cp -r ${temp_restore_dir}shared/* /var/lib/syncthing/SyncShared/
320
+        cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
321 321
 
322 322
         if [ ! "$?" = "0" ]; then
323 323
             set_user_permissions
@@ -373,16 +373,16 @@ function restore_local_syncthing {
373 373
 }
374 374
 
375 375
 function backup_remote_syncthing {
376
-    if [ -d /root/.config/syncthing ]; then
376
+    if [ -d $SYNCTHING_CONFIG_PATH ]; then
377 377
         echo $"Backing up syncthing configuration"
378 378
         function_check backup_directory_to_friend
379
-        backup_directory_to_friend /root/.config/syncthing syncthingconfig
379
+        backup_directory_to_friend $SYNCTHING_CONFIG_PATH syncthingconfig
380 380
         echo $"Backup of syncthing configuration complete"
381 381
     fi
382
-    if [ -d /var/lib/syncthing/SyncShared ]; then
382
+    if [ -d $SYNCTHING_SHARED_DATA ]; then
383 383
         echo $"Backing up syncthing shared files"
384 384
         function_check backup_directory_to_friend
385
-        backup_directory_to_friend /var/lib/syncthing/SyncShared syncthingshared
385
+        backup_directory_to_friend $SYNCTHING_SHARED_DATA syncthingshared
386 386
         echo $"Backup of syncthing shared files complete"
387 387
     fi
388 388
 
@@ -422,10 +422,10 @@ function restore_remote_syncthing {
422 422
         function_check restore_directory_from_friend
423 423
         restore_directory_from_friend $temp_restore_dir syncthingconfig
424 424
         #cp -r $temp_restore_dir/* /
425
-        if [ ! -d /root/.config/syncthing ]; then
426
-            mkdir -p /root/.config/syncthing
425
+        if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
426
+            mkdir -p $SYNCTHING_CONFIG_PATH
427 427
         fi
428
-        cp -r ${temp_restore_dir}config/* /root/.config/syncthing/
428
+        cp -r ${temp_restore_dir}config/* $SYNCTHING_CONFIG_PATH/
429 429
         if [ ! "$?" = "0" ]; then
430 430
             systemctl start syncthing
431 431
             systemctl start cron
@@ -440,10 +440,10 @@ function restore_remote_syncthing {
440 440
         function_check restore_directory_from_friend
441 441
         restore_directory_from_friend $temp_restore_dir syncthingshared
442 442
         #cp -r $temp_restore_dir/* /
443
-        if [ ! -d /var/lib/syncthing/SyncShared ]; then
444
-            mkdir -p /var/lib/syncthing/SyncShared
443
+        if [ ! -d $SYNCTHING_SHARED_DATA ]; then
444
+            mkdir -p $SYNCTHING_SHARED_DATA
445 445
         fi
446
-        cp -r ${temp_restore_dir}shared/* /var/lib/syncthing/SyncShared/
446
+        cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
447 447
         if [ ! "$?" = "0" ]; then
448 448
             systemctl start syncthing
449 449
             systemctl start cron

+ 0
- 15
src/freedombone-base-tripwire Прегледај датотеку

@@ -146,21 +146,6 @@ function install_tripwire {
146 146
 
147 147
        ' | twadmin --create-polfile -S /etc/tripwire/${HOSTNAME}-site.key /etc/tripwire/twpol.txt
148 148
 
149
-    # create the database
150
-    echo '
151
-
152
-' | tripwire --init --cfgfile /etc/tripwire/tw.cfg --polfile /etc/tripwire/tw.pol --dbfile /var/lib/tripwire/${HOSTNAME}.twd
153
-    if [ ! -f /var/lib/tripwire/${HOSTNAME}.twd ]; then
154
-        echo $'tripwire database was not created'
155
-        exit 72925
156
-    fi
157
-    # recreate the configuration
158
-    echo '
159
-
160
-
161
-
162
-       ' | reset-tripwire
163
-
164 149
     mark_completed $FUNCNAME
165 150
 }
166 151
 

+ 3
- 0
src/freedombone-utils-gnusocialtools Прегледај датотеку

@@ -563,6 +563,9 @@ function gnusocial_block_user_script {
563 563
     echo "nickname=\$(echo \"\$remove_user\" | awk -F '@' '{print \$1}')" >> /usr/bin/gnusocial-delete-user
564 564
     echo "remove_domain=\$(echo \"\$remove_user\" | awk -F '@' '{print \$2}')" >> /usr/bin/gnusocial-delete-user
565 565
     echo '' >> /usr/bin/gnusocial-delete-user
566
+    echo "database_query=\"delete from notice where content REGEXP '\@\${remove_user}';\"" >> /usr/bin/gnusocial-delete-user
567
+    echo 'mysql -u root --password="$MARIADB_PASSWORD" -e "$database_query" $database_name' >> /usr/bin/gnusocial-delete-user
568
+    echo '' >> /usr/bin/gnusocial-delete-user
566 569
     echo 'database_query="select profile.id from profile where nickname = '"'"'${nickname}'"'"' and profileurl like '"'"'%${remove_domain}%'"'"';"' >> /usr/bin/gnusocial-delete-user
567 570
     echo 'declare -a ids=$(mysql -u root --password="$MARIADB_PASSWORD" << EOF' >> /usr/bin/gnusocial-delete-user
568 571
     echo 'use $database_name;' >> /usr/bin/gnusocial-delete-user