Browse Source

Upgrade script

Bob Mottram 10 years ago
parent
commit
e48fae7ff8
3 changed files with 56 additions and 0 deletions
  1. BIN
      images/logo.png
  2. 23
    0
      index.org
  3. 33
    0
      install-freedombone.sh

BIN
images/logo.png View File


+ 23
- 0
index.org View File

@@ -0,0 +1,23 @@
1
+#+TITLE:
2
+#+AUTHOR: Bob Mottram
3
+#+EMAIL: bob@robotics.uk.to
4
+#+KEYWORDS: freedombox, debian, beaglebone, red matrix, email, web server, home server, internet, censorship, surveillance, social network, irc, jabber
5
+#+DESCRIPTION: Turn the Beaglebone Black into a personal communications server
6
+#+OPTIONS: ^:nil
7
+#+STYLE: <link rel="stylesheet" type="text/css" href="index.css" />
8
+#+BEGIN_CENTER
9
+[[./images/freedombone_logo.png]]
10
+#+END_CENTER
11
+
12
+
13
+* Introduction
14
+
15
+* License
16
+
17
+#+BEGIN_CENTER
18
+Copyright (C)  2014  Bob Mottram
19
+
20
+Permission is granted to copy, distribute and/or modify this document under the terms of the [[https://gnu.org/licenses/fdl.html][GNU Free Documentation License]], Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
21
+
22
+Source for this web site in [[https://en.wikipedia.org/wiki/Org-mode][Emacs org-mode]] format is available [[/beaglebone.txt][here]]. Comments or patches may be submitted via [[https://github.com/bashrc/freedombone][Github]].
23
+#+END_CENTER

+ 33
- 0
install-freedombone.sh View File

@@ -228,6 +228,9 @@ USB_DRIVE=/dev/sda1
228 228
 # Location where the USB drive is mounted to
229 229
 USB_MOUNT=/mnt/usb
230 230
 
231
+# name of a script used to upgrade the system
232
+UPGRADE_SCRIPT_NAME="freedombone-upgrade"
233
+
231 234
 # Name of a script used to create a backup of the system on usb drive
232 235
 BACKUP_SCRIPT_NAME="backup"
233 236
 
@@ -4501,6 +4504,35 @@ function install_mediagoblin {
4501 4504
   echo 'install_mediagoblin' >> $COMPLETION_FILE
4502 4505
 }
4503 4506
 
4507
+function create_upgrade_script {
4508
+  if grep -Fxq "create_upgrade_script" $COMPLETION_FILE; then
4509
+      return
4510
+  fi
4511
+  echo '#!/bin/bash' > /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4512
+  echo '' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4513
+  echo 'apt-get -y update' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4514
+  echo 'apt-get -y --force-yes upgrade' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4515
+  if [ $REDMATRIX_DOMAIN_NAME ]; then
4516
+      echo "cd /var/www/$REDMATRIX_DOMAIN_NAME/htdocs" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4517
+      echo 'git stash' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4518
+      echo 'git stash drop' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4519
+      echo 'git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4520
+      echo "cd /var/www/$REDMATRIX_DOMAIN_NAME/htdocs/addon" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4521
+      echo 'git stash' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4522
+      echo 'git stash drop' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4523
+      echo 'git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4524
+  fi
4525
+  if [ $MICROBLOG_DOMAIN_NAME ]; then
4526
+      echo "cd /var/www/$MICROBLOG_DOMAIN_NAME/htdocs" >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4527
+      echo 'git stash' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4528
+      echo 'git stash drop' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4529
+      echo 'git pull' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4530
+  fi
4531
+  echo 'exit 0' >> /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4532
+  chmod +x /etc/cron.weekly/$UPGRADE_SCRIPT_NAME
4533
+  echo 'create_upgrade_script' >> $COMPLETION_FILE
4534
+}
4535
+
4504 4536
 function install_final {
4505 4537
   if grep -Fxq "install_final" $COMPLETION_FILE; then
4506 4538
       return
@@ -4549,6 +4581,7 @@ check_hwrng
4549 4581
 search_for_attached_usb_drive
4550 4582
 regenerate_ssh_keys
4551 4583
 script_to_make_self_signed_certificates
4584
+create_upgrade_script
4552 4585
 configure_email
4553 4586
 create_procmail
4554 4587
 #spam_filtering