Преглед на файлове

Use official owncloud deb

Bob Mottram преди 9 години
родител
ревизия
f2728c9780
променени са 7 файла, в които са добавени 895 реда и са изтрити 824 реда
  1. 165
    94
      src/freedombone
  2. 1
    1
      src/freedombone-adduser
  3. 6
    6
      src/freedombone-backup-local
  4. 257
    257
      src/freedombone-backup-remote
  5. 245
    245
      src/freedombone-restore-local
  6. 220
    220
      src/freedombone-restore-remote
  7. 1
    1
      src/freedombone-rmuser

+ 165
- 94
src/freedombone Целия файл

@@ -228,14 +228,14 @@ GVM_REPO="https://github.com/moovweb/gvm"
228 228
 GVM_COMMIT='25ea8ae158e2861c92e2b22c458e60840157832f'
229 229
 
230 230
 # Domain name for Owncloud installation
231
-OWNCLOUD_REPO="https://github.com/owncloud/core"
232
-OWNCLOUD_COMMIT='stable9'
233 231
 OWNCLOUD_DOMAIN_NAME=
234 232
 OWNCLOUD_CODE=
235 233
 OWNCLOUD_ONION_PORT=8088
236 234
 OWNCLOUD_ADMIN_PASSWORD=
237 235
 OWNCLOUD_MUSIC_APP_REPO="https://github.com/owncloud/music"
238 236
 OWNCLOUD_MUSIC_APP_COMMIT='0c0e1fadbe31a43f9c98d6a2a7b3960ff881ca0e'
237
+OWNCLOUD_PATH=/var/www/owncloud
238
+OWNCLOUD_UPGRADE_PATH=/root/owncloud_upgrade
239 239
 
240 240
 # Domain name for your wiki
241 241
 WIKI_DOMAIN_NAME=
@@ -616,6 +616,18 @@ function git_pull {
616 616
     fi
617 617
 }
618 618
 
619
+function remove_database {
620
+    app_name="$1"
621
+    if [ ! -d $INSTALL_DIR ]; then
622
+        mkdir $INSTALL_DIR
623
+    fi
624
+    echo "drop database ${app_name};
625
+quit" > $INSTALL_DIR/batch.sql
626
+    chmod 600 $INSTALL_DIR/batch.sql
627
+    mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql
628
+    shred -zu $INSTALL_DIR/batch.sql
629
+}
630
+
619 631
 function create_database {
620 632
     app_name="$1"
621 633
     app_admin_password="$2"
@@ -6285,7 +6297,7 @@ function install_mariadb {
6285 6297
         if [ -f $IMAGE_PASSWORD_FILE ]; then
6286 6298
             MARIADB_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
6287 6299
         else
6288
-            MARIADB_PASSWORD="$(openssl rand -base64 32)"
6300
+            MARIADB_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
6289 6301
         fi
6290 6302
         echo "$MARIADB_PASSWORD" > $DATABASE_PASSWORD_FILE
6291 6303
         chmod 600 $DATABASE_PASSWORD_FILE
@@ -6391,15 +6403,15 @@ function install_owncloud_repo_music_app {
6391 6403
     fi
6392 6404
 
6393 6405
     # update to the next commit
6394
-    set_repo_commit /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/apps/music "Owncloud music app commit" "$OWNCLOUD_MUSIC_APP_COMMIT" $OWNCLOUD_MUSIC_APP_REPO
6406
+    set_repo_commit $OWNCLOUD_PATH/apps/music "Owncloud music app commit" "$OWNCLOUD_MUSIC_APP_COMMIT" $OWNCLOUD_MUSIC_APP_REPO
6395 6407
 
6396 6408
     if grep -Fxq "install_owncloud_repo_music_app" $COMPLETION_FILE; then
6397 6409
         return
6398 6410
     fi
6399 6411
 
6400
-    cd /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/apps
6412
+    cd $OWNCLOUD_PATH/apps
6401 6413
     git_clone $OWNCLOUD_MUSIC_APP_REPO Music
6402
-    cd /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/apps/Music
6414
+    cd $OWNCLOUD_PATH/apps/Music
6403 6415
     git checkout $OWNCLOUD_MUSIC_APP_COMMIT -b $OWNCLOUD_MUSIC_APP_COMMIT
6404 6416
     if ! grep -q "Owncloud music app commit" $COMPLETION_FILE; then
6405 6417
         echo "Owncloud music app commit:$OWNCLOUD_MUSIC_APP_COMMIT" >> $COMPLETION_FILE
@@ -6464,74 +6476,120 @@ function configure_owncloud_onion_site {
6464 6476
     if [ ! $OWNCLOUD_DOMAIN_NAME ]; then
6465 6477
         return
6466 6478
     fi
6467
-    if [ ! -f /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config/config.php ]; then
6479
+    if [ ! -f /var/www/owncloud/config/config.php ]; then
6468 6480
         return
6469 6481
     fi
6470 6482
     if [ ! -f /var/lib/tor/hidden_service_owncloud/hostname ]; then
6471 6483
         return
6472 6484
     fi
6473 6485
     OWNCLOUD_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_owncloud/hostname)
6474
-    if ! grep -q "${OWNCLOUD_ONION_HOSTNAME}" /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config/config.php; then
6486
+    if ! grep -q "${OWNCLOUD_ONION_HOSTNAME}" /var/www/owncloud/config/config.php; then
6475 6487
         sed -i "s|0 => '${OWNCLOUD_DOMAIN_NAME}',|0 => '${OWNCLOUD_DOMAIN_NAME}',
6476
-    1 => '${OWNCLOUD_ONION_HOSTNAME}',|g" /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config/config.php
6488
+    1 => '${OWNCLOUD_ONION_HOSTNAME}',|g" /var/www/owncloud/config/config.php
6477 6489
         sed -i "s|'writable' => false,|'writable' => false,
6478 6490
     ),
6479 6491
     1 =>
6480 6492
     array (
6481
-      'path' => '/var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/apps',
6493
+      'path' => '/var/www/owncloud/apps',
6482 6494
       'url' => '/apps',
6483
-      'writable' => false,|g" /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config/config.php
6495
+      'writable' => false,|g" /var/www/owncloud/config/config.php
6484 6496
         echo $'Owncloud configured for onion site'
6485 6497
     fi
6486 6498
 }
6487 6499
 
6488
-function upgrade_owncloud {
6489
-    # upgrades from the debian packaged version to a repo based version
6490
-    # The debian package for Owncloud is likely to be removed in future debian releases
6500
+function upgrade_owncloud_start {
6501
+    # copies data and config directories to a temporary upgrade directory
6491 6502
     if [ ! -d /etc/owncloud ]; then
6492 6503
         return
6493 6504
     fi
6494 6505
 
6506
+    # remove any owncloud entries from completion
6507
+    sed -i 's/install_owncloud.*/d' $COMPLETION_FILE
6508
+    sed -i 's/owncloud.*/d' $COMPLETION_FILE
6509
+
6495 6510
     # create directories
6496
-    if [ ! -d /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/data ]; then
6497
-        mkdir /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/data
6511
+    if [ ! -d $OWNCLOUD_UPGRADE_PATH/data ]; then
6512
+        mkdir -p $OWNCLOUD_UPGRADE_PATH/data
6498 6513
     fi
6499
-    if [ ! -d /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config ]; then
6500
-        mkdir /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config
6514
+    if [ ! -d $OWNCLOUD_UPGRADE_PATH/config ]; then
6515
+        mkdir -p $OWNCLOUD_UPGRADE_PATH/config
6501 6516
     fi
6502 6517
 
6503
-    # move the data
6518
+    # copy data to the temporary directory
6504 6519
     if [ -d /var/lib/owncloud/data ]; then
6505
-        # copy users over
6506
-        cp -rf /var/lib/owncloud/data/* /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/data/
6507
-        # set ownership to www-data
6508
-        chown -R www-data:www-data /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/data
6520
+        cp -rf /var/lib/owncloud/data/* $OWNCLOUD_UPGRADE_PATH/data/
6509 6521
     fi
6510 6522
 
6511
-    # move the config files
6523
+    # copy the config files to the temporary directory
6512 6524
     if [ -d /etc/owncloud ]; then
6513
-        # copy users over
6514
-        cp -rf /etc/owncloud/* /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config/
6515
-        # set ownership to www-data
6516
-        chown -R www-data:www-data /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config
6525
+        cp -rf /etc/owncloud/* $OWNCLOUD_UPGRADE_PATH/config/
6526
+    fi
6527
+
6528
+    # remove the previous owncloud install
6529
+    apt-get -y remove --purge owncloud
6530
+
6531
+    # ensure directories do not exist
6532
+    rm -rf /etc/owncloud
6533
+    if [ -d /var/lib/owncloud ]; then
6534
+        rm -rf /var/lib/owncloud
6535
+    fi
6536
+}
6537
+
6538
+function upgrade_owncloud_finish {
6539
+    # copies data from a temporary upgrade directory to the new
6540
+    # owncloud install
6541
+    if [ ! -d $OWNCLOUD_PATH ]; then
6542
+        return
6543
+    fi
6544
+    if [ ! -d $OWNCLOUD_UPGRADE_PATH ]; then
6545
+        return
6546
+    fi
6547
+
6548
+    if [ ! -d $OWNCLOUD_PATH/data ]; then
6549
+        mkdir $OWNCLOUD_PATH/data
6550
+    fi
6551
+    cp -r $OWNCLOUD_UPGRADE_PATH/data/* $OWNCLOUD_PATH/data/
6552
+
6553
+    if [ ! -f $OWNCLOUD_PATH/config/config.php ]; then
6554
+        if [ ! -f $OWNCLOUD_PATH/config/config.sample.php ]; then
6555
+            echo $'No owncloud configuration sample file found'
6556
+            exit 54289
6557
+        fi
6558
+        cp $OWNCLOUD_PATH/config/config.sample.php $OWNCLOUD_PATH/config/config.php
6559
+    fi
6560
+
6561
+    if [ -f $OWNCLOUD_UPGRADE_PATH/config/config.php ]; then
6562
+        OWNCLOUD_INSTANCE_ID=$(cat config.php | grep "instanceid" | awk -F "'" '{print $4}')
6563
+        OWNCLOUD_PASSWORD_SALT=$(cat config.php | grep "passwordsalt" | awk -F "'" '{print $4}')
6564
+        OWNCLOUD_DATA_DIR=$(cat config.php | grep "datadirectory" | awk -F "'" '{print $4}')
6565
+        OWNCLOUD_DBTYPE=$(cat config.php | grep "dbtype" | awk -F "'" '{print $4}')
6566
+        OWNCLOUD_DBNAME=$(cat config.php | grep "dbname" | awk -F "'" '{print $4}')
6567
+        OWNCLOUD_DBHOST=$(cat config.php | grep "dbhost" | awk -F "'" '{print $4}')
6568
+        OWNCLOUD_DBUSER=$(cat config.php | grep "dbuser" | awk -F "'" '{print $4}')
6569
+        OWNCLOUD_DBPASS=$(cat config.php | grep "dbpassword" | awk -F "'" '{print $4}')
6570
+        OWNCLOUD_SECRET=$(cat config.php | grep "secret" | awk -F "'" '{print $4}')
6571
+
6572
+        sed -i "s|'instanceid'.*|'instanceid' => '$OWNCLOUD_INSTANCE_ID',|g" $OWNCLOUD_PATH/config/config.php
6573
+        sed -i "s|'passwordsalt'.*|'passwordsalt' => '$OWNCLOUD_PASSWORD_SALT',|g" $OWNCLOUD_PATH/config/config.php
6574
+        sed -i "s|'datadirectory'.*|'datadirectory' => '$OWNCLOUD_DATA_DIR',|g" $OWNCLOUD_PATH/config/config.php
6575
+        sed -i "s|'dbtype'.*|'dbtype' => '$OWNCLOUD_DBTYPE',|g" $OWNCLOUD_PATH/config/config.php
6576
+        sed -i "s|'dbname'.*|'dbname' => '$OWNCLOUD_DBNAME',|g" $OWNCLOUD_PATH/config/config.php
6577
+        sed -i "s|'dbhost'.*|'dbhost' => '$OWNCLOUD_DBHOST',|g" $OWNCLOUD_PATH/config/config.php
6578
+        sed -i "s|'dbuser'.*|'dbuser' => '$OWNCLOUD_DBUSER',|g" $OWNCLOUD_PATH/config/config.php
6579
+        sed -i "s|'dbpassword'.*|'dbpassword' => '$OWNCLOUD_DBPASS',|g" $OWNCLOUD_PATH/config/config.php
6580
+        sed -i "s|'secret'.*|'secret' => '$OWNCLOUD_SECRET',|g" $OWNCLOUD_PATH/config/config.php
6517 6581
     fi
6518 6582
 
6519 6583
     # re-index the files
6520 6584
     for d in /home/*/ ; do
6521 6585
         USRNAME=$(echo "$d" | awk -F '/' '{print $3}')
6522 6586
         if [[ $USRNAME != "git" && $USRNAME != "mirrors" ]]; then
6523
-            /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/occ files:scan $USRNAME
6587
+            $OWNCLOUD_PATH/occ files:scan $USRNAME
6524 6588
         fi
6525 6589
     done
6526
-
6527
-    # TODO enable this once upgrade is confirmed working
6528
-    #apt-get -y remove --purge owncloud
6529
-    #rm -rf /etc/owncloud
6530
-    #rm -rf /usr/share/owncloud
6531
-    #rm -rf /var/lib/owncloud
6532 6590
 }
6533 6591
 
6534
-function install_owncloud_from_repo {
6592
+function install_owncloud_official_deb {
6535 6593
     # new version not based on debian package
6536 6594
     if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
6537 6595
         return
@@ -6554,20 +6612,12 @@ function install_owncloud_from_repo {
6554 6612
         fi
6555 6613
     fi
6556 6614
 
6557
-    OWNCLOUD_PATH=/var/www/$OWNCLOUD_DOMAIN_NAME/htdocs
6558
-
6559
-    # was this previously installed from a package?
6560
-    WAS_INSTALLED_FROM_PACKAGE=
6561
-    if [ -d /etc/owncloud ]; then
6562
-        WAS_INSTALLED_FROM_PACKAGE='yes'
6563
-    fi
6564
-
6565
-    # update to a new commit if needed
6566
-    set_repo_commit $OWNCLOUD_PATH "Owncloud commit" "$OWNCLOUD_COMMIT" $OWNCLOUD_REPO
6615
+    # begin doing an upgrade if needed
6616
+    upgrade_owncloud_start
6567 6617
 
6568 6618
     OWNCLOUD_COMPLETION_MSG1=$" *** ${PROJECT_NAME} $SYSTEM_TYPE is now installed ***"
6569 6619
     OWNCLOUD_COMPLETION_MSG2=$"Open $OWNCLOUD_DOMAIN_NAME in a web browser to complete the setup"
6570
-    if grep -Fxq "install_owncloud_from_repo" $COMPLETION_FILE; then
6620
+    if grep -Fxq "install_owncloud_official_deb" $COMPLETION_FILE; then
6571 6621
         if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" ]]; then
6572 6622
             install_owncloud_repo_music_app
6573 6623
             backup_to_friends_servers
@@ -6596,43 +6646,30 @@ function install_owncloud_from_repo {
6596 6646
         echo $'Removed Apache installation after Owncloud install'
6597 6647
     fi
6598 6648
 
6599
-    # create the directory where owncloud will live
6600
-    if [ ! -d /var/www/$OWNCLOUD_DOMAIN_NAME ]; then
6601
-        mkdir /var/www/$OWNCLOUD_DOMAIN_NAME
6602
-    fi
6603
-
6604
-    # clone the owncloud repo
6605
-    cd /var/www/$OWNCLOUD_DOMAIN_NAME
6606
-    if [ -d $OWNCLOUD_PATH ]; then
6607
-        if [ $WAS_INSTALLED_FROM_PACKAGE ]; then
6608
-            # remove the existing link to /usr/share/owncloud
6609
-            rm $OWNCLOUD_PATH
6610
-            if [ -d $OWNCLOUD_PATH ]; then
6611
-                echo $'Tried to unlink old owncloud, but link remains'
6612
-                exit 67248
6613
-            fi
6614
-        fi
6615
-    fi
6616
-    git_clone $OWNCLOUD_REPO $OWNCLOUD_PATH
6617
-    cd $OWNCLOUD_PATH
6618
-    git checkout $OWNCLOUD_COMMIT -b $OWNCLOUD_COMMIT
6619
-
6620
-    # record the current commit
6621
-    if ! grep -q "Owncloud commit" $COMPLETION_FILE; then
6622
-        echo "Owncloud commit:$OWNCLOUD_COMMIT" >> $COMPLETION_FILE
6623
-    else
6624
-        sed -i "s/Owncloud commit.*/Owncloud commit:$OWNCLOUD_COMMIT/g" $COMPLETION_FILE
6649
+    # get the official owncloud deb package. Note that this is not the same as the one
6650
+    # from the debian repos, and doesn't follow the debian packaging guidelines
6651
+    cd $INSTALL_DIR
6652
+    wget -nv https://download.owncloud.org/download/repositories/stable/Debian_8.0/Release.key -O owncloud.key
6653
+    apt-key add - < owncloud.key
6654
+    if [ ! -f /etc/apt/sources.list.d/owncloud.list ]; then
6655
+        echo 'deb http://download.owncloud.org/download/repositories/stable/Debian_8.0/ /' >> /etc/apt/sources.list.d/owncloud.list
6625 6656
     fi
6657
+    apt-get update
6658
+    apt-get -y install owncloud
6626 6659
 
6627 6660
     install_mariadb
6628 6661
     get_mariadb_password
6662
+    if [ ! -d $OWNCLOUD_PATH ]; then
6663
+        echo $'Owncloud was not installed'
6664
+        exit 82584
6665
+    fi
6629 6666
 
6630 6667
     get_mariadb_owncloud_admin_password
6631 6668
     if [ ! $OWNCLOUD_ADMIN_PASSWORD ]; then
6632 6669
         if [ -f $IMAGE_PASSWORD_FILE ]; then
6633 6670
             OWNCLOUD_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
6634 6671
         else
6635
-            OWNCLOUD_ADMIN_PASSWORD="$(openssl rand -base64 32)"
6672
+            OWNCLOUD_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
6636 6673
         fi
6637 6674
     fi
6638 6675
 
@@ -6658,10 +6695,12 @@ function install_owncloud_from_repo {
6658 6695
         chmod 600 /home/$MY_USERNAME/README
6659 6696
     fi
6660 6697
 
6661
-    if [ ! $WAS_INSTALLED_FROM_PACKAGE ]; then
6662
-        create_database owncloud "$OWNCLOUD_ADMIN_PASSWORD"
6698
+    if [ -d /etc/owncloud ]; then
6699
+        remove_database owncloud
6663 6700
     fi
6664 6701
 
6702
+    create_database owncloud "$OWNCLOUD_ADMIN_PASSWORD"
6703
+
6665 6704
     if [[ $ONION_ONLY == "no" ]]; then
6666 6705
         nginx_http_redirect $OWNCLOUD_DOMAIN_NAME
6667 6706
         echo 'server {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
@@ -6849,7 +6888,40 @@ function install_owncloud_from_repo {
6849 6888
         echo "Owncloud domain:$OWNCLOUD_DOMAIN_NAME" >> $COMPLETION_FILE
6850 6889
     fi
6851 6890
 
6852
-    echo 'install_owncloud_from_repo' >> $COMPLETION_FILE
6891
+    upgrade_owncloud_finish
6892
+
6893
+    # copy the configuration file
6894
+    if [ ! -f $OWNCLOUD_PATH/config/config.php ]; then
6895
+        if [ ! -f $OWNCLOUD_PATH/config/config.sample.php ]; then
6896
+            echo $'No owncloud configuration sample file found'
6897
+            exit 54289
6898
+        fi
6899
+        cp $OWNCLOUD_PATH/config/config.sample.php $OWNCLOUD_PATH/config/config.php
6900
+    fi
6901
+
6902
+    if [ -f $OWNCLOUD_UPGRADE_PATH/config/config.php ]; then
6903
+        OWNCLOUD_INSTANCE_ID="$(openssl rand -base64 14 | cut -c1-12)"
6904
+        OWNCLOUD_PASSWORD_SALT="$(openssl rand -base64 32 | cut -c1-30)"
6905
+        OWNCLOUD_DATA_DIR='/var/www/owncloud/data'
6906
+        OWNCLOUD_DBTYPE='mysql'
6907
+        OWNCLOUD_DBNAME='owncloud'
6908
+        OWNCLOUD_DBHOST='localhost'
6909
+        OWNCLOUD_DBUSER="owncloudadmin"
6910
+        OWNCLOUD_DBPASS="$OWNCLOUD_ADMIN_PASSWORD"
6911
+        OWNCLOUD_SECRET="$(openssl rand -base64 32 | cut -c1-30)$(openssl rand -base64 32 | cut -c1-30)$(openssl rand -base64 32 | cut -c1-30)$(openssl rand -base64 32 | cut -c1-30)"
6912
+
6913
+        sed -i "s|'instanceid'.*|'instanceid' => '$OWNCLOUD_INSTANCE_ID',|g" $OWNCLOUD_PATH/config/config.php
6914
+        sed -i "s|'passwordsalt'.*|'passwordsalt' => '$OWNCLOUD_PASSWORD_SALT',|g" $OWNCLOUD_PATH/config/config.php
6915
+        sed -i "s|'datadirectory'.*|'datadirectory' => '$OWNCLOUD_DATA_DIR',|g" $OWNCLOUD_PATH/config/config.php
6916
+        sed -i "s|'dbtype'.*|'dbtype' => '$OWNCLOUD_DBTYPE',|g" $OWNCLOUD_PATH/config/config.php
6917
+        sed -i "s|'dbname'.*|'dbname' => '$OWNCLOUD_DBNAME',|g" $OWNCLOUD_PATH/config/config.php
6918
+        sed -i "s|'dbhost'.*|'dbhost' => '$OWNCLOUD_DBHOST',|g" $OWNCLOUD_PATH/config/config.php
6919
+        sed -i "s|'dbuser'.*|'dbuser' => '$OWNCLOUD_DBUSER',|g" $OWNCLOUD_PATH/config/config.php
6920
+        sed -i "s|'dbpassword'.*|'dbpassword' => '$OWNCLOUD_DBPASS',|g" $OWNCLOUD_PATH/config/config.php
6921
+        sed -i "s|'secret'.*|'secret' => '$OWNCLOUD_SECRET',|g" $OWNCLOUD_PATH/config/config.php
6922
+    fi
6923
+
6924
+    echo 'install_owncloud_official_deb' >> $COMPLETION_FILE
6853 6925
 
6854 6926
     if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" ]]; then
6855 6927
         install_owncloud_repo_music_app
@@ -6994,7 +7066,7 @@ function install_gogs {
6994 7066
         if [ -f $IMAGE_PASSWORD_FILE ]; then
6995 7067
             GIT_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
6996 7068
         else
6997
-            GIT_ADMIN_PASSWORD="$(openssl rand -base64 32)"
7069
+            GIT_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
6998 7070
         fi
6999 7071
     fi
7000 7072
 
@@ -7560,7 +7632,7 @@ function install_xmpp {
7560 7632
             if [ -f $IMAGE_PASSWORD_FILE ]; then
7561 7633
                 XMPP_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
7562 7634
             else
7563
-                XMPP_PASSWORD="$(openssl rand -base64 8)"
7635
+                XMPP_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
7564 7636
             fi
7565 7637
         fi
7566 7638
         prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME $XMPP_PASSWORD
@@ -7786,11 +7858,11 @@ function install_irc_server {
7786 7858
     sed -i 's/;MaxUsers = 23/MaxUsers = 23/g' /etc/ngircd/ngircd.conf
7787 7859
     sed -i "s|;KeyFile = /etc/ngircd/#chan.key|KeyFile = /etc/ngircd/#${PROJECT_NAME}.key|g" /etc/ngircd/ngircd.conf
7788 7860
     sed -i "s/;CloakHost = cloaked.host/CloakHost = ${PROJECT_NAME}/g" /etc/ngircd/ngircd.conf
7789
-    IRC_SALT="$(openssl rand -base64 32)"
7861
+    IRC_SALT="$(openssl rand -base64 32 | cut -c1-30)"
7790 7862
     if [ -f $IMAGE_PASSWORD_FILE ]; then
7791 7863
         IRC_OPERATOR_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
7792 7864
     else
7793
-        IRC_OPERATOR_PASSWORD="$(openssl rand -base64 8)"
7865
+        IRC_OPERATOR_PASSWORD="$(openssl rand -base64 10 | cut -c1-8)"
7794 7866
     fi
7795 7867
     sed -i "s|;CloakHostSalt = abcdefghijklmnopqrstuvwxyz|CloakHostSalt = $IRC_SALT|g" /etc/ngircd/ngircd.conf
7796 7868
     sed -i 's/;ConnectIPv4 = yes/ConnectIPv4 = yes/g' /etc/ngircd/ngircd.conf
@@ -7928,7 +8000,7 @@ function install_wiki {
7928 8000
         if [ -f $IMAGE_PASSWORD_FILE ]; then
7929 8001
             WIKI_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
7930 8002
         else
7931
-            WIKI_ADMIN_PASSWORD="$(openssl rand -base64 16)"
8003
+            WIKI_ADMIN_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
7932 8004
         fi
7933 8005
     fi
7934 8006
     HASHED_WIKI_PASSWORD=$(echo -n "$WIKI_ADMIN_PASSWORD" | md5sum | awk -F ' ' '{print $1}')
@@ -8523,7 +8595,7 @@ function install_blog {
8523 8595
         if [ -f $IMAGE_PASSWORD_FILE ]; then
8524 8596
             FULLBLOG_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
8525 8597
         else
8526
-            FULLBLOG_ADMIN_PASSWORD="$(openssl rand -base64 16)"
8598
+            FULLBLOG_ADMIN_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
8527 8599
         fi
8528 8600
         echo '' >> /home/$MY_USERNAME/README
8529 8601
         echo '' >> /home/$MY_USERNAME/README
@@ -8606,7 +8678,7 @@ function install_rss_reader {
8606 8678
         if [ -f $IMAGE_PASSWORD_FILE ]; then
8607 8679
             RSS_READER_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
8608 8680
         else
8609
-            RSS_READER_ADMIN_PASSWORD="$(openssl rand -base64 32)"
8681
+            RSS_READER_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
8610 8682
         fi
8611 8683
     fi
8612 8684
 
@@ -8883,7 +8955,7 @@ function install_gnu_social {
8883 8955
         if [ -f $IMAGE_PASSWORD_FILE ]; then
8884 8956
             MICROBLOG_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
8885 8957
         else
8886
-            MICROBLOG_ADMIN_PASSWORD="$(openssl rand -base64 32)"
8958
+            MICROBLOG_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
8887 8959
         fi
8888 8960
     fi
8889 8961
 
@@ -9430,7 +9502,7 @@ function install_search_engine {
9430 9502
 
9431 9503
     # replace the secret key
9432 9504
     if ! grep "Search engine key" $COMPLETION_FILE; then
9433
-        SEARCH_ENGINE_SECRET_KEY="$(openssl rand -base64 32)"
9505
+        SEARCH_ENGINE_SECRET_KEY="$(openssl rand -base64 32 | cut -c1-30)"
9434 9506
         echo "Search engine key:${SEARCH_ENGINE_SECRET_KEY}" >> $COMPLETION_FILE
9435 9507
     else
9436 9508
         SEARCH_ENGINE_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
@@ -9467,7 +9539,7 @@ function install_search_engine {
9467 9539
             if [ -f $IMAGE_PASSWORD_FILE ]; then
9468 9540
                 SEARCH_ENGINE_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
9469 9541
             else
9470
-                SEARCH_ENGINE_PASSWORD="$(openssl rand -base64 16)"
9542
+                SEARCH_ENGINE_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
9471 9543
             fi
9472 9544
         fi
9473 9545
         echo "$SEARCH_ENGINE_PASSWORD" | htpasswd -i -s -c /etc/nginx/.htpasswd $MY_USERNAME
@@ -9563,7 +9635,7 @@ function install_hubzilla {
9563 9635
         if [ -f $IMAGE_PASSWORD_FILE ]; then
9564 9636
             HUBZILLA_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
9565 9637
         else
9566
-            HUBZILLA_ADMIN_PASSWORD="$(openssl rand -base64 32)"
9638
+            HUBZILLA_ADMIN_PASSWORD="$(openssl rand -base64 32 | cut -c1-30)"
9567 9639
         fi
9568 9640
         echo '' >> /home/$MY_USERNAME/README
9569 9641
         echo '' >> /home/$MY_USERNAME/README
@@ -9795,7 +9867,7 @@ function install_hubzilla {
9795 9867
         echo "\$a->config['system']['baseurl'] = 'http://${HUBZILLA_ONION_HOSTNAME}';" >> $HUBZILLA_PATH/.htconfig.php
9796 9868
     fi
9797 9869
     echo "\$a->config['system']['sitename'] = \"Hubzilla\";" >> $HUBZILLA_PATH/.htconfig.php
9798
-    HUBZILLA_LOCATION_HASH="$(openssl rand -base64 32)"
9870
+    HUBZILLA_LOCATION_HASH="$(openssl rand -base64 32 | cut -c1-30)"
9799 9871
     echo "\$a->config['system']['location_hash'] = '${HUBZILLA_LOCATION_HASH}';" >> $HUBZILLA_PATH/.htconfig.php
9800 9872
     echo "\$a->config['system']['register_policy'] = REGISTER_OPEN;" >> $HUBZILLA_PATH/.htconfig.php
9801 9873
     echo "\$a->config['system']['register_text'] = '';" >> $HUBZILLA_PATH/.htconfig.php
@@ -10520,9 +10592,9 @@ function install_voip {
10520 10592
         if [ -f $IMAGE_PASSWORD_FILE ]; then
10521 10593
             VOIP_SERVER_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
10522 10594
         else
10523
-            VOIP_SERVER_PASSWORD="$(openssl rand -base64 16)"
10595
+            VOIP_SERVER_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
10524 10596
             if [ ${#VOIP_SERVER_PASSWORD} -lt $MINIMUM_PASSWORD_LENGTH ]; then
10525
-                VOIP_SERVER_PASSWORD="$(openssl rand -base64 16)"
10597
+                VOIP_SERVER_PASSWORD="$(openssl rand -base64 18 | cut -c1-16)"
10526 10598
             fi
10527 10599
         fi
10528 10600
     fi
@@ -10617,7 +10689,7 @@ function install_sip {
10617 10689
         if [ -f $IMAGE_PASSWORD_FILE ]; then
10618 10690
             SIP_SERVER_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
10619 10691
         else
10620
-            SIP_SERVER_PASSWORD="$(openssl rand -base64 10)"
10692
+            SIP_SERVER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"
10621 10693
         fi
10622 10694
     fi
10623 10695
 
@@ -10827,8 +10899,7 @@ script_for_attaching_usb_drive
10827 10899
 install_web_server
10828 10900
 install_web_server_access_control
10829 10901
 configure_firewall_for_web_server
10830
-install_owncloud_from_repo
10831
-upgrade_owncloud
10902
+install_owncloud_official_deb
10832 10903
 install_owncloud_repo_music_app
10833 10904
 configure_owncloud_onion_site
10834 10905
 upgrade_golang

+ 1
- 1
src/freedombone-adduser Целия файл

@@ -279,7 +279,7 @@ fi
279 279
 if grep -q "install_owncloud_repo" $COMPLETION_FILE; then
280 280
     export OC_PASS="$NEW_USER_PASSWORD"
281 281
     OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
282
-    /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/occ user:add --password-from-env --display-name="$MY_USERNAME" --group="users" $MY_USERNAME
282
+    /var/www/owncloud/occ user:add --password-from-env --display-name="$MY_USERNAME" --group="users" $MY_USERNAME
283 283
     if [ ! "$?" = "0" ]; then
284 284
         echo 'Owncloud user could not be added'
285 285
         if grep -q "install_xmpp" $COMPLETION_FILE; then

+ 6
- 6
src/freedombone-backup-local Целия файл

@@ -370,9 +370,9 @@ function backup_directories {
370 370
         "none,                               none,       /var/lib/tox-bootstrapd,                         tox"
371 371
         "/var/www/${MICROBLOG_DOMAIN_NAME},  gnusocial,  /root/tempgnusocialdata,                         gnusocialdata"
372 372
         "none,                               none,       /var/www/${MICROBLOG_DOMAIN_NAME}/htdocs,        gnusocial"
373
-        "/var/www/${OWNCLOUD_DOMAIN_NAME},   owncloud,   /root/tempowncloudrepodata,                      owncloudrepodata"
374
-        "none,                               none,       /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/data,    owncloudrepofiles"
375
-        "none,                               none,       /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config,  owncloudrepoconfig"
373
+        "/var/www/owncloud,                  owncloud,   /root/tempownclouddata,                          ownclouddata"
374
+        "none,                               none,       /var/www/owncloud/data,                          owncloudfiles"
375
+        "none,                               none,       /var/www/owncloud/config,                        owncloudconfig"
376 376
         "/var/www/${HUBZILLA_DOMAIN_NAME},   hubzilla,   /root/temphubzilladata,                          hubzilladata"
377 377
         "none,                               none,       /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs,         hubzilla"
378 378
         "none,                               none,       /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs,         blog"
@@ -530,9 +530,9 @@ function valid_backup_destination {
530 530
                 "$destination_dir" == "ssl" || \
531 531
                 "$destination_dir" == "ttrss" || \
532 532
                 "$destination_dir" == "blog" || \
533
-                "$destination_dir" == "owncloudrepofiles" || \
534
-                "$destination_dir" == "owncloudrepoconfig" || \
535
-                "$destination_dir" == "owncloudrepodata" || \
533
+                "$destination_dir" == "owncloudfiles" || \
534
+                "$destination_dir" == "owncloudconfig" || \
535
+                "$destination_dir" == "ownclouddata" || \
536 536
                 "$destination_dir" == "mailinglist" ]]; then
537 537
         is_valid="no"
538 538
     fi

+ 257
- 257
src/freedombone-backup-remote Целия файл

@@ -330,332 +330,332 @@ function backup_owncloud {
330 330
     if [ -d /etc/owncloud ]; then
331 331
         OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
332 332
         suspend_site ${OWNCLOUD_DOMAIN_NAME}
333
-        backup_database_to_friend owncloudrepo
334
-        backup_directory_to_friend /root/tempowncloudrepodata owncloudrepodata
333
+        backup_database_to_friend owncloud
334
+        backup_directory_to_friend /root/tempownclouddata ownclouddata
335 335
         echo $"Backing up Owncloud data"
336
-        if [ -d /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/data ]; then
337
-            backup_directory_to_friend /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/data owncloudrepofiles
338
-        fi
339
-        backup_directory_to_friend /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/config owncloudrepoconfig
340
-        restart_site
341
-    fi
336
+        if [ -d /var/www/owncloud/data ]; then
337
+            backup_directory_to_friend /var/www/owncloud/data owncloudfiles
338
+		fi
339
+		backup_directory_to_friend /var/www/owncloud/config owncloudconfig
340
+		restart_site
341
+	fi
342 342
 }
343 343
 
344 344
 function backup_gogs {
345
-    if [ -d /home/git/go/src/github.com/gogits ]; then
346
-        GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
347
-        suspend_site ${GIT_DOMAIN_NAME}
348
-        backup_database_to_friend gogs
349
-        backup_directory_to_friend /root/tempgogsdata gogsdata
350
-        echo $"Obtaining Gogs settings backup"
351
-        backup_directory_to_friend /home/git/go/src/github.com/gogits/gogs/custom gogs
352
-        echo $"Obtaining Gogs repos backup"
353
-        mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob
354
-        backup_directory_to_friend /home/git/gogs-repositories gogsrepos
355
-        echo $"Obtaining Gogs authorized_keys backup"
356
-        backup_directory_to_friend /home/git/.ssh gogsssh
357
-        restart_site
358
-    fi
345
+	if [ -d /home/git/go/src/github.com/gogits ]; then
346
+		GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
347
+		suspend_site ${GIT_DOMAIN_NAME}
348
+		backup_database_to_friend gogs
349
+		backup_directory_to_friend /root/tempgogsdata gogsdata
350
+		echo $"Obtaining Gogs settings backup"
351
+		backup_directory_to_friend /home/git/go/src/github.com/gogits/gogs/custom gogs
352
+		echo $"Obtaining Gogs repos backup"
353
+		mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob
354
+		backup_directory_to_friend /home/git/gogs-repositories gogsrepos
355
+		echo $"Obtaining Gogs authorized_keys backup"
356
+		backup_directory_to_friend /home/git/.ssh gogsssh
357
+		restart_site
358
+	fi
359 359
 }
360 360
 
361 361
 function backup_wiki {
362
-    if [ -d /etc/dokuwiki ]; then
363
-        echo $"Backing up wiki"
364
-        backup_directory_to_friend /var/lib/dokuwiki wiki
365
-        backup_directory_to_friend /etc/dokuwiki wiki2
366
-    fi
362
+	if [ -d /etc/dokuwiki ]; then
363
+		echo $"Backing up wiki"
364
+		backup_directory_to_friend /var/lib/dokuwiki wiki
365
+		backup_directory_to_friend /etc/dokuwiki wiki2
366
+	fi
367 367
 }
368 368
 
369 369
 function backup_blog {
370
-    if grep -q "Blog domain" $COMPLETION_FILE; then
371
-        FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
372
-        if [ -d /var/www/${FULLBLOG_DOMAIN_NAME} ]; then
373
-            echo $"Backing up blog"
374
-            backup_directory_to_friend /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs blog
375
-        else
376
-            echo $"Blog domain specified but not found in /var/www/${FULLBLOG_DOMAIN_NAME}"
377
-            exit 2578
378
-        fi
379
-    fi
370
+	if grep -q "Blog domain" $COMPLETION_FILE; then
371
+		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
372
+		if [ -d /var/www/${FULLBLOG_DOMAIN_NAME} ]; then
373
+			echo $"Backing up blog"
374
+			backup_directory_to_friend /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs blog
375
+		else
376
+			echo $"Blog domain specified but not found in /var/www/${FULLBLOG_DOMAIN_NAME}"
377
+			exit 2578
378
+		fi
379
+	fi
380 380
 }
381 381
 
382 382
 function backup_certs {
383
-    if [ -d /etc/ssl ]; then
384
-        echo $"Backing up certificates"
385
-        backup_directory_to_friend /etc/ssl ssl
386
-    fi
383
+	if [ -d /etc/ssl ]; then
384
+		echo $"Backing up certificates"
385
+		backup_directory_to_friend /etc/ssl ssl
386
+	fi
387 387
 }
388 388
 
389 389
 function backup_mailing_list {
390
-    if [ -d /var/spool/mlmmj ]; then
391
-        echo $"Backing up the public mailing list"
392
-        backup_directory_to_friend /var/spool/mlmmj mailinglist
393
-    fi
390
+	if [ -d /var/spool/mlmmj ]; then
391
+		echo $"Backing up the public mailing list"
392
+		backup_directory_to_friend /var/spool/mlmmj mailinglist
393
+	fi
394 394
 }
395 395
 
396 396
 function backup_xmpp {
397
-    if [ -d /var/lib/prosody ]; then
398
-        echo $"Backing up the XMPP settings"
399
-        backup_directory_to_friend /var/lib/prosody xmpp
400
-    fi
397
+	if [ -d /var/lib/prosody ]; then
398
+		echo $"Backing up the XMPP settings"
399
+		backup_directory_to_friend /var/lib/prosody xmpp
400
+	fi
401 401
 }
402 402
 
403 403
 function backup_web_server {
404
-    if [ -d /etc/nginx ]; then
405
-        echo $"Backing up web settings"
406
-        backup_directory_to_friend /etc/nginx/sites-available web
407
-    fi
404
+	if [ -d /etc/nginx ]; then
405
+		echo $"Backing up web settings"
406
+		backup_directory_to_friend /etc/nginx/sites-available web
407
+	fi
408 408
 }
409 409
 
410 410
 function backup_admin_readme {
411
-    if [ -f /home/$ADMIN_USERNAME/README ]; then
412
-        echo $"Backing up README"
413
-        if [ ! -d /home/$ADMIN_USERNAME/tempbackup ]; then
414
-            mkdir -p /home/$ADMIN_USERNAME/tempbackup
415
-        fi
416
-        cp -f /home/$ADMIN_USERNAME/README /home/$ADMIN_USERNAME/tempbackup
417
-        backup_directory_to_friend /home/$ADMIN_USERNAME/tempbackup readme
418
-    fi
411
+	if [ -f /home/$ADMIN_USERNAME/README ]; then
412
+		echo $"Backing up README"
413
+		if [ ! -d /home/$ADMIN_USERNAME/tempbackup ]; then
414
+			mkdir -p /home/$ADMIN_USERNAME/tempbackup
415
+		fi
416
+		cp -f /home/$ADMIN_USERNAME/README /home/$ADMIN_USERNAME/tempbackup
417
+		backup_directory_to_friend /home/$ADMIN_USERNAME/tempbackup readme
418
+	fi
419 419
 }
420 420
 
421 421
 function backup_ipfs {
422
-    if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
423
-        echo $"Backing up IPFS"
424
-        backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
425
-    fi
422
+	if [ -d /home/$ADMIN_USERNAME/.ipfs ]; then
423
+		echo $"Backing up IPFS"
424
+		backup_directory_to_friend /home/$ADMIN_USERNAME/.ipfs ipfs
425
+	fi
426 426
 }
427 427
 
428 428
 function backup_dlna {
429
-    if [ -d /var/cache/minidlna ]; then
430
-        echo $"Backing up DLNA cache"
431
-        backup_directory_to_friend /var/cache/minidlna dlna
432
-    fi
429
+	if [ -d /var/cache/minidlna ]; then
430
+		echo $"Backing up DLNA cache"
431
+		backup_directory_to_friend /var/cache/minidlna dlna
432
+	fi
433 433
 }
434 434
 
435 435
 function backup_voip {
436
-    if [ -f /etc/mumble-server.ini ]; then
437
-        echo $"Backing up VoIP settings"
438
-        if [ ! -d /root/tempvoipbackup ]; then
439
-            mkdir -p /root/tempvoipbackup
440
-        fi
441
-        cp -f /etc/mumble-server.ini /root/tempvoipbackup
442
-        cp -f /var/lib/mumble-server/mumble-server.sqlite /root/tempvoipbackup
443
-        cp -f /etc/sipwitch.conf /root/tempvoipbackup
444
-        backup_directory_to_friend /root/tempvoipbackup voip
445
-    fi
436
+	if [ -f /etc/mumble-server.ini ]; then
437
+		echo $"Backing up VoIP settings"
438
+		if [ ! -d /root/tempvoipbackup ]; then
439
+			mkdir -p /root/tempvoipbackup
440
+		fi
441
+		cp -f /etc/mumble-server.ini /root/tempvoipbackup
442
+		cp -f /var/lib/mumble-server/mumble-server.sqlite /root/tempvoipbackup
443
+		cp -f /etc/sipwitch.conf /root/tempvoipbackup
444
+		backup_directory_to_friend /root/tempvoipbackup voip
445
+	fi
446 446
 }
447 447
 
448 448
 function backup_tox {
449
-    if [ -d /var/lib/tox-bootstrapd ]; then
450
-        echo "Backing up Tox node settings"
451
-        if [ -d /var/lib/tox-bootstrapd/Maildir ]; then
452
-            rm -rf /var/lib/tox-bootstrapd/Maildir
453
-        fi
454
-        cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd
455
-        backup_directory_to_friend /var/lib/tox-bootstrapd tox
456
-    fi
449
+	if [ -d /var/lib/tox-bootstrapd ]; then
450
+		echo "Backing up Tox node settings"
451
+		if [ -d /var/lib/tox-bootstrapd/Maildir ]; then
452
+			rm -rf /var/lib/tox-bootstrapd/Maildir
453
+		fi
454
+		cp /etc/tox-bootstrapd.conf /var/lib/tox-bootstrapd
455
+		backup_directory_to_friend /var/lib/tox-bootstrapd tox
456
+	fi
457 457
 }
458 458
 
459 459
 function backup_mariadb {
460
-    if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
461
-        if [ ! -d /root/tempmariadb ]; then
462
-            mkdir /root/tempmariadb
463
-        fi
464
-        mysqldump --password=$DATABASE_PASSWORD mysql user > /root/tempmariadb/mysql.sql
465
-        if [ ! -s /root/tempmariadb/mysql.sql ]; then
466
-            echo $"Unable to backup MariaDB settings"
467
-            rm -rf /root/tempmariadb
468
-            # Send a warning email
469
-            echo $"Unable to export database settings" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
470
-            exit 653
471
-        fi
472
-        echo "$DATABASE_PASSWORD" > /root/tempmariadb/db
473
-        chmod 400 /root/tempmariadb/db
474
-        backup_directory_to_friend /root/tempmariadb mariadb
475
-    fi
460
+	if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
461
+		if [ ! -d /root/tempmariadb ]; then
462
+			mkdir /root/tempmariadb
463
+		fi
464
+		mysqldump --password=$DATABASE_PASSWORD mysql user > /root/tempmariadb/mysql.sql
465
+		if [ ! -s /root/tempmariadb/mysql.sql ]; then
466
+			echo $"Unable to backup MariaDB settings"
467
+			rm -rf /root/tempmariadb
468
+			# Send a warning email
469
+			echo $"Unable to export database settings" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
470
+			exit 653
471
+		fi
472
+		echo "$DATABASE_PASSWORD" > /root/tempmariadb/db
473
+		chmod 400 /root/tempmariadb/db
474
+		backup_directory_to_friend /root/tempmariadb mariadb
475
+	fi
476 476
 }
477 477
 
478 478
 # Returns the filename of a key share
479 479
 function get_key_share {
480
-    no_of_shares=$1
481
-    USERNAME="$2"
482
-    REMOTE_DOMAIN="$3"
480
+	no_of_shares=$1
481
+	USERNAME="$2"
482
+	REMOTE_DOMAIN="$3"
483 483
 
484
-    # Get a share index based on the supplied domain name
485
-    # This ensures that the same share is always given to the same domain
486
-    sharenumstr=$(md5sum <<< "$REMOTE_DOMAIN")
487
-    share_index=$(echo $((0x${sharenumstr%% *} % ${no_of_shares})) | tr -d -)
484
+	# Get a share index based on the supplied domain name
485
+	# This ensures that the same share is always given to the same domain
486
+	sharenumstr=$(md5sum <<< "$REMOTE_DOMAIN")
487
+	share_index=$(echo $((0x${sharenumstr%% *} % ${no_of_shares})) | tr -d -)
488 488
 
489
-    # get the filename
490
-    share_files=(/home/$USERNAME/.gnupg_fragments/keyshare.asc.*)
491
-    share_filename=${share_files[share_index]}
489
+	# get the filename
490
+	share_files=(/home/$USERNAME/.gnupg_fragments/keyshare.asc.*)
491
+	share_filename=${share_files[share_index]}
492 492
 
493
-    echo "$share_filename"
493
+	echo "$share_filename"
494 494
 }
495 495
 
496 496
 function disperse_key_shares {
497
-    USERNAME=$1
498
-    REMOTE_DOMAIN=$2
499
-    REMOTE_SSH_PORT=$3
500
-    REMOTE_PASSWORD=$4
501
-    REMOTE_SERVER=$5
502
-
503
-    if [ -d /home/$USERNAME/.gnupg_fragments ]; then
504
-        if [ $REMOTE_DOMAIN ]; then
505
-            cd /home/$USERNAME/.gnupg_fragments
506
-            no_of_shares=$(ls -afq keyshare.asc.* | wc -l)
507
-            if (( no_of_shares > 1 )); then
508
-                share_filename=$(get_key_share $no_of_shares "$USERNAME" "$REMOTE_DOMAIN")
509
-
510
-                # create a temp directory containing the share
511
-                temp_key_share_dir=/home/$USERNAME/tempkey
512
-                temp_key_share_fragments=$temp_key_share_dir/.gnupg_fragments_${USERNAME}
513
-                mkdir -p $temp_key_share_fragments
514
-                cp $share_filename $temp_key_share_fragments/
515
-
516
-                # copy the fragments directory to the remote server
517
-                /usr/bin/sshpass -p "$REMOTE_PASSWORD" \
518
-                                 scp -r -P $REMOTE_SSH_PORT $temp_key_share_fragments $REMOTE_SERVER
519
-                if [ ! "$?" = "0" ]; then
520
-                    # Send a warning email
521
-                    echo "Key share to $REMOTE_SERVER failed" | \
522
-                        mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
523
-                else
524
-                    # Send a confirmation email
525
-                    echo "Key ${share_filename} shared to $REMOTE_SERVER" | \
526
-                        mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
527
-                fi
528
-
529
-                # remove the temp file/directory
530
-                shred -zu $temp_key_share_fragments/*
531
-                rm -rf $temp_key_share_dir
532
-            fi
533
-        fi
534
-    fi
497
+	USERNAME=$1
498
+	REMOTE_DOMAIN=$2
499
+	REMOTE_SSH_PORT=$3
500
+	REMOTE_PASSWORD=$4
501
+	REMOTE_SERVER=$5
502
+
503
+	if [ -d /home/$USERNAME/.gnupg_fragments ]; then
504
+		if [ $REMOTE_DOMAIN ]; then
505
+			cd /home/$USERNAME/.gnupg_fragments
506
+			no_of_shares=$(ls -afq keyshare.asc.* | wc -l)
507
+			if (( no_of_shares > 1 )); then
508
+				share_filename=$(get_key_share $no_of_shares "$USERNAME" "$REMOTE_DOMAIN")
509
+
510
+				# create a temp directory containing the share
511
+				temp_key_share_dir=/home/$USERNAME/tempkey
512
+				temp_key_share_fragments=$temp_key_share_dir/.gnupg_fragments_${USERNAME}
513
+				mkdir -p $temp_key_share_fragments
514
+				cp $share_filename $temp_key_share_fragments/
515
+
516
+				# copy the fragments directory to the remote server
517
+				/usr/bin/sshpass -p "$REMOTE_PASSWORD" \
518
+								 scp -r -P $REMOTE_SSH_PORT $temp_key_share_fragments $REMOTE_SERVER
519
+				if [ ! "$?" = "0" ]; then
520
+					# Send a warning email
521
+					echo "Key share to $REMOTE_SERVER failed" | \
522
+						mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
523
+				else
524
+					# Send a confirmation email
525
+					echo "Key ${share_filename} shared to $REMOTE_SERVER" | \
526
+						mail -s "${PROJECT_NAME} social key management" $MY_EMAIL_ADDRESS
527
+				fi
528
+
529
+				# remove the temp file/directory
530
+				shred -zu $temp_key_share_fragments/*
531
+				rm -rf $temp_key_share_dir
532
+			fi
533
+		fi
534
+	fi
535 535
 }
536 536
 
537 537
 function valid_backup_destination {
538
-    destination_dir="$1"
539
-    is_valid="yes"
540
-
541
-    if [[ "$destination_dir" == "hubzilla" || \
542
-                "$destination_dir" == "hubzilladata" || \
543
-                "$destination_dir" == "gogs" || \
544
-                "$destination_dir" == "gogsrepos" || \
545
-                "$destination_dir" == "gogsssh" || \
546
-                "$destination_dir" == "gnusocial" || \
547
-                "$destination_dir" == "gnusocialdata" || \
548
-                "$destination_dir" == "mariadb" || \
549
-                "$destination_dir" == "config" || \
550
-                "$destination_dir" == "letsencrypt" || \
551
-                "$destination_dir" == "wiki" || \
552
-                "$destination_dir" == "wiki2" || \
553
-                "$destination_dir" == "xmpp" || \
554
-                "$destination_dir" == "ipfs" || \
555
-                "$destination_dir" == "dlna" || \
556
-                "$destination_dir" == "tox" || \
557
-                "$destination_dir" == "ssl" || \
558
-                "$destination_dir" == "blog" || \
559
-                "$destination_dir" == "owncloudrepofiles" || \
560
-                "$destination_dir" == "owncloudrepoconfig" || \
561
-                "$destination_dir" == "owncloudrepodata" || \
562
-                "$destination_dir" == "mailinglist" ]]; then
563
-        is_valid="no"
564
-    fi
565
-
566
-    echo $is_valid
538
+	destination_dir="$1"
539
+	is_valid="yes"
540
+
541
+	if [[ "$destination_dir" == "hubzilla" || \
542
+				"$destination_dir" == "hubzilladata" || \
543
+				"$destination_dir" == "gogs" || \
544
+				"$destination_dir" == "gogsrepos" || \
545
+				"$destination_dir" == "gogsssh" || \
546
+				"$destination_dir" == "gnusocial" || \
547
+				"$destination_dir" == "gnusocialdata" || \
548
+				"$destination_dir" == "mariadb" || \
549
+				"$destination_dir" == "config" || \
550
+				"$destination_dir" == "letsencrypt" || \
551
+				"$destination_dir" == "wiki" || \
552
+				"$destination_dir" == "wiki2" || \
553
+				"$destination_dir" == "xmpp" || \
554
+				"$destination_dir" == "ipfs" || \
555
+				"$destination_dir" == "dlna" || \
556
+				"$destination_dir" == "tox" || \
557
+				"$destination_dir" == "ssl" || \
558
+				"$destination_dir" == "blog" || \
559
+				"$destination_dir" == "owncloudfiles" || \
560
+				"$destination_dir" == "owncloudconfig" || \
561
+				"$destination_dir" == "ownclouddata" || \
562
+				"$destination_dir" == "mailinglist" ]]; then
563
+		is_valid="no"
564
+	fi
565
+
566
+	echo $is_valid
567 567
 }
568 568
 
569 569
 function backup_extra_directories {
570
-    if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
571
-        return
572
-    fi
573
-
574
-    echo $"Backing up some additional directories"
575
-    while read backup_line
576
-    do
577
-        backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
578
-        if [ -d "$backup_dir" ]; then
579
-            destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
580
-            if [[ $(valid_backup_destination "$destination_dir") == "yes" ]]; then
581
-                backup_directory_to_friend "$backup_dir" "$destination_dir"
582
-            else
583
-                echo $"WARNING: The backup directory $destination_dir is already used."
584
-                echo $"Choose a different destination name for backing up $backup_dir"
585
-            fi
586
-        else
587
-            echo $"WARNING: Directory $backup_dir does not exist"
588
-        fi
589
-    done <$BACKUP_EXTRA_DIRECTORIES
570
+	if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
571
+		return
572
+	fi
573
+
574
+	echo $"Backing up some additional directories"
575
+	while read backup_line
576
+	do
577
+		backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
578
+		if [ -d "$backup_dir" ]; then
579
+			destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
580
+			if [[ $(valid_backup_destination "$destination_dir") == "yes" ]]; then
581
+				backup_directory_to_friend "$backup_dir" "$destination_dir"
582
+			else
583
+				echo $"WARNING: The backup directory $destination_dir is already used."
584
+				echo $"Choose a different destination name for backing up $backup_dir"
585
+			fi
586
+		else
587
+			echo $"WARNING: Directory $backup_dir does not exist"
588
+		fi
589
+	done <$BACKUP_EXTRA_DIRECTORIES
590 590
 }
591 591
 
592 592
 TEST_MODE="no"
593 593
 if [[ "$1" == "test" ]]; then
594
-    TEST_MODE="yes"
594
+	TEST_MODE="yes"
595 595
 fi
596 596
 
597 597
 backup_configuration
598 598
 if [[ $TEST_MODE == "no" ]]; then
599
-    backup_users
600
-    backup_letsencrypt
601
-    backup_tor
602
-    backup_gnusocial
603
-    backup_rss_reader
604
-    backup_hubzilla
605
-    backup_owncloud
606
-    backup_gogs
607
-    backup_wiki
608
-    backup_blog
609
-    backup_certs
610
-    backup_mailing_list
611
-    backup_xmpp
612
-    backup_web_server
613
-    backup_admin_readme
614
-    backup_ipfs
615
-    backup_dlna
616
-    backup_voip
617
-    backup_tox
618
-    backup_mariadb
619
-    backup_extra_directories
599
+	backup_users
600
+	backup_letsencrypt
601
+	backup_tor
602
+	backup_gnusocial
603
+	backup_rss_reader
604
+	backup_hubzilla
605
+	backup_owncloud
606
+	backup_gogs
607
+	backup_wiki
608
+	backup_blog
609
+	backup_certs
610
+	backup_mailing_list
611
+	backup_xmpp
612
+	backup_web_server
613
+	backup_admin_readme
614
+	backup_ipfs
615
+	backup_dlna
616
+	backup_voip
617
+	backup_tox
618
+	backup_mariadb
619
+	backup_extra_directories
620 620
 fi
621 621
 
622 622
 # For each remote server
623 623
 while read remote_server
624 624
 do
625
-    # Get the server and its password
626
-    # Format is:
627
-    #   username@domain <port number> /home/username <ssh password>
628
-    REMOTE_SERVER=$(echo "${remote_server}" | awk -F ' ' '{print $1}')
629
-    if [ $REMOTE_SERVER ]; then
630
-        REMOTE_DOMAIN=$(echo "${remote_server}" | awk -F ' ' '{print $1}' | awk -F '@' '{print $2}')
631
-        REMOTE_SSH_PORT=$(echo "${remote_server}" | awk -F ' ' '{print $2}')
632
-        REMOTE_DIRECTORY=$(echo "${remote_server}" | awk -F ' ' '{print $3}')
633
-        REMOTE_PASSWORD=$(echo "${remote_server}" | awk -F ' ' '{print $4}')
634
-        NOW=$(date +"%Y-%m-%d %H:%M:%S")
635
-        REMOTE_SERVER=$REMOTE_SERVER:$REMOTE_DIRECTORY
636
-
637
-        echo "$NOW Starting backup to $REMOTE_SERVER" >> /var/log/remotebackups.log
638
-
639
-        # Social key management
640
-        for d in /home/*/ ; do
641
-            USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
642
-            if [[ $USERNAME != "git" && $USERNAME != "mirrors" ]]; then
643
-                disperse_key_shares $USERNAME $REMOTE_DOMAIN $REMOTE_SSH_PORT "$REMOTE_PASSWORD" $REMOTE_SERVER
644
-            fi
645
-        done
646
-
647
-        if [[ $TEST_MODE == "yes" ]]; then
648
-            echo "rsync -ratlzv --rsh=\"/usr/bin/sshpass -p '$REMOTE_PASSWORD' ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no\" $SERVER_DIRECTORY/backup $REMOTE_SERVER"
649
-        fi
650
-        rsync -ratlzv --rsh="/usr/bin/sshpass -p \"$REMOTE_PASSWORD\" ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no" $SERVER_DIRECTORY/backup $REMOTE_SERVER
651
-        if [ ! "$?" = "0" ]; then
652
-            echo "$NOW Backup to $REMOTE_SERVER failed" >> /var/log/remotebackups.log
653
-            # Send a warning email
654
-            echo "Backup to $REMOTE_SERVER failed" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
655
-        else
656
-            echo "$NOW Backed up to $REMOTE_SERVER" >> /var/log/remotebackups.log
657
-        fi
658
-    fi
625
+	# Get the server and its password
626
+	# Format is:
627
+	#   username@domain <port number> /home/username <ssh password>
628
+	REMOTE_SERVER=$(echo "${remote_server}" | awk -F ' ' '{print $1}')
629
+	if [ $REMOTE_SERVER ]; then
630
+		REMOTE_DOMAIN=$(echo "${remote_server}" | awk -F ' ' '{print $1}' | awk -F '@' '{print $2}')
631
+		REMOTE_SSH_PORT=$(echo "${remote_server}" | awk -F ' ' '{print $2}')
632
+		REMOTE_DIRECTORY=$(echo "${remote_server}" | awk -F ' ' '{print $3}')
633
+		REMOTE_PASSWORD=$(echo "${remote_server}" | awk -F ' ' '{print $4}')
634
+		NOW=$(date +"%Y-%m-%d %H:%M:%S")
635
+		REMOTE_SERVER=$REMOTE_SERVER:$REMOTE_DIRECTORY
636
+
637
+		echo "$NOW Starting backup to $REMOTE_SERVER" >> /var/log/remotebackups.log
638
+
639
+		# Social key management
640
+		for d in /home/*/ ; do
641
+			USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
642
+			if [[ $USERNAME != "git" && $USERNAME != "mirrors" ]]; then
643
+				disperse_key_shares $USERNAME $REMOTE_DOMAIN $REMOTE_SSH_PORT "$REMOTE_PASSWORD" $REMOTE_SERVER
644
+			fi
645
+		done
646
+
647
+		if [[ $TEST_MODE == "yes" ]]; then
648
+			echo "rsync -ratlzv --rsh=\"/usr/bin/sshpass -p '$REMOTE_PASSWORD' ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no\" $SERVER_DIRECTORY/backup $REMOTE_SERVER"
649
+		fi
650
+		rsync -ratlzv --rsh="/usr/bin/sshpass -p \"$REMOTE_PASSWORD\" ssh -p $REMOTE_SSH_PORT -o StrictHostKeyChecking=no" $SERVER_DIRECTORY/backup $REMOTE_SERVER
651
+		if [ ! "$?" = "0" ]; then
652
+			echo "$NOW Backup to $REMOTE_SERVER failed" >> /var/log/remotebackups.log
653
+			# Send a warning email
654
+			echo "Backup to $REMOTE_SERVER failed" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
655
+		else
656
+			echo "$NOW Backed up to $REMOTE_SERVER" >> /var/log/remotebackups.log
657
+		fi
658
+	fi
659 659
 
660 660
 done < /home/${ADMIN_USERNAME}/backup.list
661 661
 

+ 245
- 245
src/freedombone-restore-local Целия файл

@@ -826,292 +826,292 @@ function restore_owncloud {
826 826
         fi
827 827
     fi
828 828
     if [ $OWNCLOUD_DOMAIN_NAME ]; then
829
-        restore_database owncloudrepo $OWNCLOUD_DOMAIN_NAME
829
+        restore_database owncloud $OWNCLOUD_DOMAIN_NAME
830 830
 
831
-        if [ -d $USB_MOUNT/backup/owncloudrepofiles ]; then
832
-            restore_directory_from_usb /root/tempowncloudrepofiles owncloudrepofiles
833
-            cp -r /root/tempowncloudrepofiles/* /
831
+        if [ -d $USB_MOUNT/backup/owncloudfiles ]; then
832
+            restore_directory_from_usb /root/tempowncloudfiles owncloudfiles
833
+            cp -r /root/tempowncloudfiles/* /
834 834
             if [ ! "$?" = "0" ]; then
835 835
                 unmount_drive
836 836
                 exit 982
837 837
             fi
838
-            rm -rf /root/tempowncloudrepofiles
838
+            rm -rf /root/tempowncloudfiles
839 839
         fi
840 840
 
841
-        if [ -d $USB_MOUNT/backup/owncloudrepoconfig ]; then
842
-            restore_directory_from_usb /root/tempowncloudrepoconfig owncloudrepoconfig
843
-            cp -r /root/tempowncloudrepoconfig/* /
841
+        if [ -d $USB_MOUNT/backup/owncloudconfig ]; then
842
+            restore_directory_from_usb /root/tempowncloudconfig owncloudconfig
843
+            cp -r /root/tempowncloudconfig/* /
844 844
             if [ ! "$?" = "0" ]; then
845 845
                 unmount_drive
846 846
                 exit 7825
847 847
             fi
848
-            rm -rf /root/tempowncloudrepoconfig
848
+            rm -rf /root/tempowncloudconfig
849 849
         fi
850 850
 
851 851
         # re-index the files
852
-        chown -R www-data:www-data /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs
853
-        for d in /home/*/ ; do
854
-            USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
855
-            if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
856
-                /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/occ files:scan $USERNAME
857
-            fi
858
-        done
859
-    fi
852
+        chown -R www-data:www-data /var/www/owncloud
853
+		for d in /home/*/ ; do
854
+			USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
855
+			if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
856
+				/var/www/owncloud/occ files:scan $USERNAME
857
+			fi
858
+		done
859
+	fi
860 860
 }
861 861
 
862 862
 function restore_gogs {
863
-    if [[ $RESTORE_APP != 'all' ]]; then
864
-        if [[ $RESTORE_APP != 'gogs' ]]; then
865
-            return
866
-        fi
867
-    fi
868
-    if [ $GIT_DOMAIN_NAME ]; then
869
-        restore_database gogs ${GIT_DOMAIN_NAME}
870
-        if [ -d $USB_MOUNT/backup/gogs ]; then
871
-            echo $"Restoring Gogs settings"
872
-            if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then
873
-                mkdir -p /home/git/go/src/github.com/gogits/gogs/custom
874
-            fi
875
-            cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom
876
-            if [ ! "$?" = "0" ]; then
877
-                unmount_drive
878
-                exit 981
879
-            fi
880
-            echo $"Restoring Gogs repos"
881
-            restore_directory_from_usb /root/tempgogsrepos gogsrepos
882
-            cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
883
-            if [ ! "$?" = "0" ]; then
884
-                unmount_drive
885
-                exit 67574
886
-            fi
887
-            echo $"Restoring Gogs authorized_keys"
888
-            restore_directory_from_usb /root/tempgogsssh gogsssh
889
-            if [ ! -d /home/git/.ssh ]; then
890
-                mkdir /home/git/.ssh
891
-            fi
892
-            cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
893
-            if [ ! "$?" = "0" ]; then
894
-                unmount_drive
895
-                exit 8463
896
-            fi
897
-            rm -rf /root/tempgogs
898
-            rm -rf /root/tempgogsrepos
899
-            rm -rf /root/tempgogsssh
900
-            chown -R git:git /home/git
901
-        fi
902
-    fi
863
+	if [[ $RESTORE_APP != 'all' ]]; then
864
+		if [[ $RESTORE_APP != 'gogs' ]]; then
865
+			return
866
+		fi
867
+	fi
868
+	if [ $GIT_DOMAIN_NAME ]; then
869
+		restore_database gogs ${GIT_DOMAIN_NAME}
870
+		if [ -d $USB_MOUNT/backup/gogs ]; then
871
+			echo $"Restoring Gogs settings"
872
+			if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then
873
+				mkdir -p /home/git/go/src/github.com/gogits/gogs/custom
874
+			fi
875
+			cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom
876
+			if [ ! "$?" = "0" ]; then
877
+				unmount_drive
878
+				exit 981
879
+			fi
880
+			echo $"Restoring Gogs repos"
881
+			restore_directory_from_usb /root/tempgogsrepos gogsrepos
882
+			cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
883
+			if [ ! "$?" = "0" ]; then
884
+				unmount_drive
885
+				exit 67574
886
+			fi
887
+			echo $"Restoring Gogs authorized_keys"
888
+			restore_directory_from_usb /root/tempgogsssh gogsssh
889
+			if [ ! -d /home/git/.ssh ]; then
890
+				mkdir /home/git/.ssh
891
+			fi
892
+			cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
893
+			if [ ! "$?" = "0" ]; then
894
+				unmount_drive
895
+				exit 8463
896
+			fi
897
+			rm -rf /root/tempgogs
898
+			rm -rf /root/tempgogsrepos
899
+			rm -rf /root/tempgogsssh
900
+			chown -R git:git /home/git
901
+		fi
902
+	fi
903 903
 }
904 904
 
905 905
 function restore_wiki {
906
-    if [[ $RESTORE_APP != 'all' ]]; then
907
-        if [[ $RESTORE_APP != 'wiki' ]]; then
908
-            return
909
-        fi
910
-    fi
911
-    if [ $WIKI_DOMAIN_NAME ]; then
912
-        echo $"Restoring Wiki installation ${WIKI_DOMAIN_NAME}"
913
-        restore_directory_from_usb /root/tempwiki wiki
914
-        cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
915
-        if [ ! "$?" = "0" ]; then
916
-            unmount_drive
917
-            exit 868
918
-        fi
919
-        restore_directory_from_usb /root/tempwiki2 wiki2
920
-        cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
921
-        if [ ! "$?" = "0" ]; then
922
-            unmount_drive
923
-            exit 869
924
-        fi
925
-        rm -rf /root/tempwiki
926
-        rm -rf /root/tempwiki2
927
-        chown -R www-data:www-data /var/lib/dokuwiki/*
928
-        # Ensure that the bundled SSL cert is being used
929
-        if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
930
-            sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
931
-        fi
932
-        if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
933
-            ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
934
-            ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
935
-        fi
936
-    fi
906
+	if [[ $RESTORE_APP != 'all' ]]; then
907
+		if [[ $RESTORE_APP != 'wiki' ]]; then
908
+			return
909
+		fi
910
+	fi
911
+	if [ $WIKI_DOMAIN_NAME ]; then
912
+		echo $"Restoring Wiki installation ${WIKI_DOMAIN_NAME}"
913
+		restore_directory_from_usb /root/tempwiki wiki
914
+		cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
915
+		if [ ! "$?" = "0" ]; then
916
+			unmount_drive
917
+			exit 868
918
+		fi
919
+		restore_directory_from_usb /root/tempwiki2 wiki2
920
+		cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
921
+		if [ ! "$?" = "0" ]; then
922
+			unmount_drive
923
+			exit 869
924
+		fi
925
+		rm -rf /root/tempwiki
926
+		rm -rf /root/tempwiki2
927
+		chown -R www-data:www-data /var/lib/dokuwiki/*
928
+		# Ensure that the bundled SSL cert is being used
929
+		if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
930
+			sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
931
+		fi
932
+		if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
933
+			ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
934
+			ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
935
+		fi
936
+	fi
937 937
 }
938 938
 
939 939
 function restore_blog {
940
-    if [[ $RESTORE_APP != 'all' ]]; then
941
-        if [[ $RESTORE_APP != 'blog' ]]; then
942
-            return
943
-        fi
944
-    fi
945
-    if [ $FULLBLOG_DOMAIN_NAME ]; then
946
-        echo $"Restoring blog installation"
947
-        restore_directory_from_usb /root/tempblog blog
948
-        rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
949
-        cp -r /root/tempblog/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
950
-        if [ ! "$?" = "0" ]; then
951
-            unmount_drive
952
-            exit 593
953
-        fi
954
-        rm -rf /root/tempblog
955
-        if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
956
-            echo $"No content directory found after restoring blog"
957
-            unmount_drive
958
-            exit 287
959
-        fi
960
-        chown -R www-data:www-data /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
961
-        # Ensure that the bundled SSL cert is being used
962
-        if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
963
-            sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
964
-        fi
965
-        for d in /home/*/ ; do
966
-            USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
967
-            if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
968
-                if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
969
-                    mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
970
-                fi
971
-            fi
972
-        done
973
-        if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
974
-            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
975
-            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
976
-        fi
977
-    fi
940
+	if [[ $RESTORE_APP != 'all' ]]; then
941
+		if [[ $RESTORE_APP != 'blog' ]]; then
942
+			return
943
+		fi
944
+	fi
945
+	if [ $FULLBLOG_DOMAIN_NAME ]; then
946
+		echo $"Restoring blog installation"
947
+		restore_directory_from_usb /root/tempblog blog
948
+		rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
949
+		cp -r /root/tempblog/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
950
+		if [ ! "$?" = "0" ]; then
951
+			unmount_drive
952
+			exit 593
953
+		fi
954
+		rm -rf /root/tempblog
955
+		if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
956
+			echo $"No content directory found after restoring blog"
957
+			unmount_drive
958
+			exit 287
959
+		fi
960
+		chown -R www-data:www-data /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
961
+		# Ensure that the bundled SSL cert is being used
962
+		if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
963
+			sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
964
+		fi
965
+		for d in /home/*/ ; do
966
+			USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
967
+			if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
968
+				if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
969
+					mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
970
+				fi
971
+			fi
972
+		done
973
+		if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
974
+			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
975
+			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
976
+		fi
977
+	fi
978 978
 }
979 979
 
980 980
 function restore_cjdns {
981
-    if [[ $RESTORE_APP != 'all' ]]; then
982
-        if [[ $RESTORE_APP != 'cjdns' ]]; then
983
-            return
984
-        fi
985
-    fi
986
-    if [ -d $USB_MOUNT/backup/cjdns ]; then
987
-        echo $"Restoring cjdns installation"
988
-        restore_directory_from_usb /root/tempcjdns cjdns
989
-        rm -rf /etc/cjdns
990
-        cp -r /root/tempcjdns/etc/cjdns /etc/
991
-        if [ ! "$?" = "0" ]; then
992
-            unmount_drive
993
-            exit 8472
994
-        fi
995
-        rm -rf /root/tempcjdns
996
-    fi
981
+	if [[ $RESTORE_APP != 'all' ]]; then
982
+		if [[ $RESTORE_APP != 'cjdns' ]]; then
983
+			return
984
+		fi
985
+	fi
986
+	if [ -d $USB_MOUNT/backup/cjdns ]; then
987
+		echo $"Restoring cjdns installation"
988
+		restore_directory_from_usb /root/tempcjdns cjdns
989
+		rm -rf /etc/cjdns
990
+		cp -r /root/tempcjdns/etc/cjdns /etc/
991
+		if [ ! "$?" = "0" ]; then
992
+			unmount_drive
993
+			exit 8472
994
+		fi
995
+		rm -rf /root/tempcjdns
996
+	fi
997 997
 }
998 998
 
999 999
 function restore_email {
1000
-    if [[ $RESTORE_APP != 'all' ]]; then
1001
-        if [[ $RESTORE_APP != 'email' ]]; then
1002
-            return
1003
-        fi
1004
-    fi
1005
-    if [ -d $USB_MOUNT/backup/mail ]; then
1006
-        for d in $USB_MOUNT/backup/mail/*/ ; do
1007
-            USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
1008
-            if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
1009
-                if [ ! -d /home/$USERNAME ]; then
1010
-                    ${PROJECT_NAME}-adduser $USERNAME
1011
-                fi
1012
-                echo $"Restoring emails for $USERNAME"
1013
-                restore_directory_from_usb /root/tempmail mail/$USERNAME
1014
-                if [ ! -d /home/$USERNAME/Maildir ]; then
1015
-                    mkdir /home/$USERNAME/Maildir
1016
-                fi
1017
-                tar -xzvf /root/tempmail/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
1018
-                if [ ! "$?" = "0" ]; then
1019
-                    unmount_drive
1020
-                    exit 927
1021
-                fi
1022
-                rm -rf /root/tempmail
1023
-            fi
1024
-        done
1025
-    fi
1000
+	if [[ $RESTORE_APP != 'all' ]]; then
1001
+		if [[ $RESTORE_APP != 'email' ]]; then
1002
+			return
1003
+		fi
1004
+	fi
1005
+	if [ -d $USB_MOUNT/backup/mail ]; then
1006
+		for d in $USB_MOUNT/backup/mail/*/ ; do
1007
+			USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
1008
+			if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
1009
+				if [ ! -d /home/$USERNAME ]; then
1010
+					${PROJECT_NAME}-adduser $USERNAME
1011
+				fi
1012
+				echo $"Restoring emails for $USERNAME"
1013
+				restore_directory_from_usb /root/tempmail mail/$USERNAME
1014
+				if [ ! -d /home/$USERNAME/Maildir ]; then
1015
+					mkdir /home/$USERNAME/Maildir
1016
+				fi
1017
+				tar -xzvf /root/tempmail/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
1018
+				if [ ! "$?" = "0" ]; then
1019
+					unmount_drive
1020
+					exit 927
1021
+				fi
1022
+				rm -rf /root/tempmail
1023
+			fi
1024
+		done
1025
+	fi
1026 1026
 }
1027 1027
 
1028 1028
 function restore_dlna {
1029
-    if [[ $RESTORE_APP != 'all' ]]; then
1030
-        if [[ $RESTORE_APP != 'dlna' ]]; then
1031
-            return
1032
-        fi
1033
-    fi
1034
-    if [ -d /var/cache/minidlna ]; then
1035
-        if [ -d $USB_MOUNT/backup/dlna ]; then
1036
-            echo $"Restoring DLNA cache"
1037
-            restore_directory_from_usb /root/tempdlna dlna
1038
-            cp -r /root/tempdlna/var/cache/minidlna/* /var/cache/minidlna/
1039
-            if [ ! "$?" = "0" ]; then
1040
-                rm -rf /root/tempdlna
1041
-                unmount_drive
1042
-                exit 982
1043
-            fi
1044
-            rm -rf /root/tempdlna
1045
-        fi
1046
-    fi
1029
+	if [[ $RESTORE_APP != 'all' ]]; then
1030
+		if [[ $RESTORE_APP != 'dlna' ]]; then
1031
+			return
1032
+		fi
1033
+	fi
1034
+	if [ -d /var/cache/minidlna ]; then
1035
+		if [ -d $USB_MOUNT/backup/dlna ]; then
1036
+			echo $"Restoring DLNA cache"
1037
+			restore_directory_from_usb /root/tempdlna dlna
1038
+			cp -r /root/tempdlna/var/cache/minidlna/* /var/cache/minidlna/
1039
+			if [ ! "$?" = "0" ]; then
1040
+				rm -rf /root/tempdlna
1041
+				unmount_drive
1042
+				exit 982
1043
+			fi
1044
+			rm -rf /root/tempdlna
1045
+		fi
1046
+	fi
1047 1047
 }
1048 1048
 
1049 1049
 function restore_voip {
1050
-    if [[ $RESTORE_APP != 'all' ]]; then
1051
-        if [[ $RESTORE_APP != 'voip' ]]; then
1052
-            return
1053
-        fi
1054
-    fi
1055
-    if [ -d $USB_MOUNT/backup/voip ]; then
1056
-        echo $"Restoring VoIP settings"
1057
-        restore_directory_from_usb /root/tempvoip voip
1058
-        cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
1059
-        if [ ! "$?" = "0" ]; then
1060
-            rm -rf /root/tempvoip
1061
-            unmount_drive
1062
-            exit 3679
1063
-        fi
1064
-        cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
1065
-        if [ ! "$?" = "0" ]; then
1066
-            rm -rf /root/tempvoip
1067
-            unmount_drive
1068
-            exit 3679
1069
-        fi
1070
-        cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
1071
-        if [ ! "$?" = "0" ]; then
1072
-            rm -rf /root/tempvoip
1073
-            unmount_drive
1074
-            exit 276
1075
-        fi
1076
-        rm -rf /root/tempvoip
1077
-        cp /etc/ssl/certs/mumble* /var/lib/mumble-server
1078
-        cp /etc/ssl/private/mumble* /var/lib/mumble-server
1079
-        chown -R mumble-server:mumble-server /var/lib/mumble-server
1080
-        service sipwitch restart
1081
-        service mumble-server restart
1082
-    fi
1050
+	if [[ $RESTORE_APP != 'all' ]]; then
1051
+		if [[ $RESTORE_APP != 'voip' ]]; then
1052
+			return
1053
+		fi
1054
+	fi
1055
+	if [ -d $USB_MOUNT/backup/voip ]; then
1056
+		echo $"Restoring VoIP settings"
1057
+		restore_directory_from_usb /root/tempvoip voip
1058
+		cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
1059
+		if [ ! "$?" = "0" ]; then
1060
+			rm -rf /root/tempvoip
1061
+			unmount_drive
1062
+			exit 3679
1063
+		fi
1064
+		cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
1065
+		if [ ! "$?" = "0" ]; then
1066
+			rm -rf /root/tempvoip
1067
+			unmount_drive
1068
+			exit 3679
1069
+		fi
1070
+		cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
1071
+		if [ ! "$?" = "0" ]; then
1072
+			rm -rf /root/tempvoip
1073
+			unmount_drive
1074
+			exit 276
1075
+		fi
1076
+		rm -rf /root/tempvoip
1077
+		cp /etc/ssl/certs/mumble* /var/lib/mumble-server
1078
+		cp /etc/ssl/private/mumble* /var/lib/mumble-server
1079
+		chown -R mumble-server:mumble-server /var/lib/mumble-server
1080
+		service sipwitch restart
1081
+		service mumble-server restart
1082
+	fi
1083 1083
 }
1084 1084
 
1085 1085
 function restore_tox {
1086
-    if [[ $RESTORE_APP != 'all' ]]; then
1087
-        if [[ $RESTORE_APP != 'tox' ]]; then
1088
-            return
1089
-        fi
1090
-    fi
1091
-    if [ -d $USB_MOUNT/backup/tox ]; then
1092
-        echo $"Restoring Tox node settings"
1093
-        restore_directory_from_usb / tox
1094
-        if [ ! "$?" = "0" ]; then
1095
-            unmount_drive
1096
-            exit 6393
1097
-        fi
1098
-        cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
1099
-        systemctl restart tox-bootstrapd.service
1100
-        if [ ! "$?" = "0" ]; then
1101
-            systemctl status tox-bootstrapd.service
1102
-            unmount_drive
1103
-            exit 59369
1104
-        fi
1105
-    fi
1086
+	if [[ $RESTORE_APP != 'all' ]]; then
1087
+		if [[ $RESTORE_APP != 'tox' ]]; then
1088
+			return
1089
+		fi
1090
+	fi
1091
+	if [ -d $USB_MOUNT/backup/tox ]; then
1092
+		echo $"Restoring Tox node settings"
1093
+		restore_directory_from_usb / tox
1094
+		if [ ! "$?" = "0" ]; then
1095
+			unmount_drive
1096
+			exit 6393
1097
+		fi
1098
+		cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
1099
+		systemctl restart tox-bootstrapd.service
1100
+		if [ ! "$?" = "0" ]; then
1101
+			systemctl status tox-bootstrapd.service
1102
+			unmount_drive
1103
+			exit 59369
1104
+		fi
1105
+	fi
1106 1106
 }
1107 1107
 
1108 1108
 function get_restore_app {
1109
-    if [ ${1} ]; then
1110
-        if [ ! -d /home/${1} ]; then
1111
-            RESTORE_APP=${1}
1112
-            echo $"Restore $RESTORE_APP"
1113
-        fi
1114
-    fi
1109
+	if [ ${1} ]; then
1110
+		if [ ! -d /home/${1} ]; then
1111
+			RESTORE_APP=${1}
1112
+			echo $"Restore $RESTORE_APP"
1113
+		fi
1114
+	fi
1115 1115
 }
1116 1116
 
1117 1117
 get_restore_app ${2}

+ 220
- 220
src/freedombone-restore-remote Целия файл

@@ -701,267 +701,267 @@ function restore_owncloud {
701 701
     fi
702 702
     if grep -q "Owncloud domain" $COMPLETION_FILE; then
703 703
         OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
704
-        restore_database_from_friend owncloudrepo $OWNCLOUD_DOMAIN_NAME
704
+        restore_database_from_friend owncloud $OWNCLOUD_DOMAIN_NAME
705 705
 
706
-        if [ -d $SERVER_DIRECTORY/backup/owncloudrepofiles ]; then
706
+        if [ -d $SERVER_DIRECTORY/backup/owncloudfiles ]; then
707 707
             echo $"Restoring Owncloud installation"
708
-            cp -r /root/tempowncloudrepofiles/* /
708
+            cp -r /root/tempowncloudfiles/* /
709 709
             if [ ! "$?" = "0" ]; then
710 710
                 exit 1458
711 711
             fi
712
-            rm -rf /root/tempowncloudrepofiles
712
+            rm -rf /root/tempowncloudfiles
713 713
         fi
714 714
 
715
-        if [ -d $SERVER_DIRECTORY/backup/owncloudrepoconfig ]; then
715
+        if [ -d $SERVER_DIRECTORY/backup/owncloudconfig ]; then
716 716
             echo $"Restoring Owncloud installation"
717
-            cp -r /root/tempowncloudrepoconfig/* /
717
+            cp -r /root/tempowncloudconfig/* /
718 718
             if [ ! "$?" = "0" ]; then
719 719
                 exit 2571
720 720
             fi
721
-            rm -rf /root/tempowncloudrepoconfig
721
+            rm -rf /root/tempowncloudconfig
722 722
         fi
723
-        
724
-        chown -R www-data:www-data /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs
723
+
724
+        chown -R www-data:www-data /var/www/owncloud
725 725
 
726 726
         # re-index files
727 727
         for d in /home/*/ ; do
728 728
             USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
729 729
             if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
730
-                /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/occ files:scan $USERNAME
731
-            fi
732
-        done
733
-    fi
730
+                /var/www/owncloud/occ files:scan $USERNAME
731
+			fi
732
+		done
733
+	fi
734 734
 }
735 735
 
736 736
 function restore_gogs {
737
-    if [[ $RESTORE_APP != 'all' ]]; then
738
-        if [[ $RESTORE_APP != 'gogs' ]]; then
739
-            return
740
-        fi
741
-    fi
742
-    if grep -q "Gogs domain" $COMPLETION_FILE; then
743
-        GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
744
-        restore_database_from_friend gogs $GIT_DOMAIN_NAME
745
-        if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
746
-            if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then
747
-                mkdir -p /home/git/go/src/github.com/gogits/gogs/custom
748
-            fi
749
-            cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom/
750
-            if [ ! "$?" = "0" ]; then
751
-                exit 5885
752
-            fi
753
-            echo $"Restoring Gogs repos"
754
-            restore_directory_from_friend /root/tempgogsrepos gogsrepos
755
-            cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
756
-            if [ ! "$?" = "0" ]; then
757
-                exit 7649
758
-            fi
759
-            echo $"Restoring Gogs authorized_keys"
760
-            restore_directory_from_friend /root/tempgogsssh gogsssh
761
-            if [ ! -d /home/git/.ssh ]; then
762
-                mkdir /home/git/.ssh
763
-            fi
764
-            cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
765
-            if [ ! "$?" = "0" ]; then
766
-                exit 74239
767
-            fi
768
-            rm -rf /root/tempgogs
769
-            rm -rf /root/tempgogsrepos
770
-            rm -rf /root/tempgogsssh
771
-            chown -R git:git /home/git
772
-        fi
773
-    fi
737
+	if [[ $RESTORE_APP != 'all' ]]; then
738
+		if [[ $RESTORE_APP != 'gogs' ]]; then
739
+			return
740
+		fi
741
+	fi
742
+	if grep -q "Gogs domain" $COMPLETION_FILE; then
743
+		GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
744
+		restore_database_from_friend gogs $GIT_DOMAIN_NAME
745
+		if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
746
+			if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then
747
+				mkdir -p /home/git/go/src/github.com/gogits/gogs/custom
748
+			fi
749
+			cp -r /root/tempgogs/home/git/go/src/github.com/gogits/gogs/custom/* /home/git/go/src/github.com/gogits/gogs/custom/
750
+			if [ ! "$?" = "0" ]; then
751
+				exit 5885
752
+			fi
753
+			echo $"Restoring Gogs repos"
754
+			restore_directory_from_friend /root/tempgogsrepos gogsrepos
755
+			cp -r /root/tempgogsrepos/home/git/gogs-repositories/* /home/git/gogs-repositories/
756
+			if [ ! "$?" = "0" ]; then
757
+				exit 7649
758
+			fi
759
+			echo $"Restoring Gogs authorized_keys"
760
+			restore_directory_from_friend /root/tempgogsssh gogsssh
761
+			if [ ! -d /home/git/.ssh ]; then
762
+				mkdir /home/git/.ssh
763
+			fi
764
+			cp -r /root/tempgogsssh/home/git/.ssh/* /home/git/.ssh/
765
+			if [ ! "$?" = "0" ]; then
766
+				exit 74239
767
+			fi
768
+			rm -rf /root/tempgogs
769
+			rm -rf /root/tempgogsrepos
770
+			rm -rf /root/tempgogsssh
771
+			chown -R git:git /home/git
772
+		fi
773
+	fi
774 774
 }
775 775
 
776 776
 function restore_wiki {
777
-    if [[ $RESTORE_APP != 'all' ]]; then
778
-        if [[ $RESTORE_APP != 'wiki' ]]; then
779
-            return
780
-        fi
781
-    fi
782
-    if [ -d $SERVER_DIRECTORY/backup/wiki ]; then
783
-        WIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Wiki domain" | awk -F ':' '{print $2}')
784
-        echo $"Restoring Wiki installation $WIKI_DOMAIN_NAME"
785
-        restore_directory_from_friend /root/tempwiki wiki
786
-        cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
787
-        if [ ! "$?" = "0" ]; then
788
-            exit 868
789
-        fi
790
-        restore_directory_from_friend /root/tempwiki2 wiki2
791
-        cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
792
-        if [ ! "$?" = "0" ]; then
793
-            exit 869
794
-        fi
795
-        rm -rf /root/tempwiki
796
-        rm -rf /root/tempwiki2
797
-        chown -R www-data:www-data /var/lib/dokuwiki/*
798
-        # Ensure that the bundled SSL cert is being used
799
-        if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
800
-            sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
801
-        fi
802
-        if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
803
-            ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
804
-            ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
805
-        fi
806
-    fi
777
+	if [[ $RESTORE_APP != 'all' ]]; then
778
+		if [[ $RESTORE_APP != 'wiki' ]]; then
779
+			return
780
+		fi
781
+	fi
782
+	if [ -d $SERVER_DIRECTORY/backup/wiki ]; then
783
+		WIKI_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Wiki domain" | awk -F ':' '{print $2}')
784
+		echo $"Restoring Wiki installation $WIKI_DOMAIN_NAME"
785
+		restore_directory_from_friend /root/tempwiki wiki
786
+		cp -r /root/tempwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
787
+		if [ ! "$?" = "0" ]; then
788
+			exit 868
789
+		fi
790
+		restore_directory_from_friend /root/tempwiki2 wiki2
791
+		cp -r /root/tempwiki2/etc/dokuwiki/* /etc/dokuwiki/
792
+		if [ ! "$?" = "0" ]; then
793
+			exit 869
794
+		fi
795
+		rm -rf /root/tempwiki
796
+		rm -rf /root/tempwiki2
797
+		chown -R www-data:www-data /var/lib/dokuwiki/*
798
+		# Ensure that the bundled SSL cert is being used
799
+		if [ -f /etc/ssl/certs/${WIKI_DOMAIN_NAME}.bundle.crt ]; then
800
+			sed -i "s|${WIKI_DOMAIN_NAME}.crt|${WIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${WIKI_DOMAIN_NAME}
801
+		fi
802
+		if [ -d /etc/letsencrypt/live/${WIKI_DOMAIN_NAME} ]; then
803
+			ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${WIKI_DOMAIN_NAME}.key
804
+			ln -s /etc/letsencrypt/live/${WIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${WIKI_DOMAIN_NAME}.pem
805
+		fi
806
+	fi
807 807
 }
808 808
 
809 809
 function restore_blog {
810
-    if [[ $RESTORE_APP != 'all' ]]; then
811
-        if [[ $RESTORE_APP != 'blog' ]]; then
812
-            return
813
-        fi
814
-    fi
815
-    if [ -d $SERVER_DIRECTORY/backup/blog ]; then
816
-        FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
817
-        echo $"Restoring blog installation $FULLBLOG_DOMAIN_NAME"
818
-        mkdir /root/tempblog
819
-        restore_directory_from_friend /root/tempblog blog
820
-        rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
821
-        cp -r /root/tempblog/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
822
-        if [ ! "$?" = "0" ]; then
823
-            exit 593
824
-        fi
825
-        rm -rf /root/tempblog
826
-        if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
827
-            echo $"No content directory found after restoring blog"
828
-            exit 287
829
-        fi
830
-        # Ensure that the bundled SSL cert is being used
831
-        if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
832
-            sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
833
-        fi
834
-        for d in /home/*/ ; do
835
-            USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
836
-            if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
837
-                if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
838
-                    mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
839
-                fi
840
-        done
841
-        if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
842
-            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
843
-            ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
844
-        fi
845
-    fi
810
+	if [[ $RESTORE_APP != 'all' ]]; then
811
+		if [[ $RESTORE_APP != 'blog' ]]; then
812
+			return
813
+		fi
814
+	fi
815
+	if [ -d $SERVER_DIRECTORY/backup/blog ]; then
816
+		FULLBLOG_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Blog domain" | awk -F ':' '{print $2}')
817
+		echo $"Restoring blog installation $FULLBLOG_DOMAIN_NAME"
818
+		mkdir /root/tempblog
819
+		restore_directory_from_friend /root/tempblog blog
820
+		rm -rf /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs
821
+		cp -r /root/tempblog/var/www/${FULLBLOG_DOMAIN_NAME}/htdocs /var/www/${FULLBLOG_DOMAIN_NAME}/
822
+		if [ ! "$?" = "0" ]; then
823
+			exit 593
824
+		fi
825
+		rm -rf /root/tempblog
826
+		if [ ! -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content ]; then
827
+			echo $"No content directory found after restoring blog"
828
+			exit 287
829
+		fi
830
+		# Ensure that the bundled SSL cert is being used
831
+		if [ -f /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.bundle.crt ]; then
832
+			sed -i "s|${FULLBLOG_DOMAIN_NAME}.crt|${FULLBLOG_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${FULLBLOG_DOMAIN_NAME}
833
+		fi
834
+		for d in /home/*/ ; do
835
+			USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
836
+			if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
837
+				if [ -d /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post ]; then
838
+					mv /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/*.md /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs/content/$USERNAME/blog/uncategorized/post
839
+				fi
840
+		done
841
+		if [ -d /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME} ]; then
842
+			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${FULLBLOG_DOMAIN_NAME}.key
843
+			ln -s /etc/letsencrypt/live/${FULLBLOG_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${FULLBLOG_DOMAIN_NAME}.pem
844
+		fi
845
+	fi
846 846
 }
847 847
 
848 848
 function restore_cjdns {
849
-    if [[ $RESTORE_APP != 'all' ]]; then
850
-        if [[ $RESTORE_APP != 'cjdns' ]]; then
851
-            return
852
-        fi
853
-    fi
854
-    if [ -d $SERVER_DIRECTORY/backup/cjdns ]; then
855
-        echo $"Restoring cjdns installation"
856
-        restore_directory_from_friend /root/tempcjdns cjdns
857
-        rm -rf /etc/cjdns
858
-        cp -r /root/tempcjdns/etc/cjdns /etc/
859
-        if [ ! "$?" = "0" ]; then
860
-            exit 7438
861
-        fi
862
-        rm -rf /root/tempcjdns
863
-    fi
849
+	if [[ $RESTORE_APP != 'all' ]]; then
850
+		if [[ $RESTORE_APP != 'cjdns' ]]; then
851
+			return
852
+		fi
853
+	fi
854
+	if [ -d $SERVER_DIRECTORY/backup/cjdns ]; then
855
+		echo $"Restoring cjdns installation"
856
+		restore_directory_from_friend /root/tempcjdns cjdns
857
+		rm -rf /etc/cjdns
858
+		cp -r /root/tempcjdns/etc/cjdns /etc/
859
+		if [ ! "$?" = "0" ]; then
860
+			exit 7438
861
+		fi
862
+		rm -rf /root/tempcjdns
863
+	fi
864 864
 }
865 865
 
866 866
 function restore_voip {
867
-    if [[ $RESTORE_APP != 'all' ]]; then
868
-        if [[ $RESTORE_APP != 'voip' ]]; then
869
-            return
870
-        fi
871
-    fi
872
-    if [ -d $SERVER_DIRECTORY/backup/voip ]; then
873
-        echo $"Restoring VoIP settings"
874
-        restore_directory_from_friend /root/tempvoip voip
875
-        cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
876
-        if [ ! "$?" = "0" ]; then
877
-            rm -rf /root/tempvoip
878
-            exit 7823
879
-        fi
880
-        cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
881
-        if [ ! "$?" = "0" ]; then
882
-            rm -rf /root/tempvoip
883
-            exit 7823
884
-        fi
885
-        cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
886
-        if [ ! "$?" = "0" ]; then
887
-            rm -rf /root/tempvoip
888
-            exit 276
889
-        fi
890
-        rm -rf /root/tempvoip
891
-        cp /etc/ssl/certs/mumble* /var/lib/mumble-server
892
-        cp /etc/ssl/private/mumble* /var/lib/mumble-server
893
-        chown -R mumble-server:mumble-server /var/lib/mumble-server
894
-        service sipwitch restart
895
-        service mumble-server restart
896
-    fi
867
+	if [[ $RESTORE_APP != 'all' ]]; then
868
+		if [[ $RESTORE_APP != 'voip' ]]; then
869
+			return
870
+		fi
871
+	fi
872
+	if [ -d $SERVER_DIRECTORY/backup/voip ]; then
873
+		echo $"Restoring VoIP settings"
874
+		restore_directory_from_friend /root/tempvoip voip
875
+		cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/
876
+		if [ ! "$?" = "0" ]; then
877
+			rm -rf /root/tempvoip
878
+			exit 7823
879
+		fi
880
+		cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
881
+		if [ ! "$?" = "0" ]; then
882
+			rm -rf /root/tempvoip
883
+			exit 7823
884
+		fi
885
+		cp -f /root/tempvoip/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/
886
+		if [ ! "$?" = "0" ]; then
887
+			rm -rf /root/tempvoip
888
+			exit 276
889
+		fi
890
+		rm -rf /root/tempvoip
891
+		cp /etc/ssl/certs/mumble* /var/lib/mumble-server
892
+		cp /etc/ssl/private/mumble* /var/lib/mumble-server
893
+		chown -R mumble-server:mumble-server /var/lib/mumble-server
894
+		service sipwitch restart
895
+		service mumble-server restart
896
+	fi
897 897
 }
898 898
 
899 899
 function restore_tox {
900
-    if [[ $RESTORE_APP != 'all' ]]; then
901
-        if [[ $RESTORE_APP != 'tox' ]]; then
902
-            return
903
-        fi
904
-    fi
905
-    if [ -d $SERVER_DIRECTORY/backup/tox ]; then
906
-        echo $"Restoring Tox node settings"
907
-        restore_directory_from_friend / tox
908
-        if [ ! "$?" = "0" ]; then
909
-            exit 93653
910
-        fi
911
-        cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
912
-        systemctl restart tox-bootstrapd.service
913
-        if [ ! "$?" = "0" ]; then
914
-            systemctl status tox-bootstrapd.service
915
-            exit 59369
916
-        fi
917
-    fi
900
+	if [[ $RESTORE_APP != 'all' ]]; then
901
+		if [[ $RESTORE_APP != 'tox' ]]; then
902
+			return
903
+		fi
904
+	fi
905
+	if [ -d $SERVER_DIRECTORY/backup/tox ]; then
906
+		echo $"Restoring Tox node settings"
907
+		restore_directory_from_friend / tox
908
+		if [ ! "$?" = "0" ]; then
909
+			exit 93653
910
+		fi
911
+		cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
912
+		systemctl restart tox-bootstrapd.service
913
+		if [ ! "$?" = "0" ]; then
914
+			systemctl status tox-bootstrapd.service
915
+			exit 59369
916
+		fi
917
+	fi
918 918
 }
919 919
 
920 920
 function restore_email {
921
-    if [[ $RESTORE_APP != 'all' ]]; then
922
-        if [[ $RESTORE_APP != 'email' ]]; then
923
-            return
924
-        fi
925
-    fi
926
-    for d in $SERVER_DIRECTORY/backup/mail/*/ ; do
927
-        USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
928
-        if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
929
-            if [ -d $SERVER_DIRECTORY/backup/mail/$USERNAME ]; then
930
-                if [ ! -d /home/$USERNAME ]; then
931
-                    ${PROJECT_NAME}-adduser $USERNAME
932
-                fi
933
-                echo $"Restoring emails for $USERNAME"
934
-                restore_directory_from_friend /root/tempmail mail/$USERNAME
935
-                if [ ! -d /home/$USERNAME/Maildir ]; then
936
-                    mkdir /home/$USERNAME/Maildir
937
-                fi
938
-                tar -xzvf /root/tempmail/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
939
-                if [ ! "$?" = "0" ]; then
940
-                    exit 927
941
-                fi
942
-                rm -rf /root/tempmail
943
-            fi
944
-        fi
945
-    done
921
+	if [[ $RESTORE_APP != 'all' ]]; then
922
+		if [[ $RESTORE_APP != 'email' ]]; then
923
+			return
924
+		fi
925
+	fi
926
+	for d in $SERVER_DIRECTORY/backup/mail/*/ ; do
927
+		USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
928
+		if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
929
+			if [ -d $SERVER_DIRECTORY/backup/mail/$USERNAME ]; then
930
+				if [ ! -d /home/$USERNAME ]; then
931
+					${PROJECT_NAME}-adduser $USERNAME
932
+				fi
933
+				echo $"Restoring emails for $USERNAME"
934
+				restore_directory_from_friend /root/tempmail mail/$USERNAME
935
+				if [ ! -d /home/$USERNAME/Maildir ]; then
936
+					mkdir /home/$USERNAME/Maildir
937
+				fi
938
+				tar -xzvf /root/tempmail/root/tempbackupemail/$USERNAME/maildir.tar.gz -C /
939
+				if [ ! "$?" = "0" ]; then
940
+					exit 927
941
+				fi
942
+				rm -rf /root/tempmail
943
+			fi
944
+		fi
945
+	done
946 946
 }
947 947
 
948 948
 function restore_dlna {
949
-    if [[ $RESTORE_APP != 'all' ]]; then
950
-        if [[ $RESTORE_APP != 'dlna' ]]; then
951
-            return
952
-        fi
953
-    fi
954
-    if [ -d /var/cache/minidlna ]; then
955
-        if [ -d $SERVER_DIRECTORY/backup/dlna ]; then
956
-            echo $"Restoring DLNA cache"
957
-            restore_directory_from_friend /root/tempdlna dlna
958
-            cp -r /root/tempdlna/var/cache/minidlna/* /var/cache/minidlna/
959
-            if [ ! "$?" = "0" ]; then
960
-                exit 982
961
-            fi
962
-            rm -rf /root/tempdlna
963
-        fi
964
-    fi
949
+	if [[ $RESTORE_APP != 'all' ]]; then
950
+		if [[ $RESTORE_APP != 'dlna' ]]; then
951
+			return
952
+		fi
953
+	fi
954
+	if [ -d /var/cache/minidlna ]; then
955
+		if [ -d $SERVER_DIRECTORY/backup/dlna ]; then
956
+			echo $"Restoring DLNA cache"
957
+			restore_directory_from_friend /root/tempdlna dlna
958
+			cp -r /root/tempdlna/var/cache/minidlna/* /var/cache/minidlna/
959
+			if [ ! "$?" = "0" ]; then
960
+				exit 982
961
+			fi
962
+			rm -rf /root/tempdlna
963
+		fi
964
+	fi
965 965
 }
966 966
 
967 967
 # Social key management

+ 1
- 1
src/freedombone-rmuser Целия файл

@@ -112,7 +112,7 @@ fi
112 112
 
113 113
 if grep -q "install_owncloud_repo" $COMPLETION_FILE; then
114 114
     OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
115
-    /var/www/${OWNCLOUD_DOMAIN_NAME}/htdocs/occ user:delete $MY_USERNAME
115
+    /var/www/owncloud/occ user:delete $MY_USERNAME
116 116
 fi
117 117
 
118 118
 userdel -r $MY_USERNAME