Browse Source

upgrade command

master
Bob Mottram 1 month ago
parent
commit
6881afceb6

+ 1
- 1
src/freedombone-app-datserver View File

@@ -75,7 +75,7 @@ function upgrade_distro_datserver {
75 75
     target_distro="$1"
76 76
 
77 77
     if [[ "$target_distro" == 'buster' ]]; then
78
-        echo -n ''
78
+        firewall_add datserver $DATSERVER_PORT
79 79
     fi
80 80
 }
81 81
 

+ 2
- 1
src/freedombone-app-dlna View File

@@ -55,7 +55,8 @@ function upgrade_distro_dlna {
55 55
     target_distro="$1"
56 56
 
57 57
     if [[ "$target_distro" == 'buster' ]]; then
58
-        echo -n ''
58
+        sed -i '/configure_firewall_for_dlna/d' "$COMPLETION_FILE"
59
+        configure_firewall_for_dlna
59 60
     fi
60 61
 }
61 62
 

+ 1
- 0
src/freedombone-app-ipfs View File

@@ -50,6 +50,7 @@ function upgrade_distro_ipfs {
50 50
     target_distro="$1"
51 51
 
52 52
     if [[ "$target_distro" == 'buster' ]]; then
53
+        firewall_add IPFS $IPFS_PORT tcp
53 54
         echo -n ''
54 55
     fi
55 56
 }

+ 2
- 1
src/freedombone-app-irc View File

@@ -64,7 +64,8 @@ function upgrade_distro_irc {
64 64
     target_distro="$1"
65 65
 
66 66
     if [[ "$target_distro" == 'buster' ]]; then
67
-        echo -n ''
67
+        sed -i '/configure_firewall_for_irc/d' "$COMPLETION_FILE"
68
+        configure_firewall_for_irc
68 69
     fi
69 70
 }
70 71
 

+ 2
- 2
src/freedombone-app-keyserver View File

@@ -51,7 +51,8 @@ function upgrade_distro_keyserver {
51 51
     target_distro="$1"
52 52
 
53 53
     if [[ "$target_distro" == 'buster' ]]; then
54
-        echo -n ''
54
+        sed -i '/configure_firewall_for_keyserver/d' "$COMPLETION_FILE"
55
+        configure_firewall_for_keyserver
55 56
     fi
56 57
 }
57 58
 
@@ -108,7 +109,6 @@ function keyserver_watchdog {
108 109
     rm $keyserver_watchdog_script
109 110
 }
110 111
 
111
-
112 112
 function configure_firewall_for_keyserver {
113 113
     if [[ $ONION_ONLY != "no" ]]; then
114 114
         return

+ 1
- 0
src/freedombone-app-matrix View File

@@ -79,6 +79,7 @@ function upgrade_distro_matrix {
79 79
 
80 80
     if [[ "$target_distro" == 'buster' ]]; then
81 81
         $INSTALL_PACKAGES libevent-2.1-6 libpq-dev
82
+        firewall_add matrix ${MATRIX_HTTP_PORT}
82 83
     fi
83 84
 }
84 85
 

+ 4
- 1
src/freedombone-app-mpd View File

@@ -64,7 +64,10 @@ function upgrade_distro_mpd {
64 64
     target_distro="$1"
65 65
 
66 66
     if [[ "$target_distro" == 'buster' ]]; then
67
-        echo -n ''
67
+        firewall_add mpd $MPD_PORT_HTTP tcp
68
+        firewall_add mpd $MPD_PORT_HTTP udp
69
+        firewall_add mpd $MPD_PORT tcp
70
+        firewall_add mpd $MPD_PORT udp
68 71
     fi
69 72
 }
70 73
 

+ 1
- 1
src/freedombone-app-mumble View File

@@ -58,7 +58,7 @@ function upgrade_distro_mumble {
58 58
     target_distro="$1"
59 59
 
60 60
     if [[ "$target_distro" == 'buster' ]]; then
61
-        echo -n ''
61
+        firewall_add Mumble ${MUMBLE_PORT}
62 62
     fi
63 63
 }
64 64
 

+ 1
- 1
src/freedombone-app-pihole View File

@@ -66,7 +66,7 @@ function upgrade_distro_pihole {
66 66
     target_distro="$1"
67 67
 
68 68
     if [[ "$target_distro" == 'buster' ]]; then
69
-        echo -n ''
69
+        firewall_add DNS 53
70 70
     fi
71 71
 }
72 72
 

+ 1
- 1
src/freedombone-app-rsync View File

@@ -60,7 +60,7 @@ function upgrade_distro_rsync {
60 60
     target_distro="$1"
61 61
 
62 62
     if [[ "$target_distro" == 'buster' ]]; then
63
-        echo -n ''
63
+        firewall_add rsync $RSYNC_PORT tcp
64 64
     fi
65 65
 }
66 66
 

+ 1
- 1
src/freedombone-app-scuttlebot View File

@@ -59,7 +59,7 @@ function upgrade_distro_scuttlebot {
59 59
     target_distro="$1"
60 60
 
61 61
     if [[ "$target_distro" == 'buster' ]]; then
62
-        echo -n ''
62
+        firewall_add scuttlebot ${SCUTTLEBOT_PORT}
63 63
     fi
64 64
 }
65 65
 

+ 1
- 1
src/freedombone-app-syncthing View File

@@ -62,7 +62,7 @@ function upgrade_distro_syncthing {
62 62
     target_distro="$1"
63 63
 
64 64
     if [[ "$target_distro" == 'buster' ]]; then
65
-        echo -n ''
65
+        firewall_add Syncthing ${SYNCTHING_PORT}
66 66
     fi
67 67
 }
68 68
 

+ 1
- 1
src/freedombone-app-tox View File

@@ -67,7 +67,7 @@ function upgrade_distro_tox {
67 67
     target_distro="$1"
68 68
 
69 69
     if [[ "$target_distro" == 'buster' ]]; then
70
-        echo -n ''
70
+        firewall_add Tox "${TOX_PORT}"
71 71
     fi
72 72
 }
73 73
 

+ 8
- 1
src/freedombone-app-xmpp View File

@@ -96,7 +96,12 @@ function upgrade_distro_xmpp {
96 96
     target_distro="$1"
97 97
 
98 98
     if [[ "$target_distro" == 'buster' ]]; then
99
-        echo -n ''
99
+        firewall_add XMPP 5222 tcp
100
+        firewall_add XMPP 5223 tcp
101
+        firewall_add XMPP 5269 tcp
102
+        firewall_add XMPP 5280 tcp
103
+        firewall_add XMPP 5281 tcp
104
+        sed -i '/prosody_filename/d' "$COMPLETION_FILE"
100 105
     fi
101 106
 }
102 107
 
@@ -997,6 +1002,8 @@ function upgrade_xmpp {
997 1002
     fi
998 1003
 
999 1004
     if [ $xmpp_restart ]; then
1005
+        $PACKAGE_HOLD prosody
1006
+
1000 1007
         cp -r "$INSTALL_DIR/prosody-modules/"* ${XMPP_DIRECTORY}/prosody-modules/
1001 1008
         chown -R prosody:prosody ${XMPP_DIRECTORY}/prosody-modules
1002 1009
 

+ 39
- 0
src/freedombone-distro-upgrade View File

@@ -70,11 +70,50 @@ function upgrade_apps_to_distro {
70 70
     done
71 71
 }
72 72
 
73
+function upgrade_project_repo {
74
+    target_distro="$1"
75
+    cd /root/${PROJECT_NAME} || return
76
+    git stash
77
+    git checkout "$target_distro"
78
+    git pull
79
+    make install
80
+}
81
+
82
+function upgrade_unhold_packages {
83
+    target_distro="$1"
84
+    $PACKAGE_UNHOLD exim4
85
+    $PACKAGE_UNHOLD nodejs
86
+    if [ -d /etc/prosody ]; then
87
+        $PACKAGE_UNHOLD prosody
88
+    fi
89
+}
90
+
91
+function distro_upgrade_firewall {
92
+    sed -i '/configure_firewall/d' "$COMPLETION_FILE"
93
+    configure_firewall
94
+}
95
+
96
+function distro_upgrade_email {
97
+    sed -i '/configure_email_onion/d' "$COMPLETION_FILE"
98
+    sed -i '/install_email/d' "$COMPLETION_FILE"
99
+    sed -i '/email_client/d' "$COMPLETION_FILE"
100
+    sed -i '/email_archiving/d' "$COMPLETION_FILE"
101
+    sed -i '/spam_filtering/d' "$COMPLETION_FILE"
102
+    sed -i '/configure_imap/d' "$COMPLETION_FILE"
103
+    sed -i '/configure_imap_client_certs/d' "$COMPLETION_FILE"
104
+    install_email
105
+}
106
+
73 107
 target_distro="$1"
74 108
 if [[ "$target_distro" == 'buster' ]]; then
75 109
     clear
110
+    upgrade_unhold_packages "$target_distro"
76 111
     upgrade_debian_repos "$target_distro"
112
+    upgrade_project_repo "$target_distro"
113
+    distro_upgrade_firewall
114
+    distro_upgrade_email
77 115
     upgrade_apps_to_distro "$target_distro"
116
+    /usr/local/bin/${PROJECT_NAME}-upgrade
78 117
 else
79 118
     echo $'Target distro name not specified. eg. "buster"'
80 119
     exit 1

+ 10
- 0
src/freedombone-installer View File

@@ -75,6 +75,7 @@ MUTED_WORDS=/root/${PROJECT_NAME}-firewall-words.cfg
75 75
 local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
76 76
 
77 77
 webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
78
+upgradeos_file="$webadmin_install_dir/.upgradeos.txt"
78 79
 cancel_install_file="$webadmin_install_dir/.cancel_install.txt"
79 80
 default_domain_file="$webadmin_install_dir/.default_domain.txt"
80 81
 scuttlebot_file="$webadmin_install_dir/.scuttlebot_invite.txt"
@@ -2156,6 +2157,14 @@ function webadmin_upgrade {
2156 2157
     fi
2157 2158
 }
2158 2159
 
2160
+function webadmin_upgrade_operating_system {
2161
+    if [ -f "$upgradeos_file" ]; then
2162
+        cp /usr/local/bin/${PROJECT_NAME}-distro-upgrade /usr/bin/temp-distro-upgrade
2163
+        /bin/bash /usr/bin/temp-distro-upgrade buster &
2164
+        rm "$upgradeos_file"
2165
+    fi
2166
+}
2167
+
2159 2168
 function webadmin_factory_reset {
2160 2169
     if [ -f "$factoryreset_file" ]; then
2161 2170
         rm "$factoryreset_file"
@@ -3707,6 +3716,7 @@ do
3707 3716
                     change_updates_settings
3708 3717
                     update_enable_ssh
3709 3718
                     webadmin_factory_reset
3719
+                    webadmin_upgrade_operating_system
3710 3720
                     webadmin_change_password
3711 3721
                     update_blocklist
3712 3722
                     update_muted_words

+ 1
- 0
webadmin/EN/reset.html View File

@@ -84,6 +84,7 @@
84 84
         <form action="reset.php" method="post">
85 85
           <input type="submit" name="submitshutdown" translate="yes" value="Shutdown" /><br><br><br>
86 86
           <input type="submit" name="submitreset" translate="yes" value="Restart" /><br><br><br>
87
+          <input type="submit" name="submitupgradeoperatingsystem" translate="yes" value="Upgrade Operating System" /><br><br><br>
87 88
           <input type="submit" name="submitfactoryreset" translate="yes" value="Reset to factory" /><br><br><br>
88 89
           <input type="submit" name="submitresetcancel" translate="yes" value="Cancel" />
89 90
         </form>

+ 84
- 0
webadmin/EN/upgrade_os.html View File

@@ -0,0 +1,84 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <style>
6
+      body {
7
+          margin: 0;
8
+          font-family: Arial;
9
+          background-color: white;
10
+          color: black;
11
+      }
12
+
13
+      #headerpic {
14
+          width: 60%;
15
+          height: auto;
16
+          margin-right : auto;
17
+          margin-left : auto;
18
+          min-width : 220px;
19
+      }
20
+
21
+      .header {
22
+          text-align: center;
23
+          padding: 32px;
24
+      }
25
+
26
+      #iconpic {
27
+          width: 20%;
28
+          height: auto;
29
+          margin-right : auto;
30
+          margin-left : auto;
31
+          min-width : 120px;
32
+      }
33
+
34
+      .appurl {
35
+          color: grey;
36
+          font-size: 100%;
37
+      }
38
+
39
+      .appdesc {
40
+          font-size: 65%;
41
+      }
42
+
43
+      button {
44
+          border: none;
45
+          outline: 0;
46
+          display: inline-block;
47
+          padding: 8px;
48
+          color: white;
49
+          background-color: #000;
50
+          text-align: center;
51
+          cursor: pointer;
52
+          width: 100%;
53
+          font-size: 18px;
54
+      }
55
+
56
+      a {
57
+          text-decoration: none;
58
+      }
59
+
60
+      button:hover, a:hover {
61
+          opacity: 0.7;
62
+      }
63
+
64
+    </style>
65
+  </head>
66
+  <body>
67
+    <div class="header">
68
+      <a href="index.html" title="Go Back"><img id="headerpic" class="img-responsive" src="images/logo.png" alt="Go Back"></a>
69
+
70
+      <h3 translate="yes">Upgrade Operating System</h3>
71
+
72
+      <h4 translate="yes">WARNING: If anything goes wrong during the upgrade then this can prevent your server from running. You should make sure that you have a full drive backup of the server before continuing.</h4>
73
+
74
+      <br>
75
+
76
+      <form action="reset.php" method="post">
77
+        <input type="submit" name="submitcancel" translate="yes" value="Go Back" /><br><br><br>
78
+        <input type="submit" name="submitupgradeoperatingsystemconfirm" translate="yes" value="Continue" /><br><br><br>
79
+      </form>
80
+
81
+    </div>
82
+
83
+  </body>
84
+</html>

+ 11
- 0
webadmin/reset.php View File

@@ -39,6 +39,17 @@ if (isset($_POST['submitreset'])) {
39 39
     $output_filename = "restarting.html";
40 40
 }
41 41
 
42
+if (isset($_POST['submitupgradeoperatingsystem'])) {
43
+    $output_filename = "upgrade_os.html";
44
+}
45
+
46
+if (isset($_POST['submitupgradeoperatingsystemconfirm'])) {
47
+    $upgrade_file = fopen(".upgradeos.txt", "w") or die("Unable to write to upgradeos file");
48
+    fwrite($upgrade_file, "upgrade");
49
+    fclose($upgrade_file);
50
+    $output_filename = "index.html";
51
+}
52
+
42 53
 if (isset($_POST['submitfactoryreset'])) {
43 54
     $output_filename = "factory_reset_confirm.html";
44 55
 }

Loading…
Cancel
Save