Browse Source

upgrade command

master
Bob Mottram 4 months ago
parent
commit
6881afceb6

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

@@ -75,7 +75,7 @@ function upgrade_distro_datserver {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add datserver $DATSERVER_PORT
fi
}


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

@@ -55,7 +55,8 @@ function upgrade_distro_dlna {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
sed -i '/configure_firewall_for_dlna/d' "$COMPLETION_FILE"
configure_firewall_for_dlna
fi
}


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

@@ -50,6 +50,7 @@ function upgrade_distro_ipfs {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
firewall_add IPFS $IPFS_PORT tcp
echo -n ''
fi
}

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

@@ -64,7 +64,8 @@ function upgrade_distro_irc {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
sed -i '/configure_firewall_for_irc/d' "$COMPLETION_FILE"
configure_firewall_for_irc
fi
}


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

@@ -51,7 +51,8 @@ function upgrade_distro_keyserver {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
sed -i '/configure_firewall_for_keyserver/d' "$COMPLETION_FILE"
configure_firewall_for_keyserver
fi
}

@@ -108,7 +109,6 @@ function keyserver_watchdog {
rm $keyserver_watchdog_script
}


function configure_firewall_for_keyserver {
if [[ $ONION_ONLY != "no" ]]; then
return

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

@@ -79,6 +79,7 @@ function upgrade_distro_matrix {

if [[ "$target_distro" == 'buster' ]]; then
$INSTALL_PACKAGES libevent-2.1-6 libpq-dev
firewall_add matrix ${MATRIX_HTTP_PORT}
fi
}


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

@@ -64,7 +64,10 @@ function upgrade_distro_mpd {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add mpd $MPD_PORT_HTTP tcp
firewall_add mpd $MPD_PORT_HTTP udp
firewall_add mpd $MPD_PORT tcp
firewall_add mpd $MPD_PORT udp
fi
}


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

@@ -58,7 +58,7 @@ function upgrade_distro_mumble {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add Mumble ${MUMBLE_PORT}
fi
}


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

@@ -66,7 +66,7 @@ function upgrade_distro_pihole {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add DNS 53
fi
}


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

@@ -60,7 +60,7 @@ function upgrade_distro_rsync {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add rsync $RSYNC_PORT tcp
fi
}


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

@@ -59,7 +59,7 @@ function upgrade_distro_scuttlebot {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add scuttlebot ${SCUTTLEBOT_PORT}
fi
}


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

@@ -62,7 +62,7 @@ function upgrade_distro_syncthing {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add Syncthing ${SYNCTHING_PORT}
fi
}


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

@@ -67,7 +67,7 @@ function upgrade_distro_tox {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add Tox "${TOX_PORT}"
fi
}


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

@@ -96,7 +96,12 @@ function upgrade_distro_xmpp {
target_distro="$1"

if [[ "$target_distro" == 'buster' ]]; then
echo -n ''
firewall_add XMPP 5222 tcp
firewall_add XMPP 5223 tcp
firewall_add XMPP 5269 tcp
firewall_add XMPP 5280 tcp
firewall_add XMPP 5281 tcp
sed -i '/prosody_filename/d' "$COMPLETION_FILE"
fi
}

@@ -997,6 +1002,8 @@ function upgrade_xmpp {
fi

if [ $xmpp_restart ]; then
$PACKAGE_HOLD prosody

cp -r "$INSTALL_DIR/prosody-modules/"* ${XMPP_DIRECTORY}/prosody-modules/
chown -R prosody:prosody ${XMPP_DIRECTORY}/prosody-modules


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

@@ -70,11 +70,50 @@ function upgrade_apps_to_distro {
done
}

function upgrade_project_repo {
target_distro="$1"
cd /root/${PROJECT_NAME} || return
git stash
git checkout "$target_distro"
git pull
make install
}

function upgrade_unhold_packages {
target_distro="$1"
$PACKAGE_UNHOLD exim4
$PACKAGE_UNHOLD nodejs
if [ -d /etc/prosody ]; then
$PACKAGE_UNHOLD prosody
fi
}

function distro_upgrade_firewall {
sed -i '/configure_firewall/d' "$COMPLETION_FILE"
configure_firewall
}

function distro_upgrade_email {
sed -i '/configure_email_onion/d' "$COMPLETION_FILE"
sed -i '/install_email/d' "$COMPLETION_FILE"
sed -i '/email_client/d' "$COMPLETION_FILE"
sed -i '/email_archiving/d' "$COMPLETION_FILE"
sed -i '/spam_filtering/d' "$COMPLETION_FILE"
sed -i '/configure_imap/d' "$COMPLETION_FILE"
sed -i '/configure_imap_client_certs/d' "$COMPLETION_FILE"
install_email
}

target_distro="$1"
if [[ "$target_distro" == 'buster' ]]; then
clear
upgrade_unhold_packages "$target_distro"
upgrade_debian_repos "$target_distro"
upgrade_project_repo "$target_distro"
distro_upgrade_firewall
distro_upgrade_email
upgrade_apps_to_distro "$target_distro"
/usr/local/bin/${PROJECT_NAME}-upgrade
else
echo $'Target distro name not specified. eg. "buster"'
exit 1

+ 10
- 0
src/freedombone-installer View File

@@ -75,6 +75,7 @@ MUTED_WORDS=/root/${PROJECT_NAME}-firewall-words.cfg
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local

webadmin_install_dir="/var/www/${local_hostname}/htdocs/admin"
upgradeos_file="$webadmin_install_dir/.upgradeos.txt"
cancel_install_file="$webadmin_install_dir/.cancel_install.txt"
default_domain_file="$webadmin_install_dir/.default_domain.txt"
scuttlebot_file="$webadmin_install_dir/.scuttlebot_invite.txt"
@@ -2156,6 +2157,14 @@ function webadmin_upgrade {
fi
}

function webadmin_upgrade_operating_system {
if [ -f "$upgradeos_file" ]; then
cp /usr/local/bin/${PROJECT_NAME}-distro-upgrade /usr/bin/temp-distro-upgrade
/bin/bash /usr/bin/temp-distro-upgrade buster &
rm "$upgradeos_file"
fi
}

function webadmin_factory_reset {
if [ -f "$factoryreset_file" ]; then
rm "$factoryreset_file"
@@ -3707,6 +3716,7 @@ do
change_updates_settings
update_enable_ssh
webadmin_factory_reset
webadmin_upgrade_operating_system
webadmin_change_password
update_blocklist
update_muted_words

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

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

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

@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
body {
margin: 0;
font-family: Arial;
background-color: white;
color: black;
}

#headerpic {
width: 60%;
height: auto;
margin-right : auto;
margin-left : auto;
min-width : 220px;
}

.header {
text-align: center;
padding: 32px;
}

#iconpic {
width: 20%;
height: auto;
margin-right : auto;
margin-left : auto;
min-width : 120px;
}

.appurl {
color: grey;
font-size: 100%;
}

.appdesc {
font-size: 65%;
}

button {
border: none;
outline: 0;
display: inline-block;
padding: 8px;
color: white;
background-color: #000;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}

a {
text-decoration: none;
}

button:hover, a:hover {
opacity: 0.7;
}

</style>
</head>
<body>
<div class="header">
<a href="index.html" title="Go Back"><img id="headerpic" class="img-responsive" src="images/logo.png" alt="Go Back"></a>

<h3 translate="yes">Upgrade Operating System</h3>

<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>

<br>

<form action="reset.php" method="post">
<input type="submit" name="submitcancel" translate="yes" value="Go Back" /><br><br><br>
<input type="submit" name="submitupgradeoperatingsystemconfirm" translate="yes" value="Continue" /><br><br><br>
</form>

</div>

</body>
</html>

+ 11
- 0
webadmin/reset.php View File

@@ -39,6 +39,17 @@ if (isset($_POST['submitreset'])) {
$output_filename = "restarting.html";
}

if (isset($_POST['submitupgradeoperatingsystem'])) {
$output_filename = "upgrade_os.html";
}

if (isset($_POST['submitupgradeoperatingsystemconfirm'])) {
$upgrade_file = fopen(".upgradeos.txt", "w") or die("Unable to write to upgradeos file");
fwrite($upgrade_file, "upgrade");
fclose($upgrade_file);
$output_filename = "index.html";
}

if (isset($_POST['submitfactoryreset'])) {
$output_filename = "factory_reset_confirm.html";
}

Loading…
Cancel
Save