|
@@ -284,6 +284,12 @@ if [ ! -f $COMPLETION_FILE ]; then
|
284
|
284
|
touch $COMPLETION_FILE
|
285
|
285
|
fi
|
286
|
286
|
|
|
287
|
+# Your github username
|
|
288
|
+GITHUB_USERNAME=
|
|
289
|
+
|
|
290
|
+# Directory where github projects will be backed up
|
|
291
|
+GITHUB_BACKUP_DIRECTORY=/var/backups/github
|
|
292
|
+
|
287
|
293
|
# message if something fails to install
|
288
|
294
|
CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
|
289
|
295
|
|
|
@@ -347,6 +353,12 @@ function read_configuration {
|
347
|
353
|
if grep -q "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE; then
|
348
|
354
|
LOCAL_NETWORK_STATIC_IP_ADDRESS=$(grep "LOCAL_NETWORK_STATIC_IP_ADDRESS" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
349
|
355
|
fi
|
|
356
|
+ if grep -q "GITHUB_USERNAME" $CONFIGURATION_FILE; then
|
|
357
|
+ GITHUB_USERNAME=$(grep "GITHUB_USERNAME" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
|
358
|
+ fi
|
|
359
|
+ if grep -q "GITHUB_BACKUP_DIRECTORY" $CONFIGURATION_FILE; then
|
|
360
|
+ GITHUB_BACKUP_DIRECTORY=$(grep "GITHUB_BACKUP_DIRECTORY" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
|
361
|
+ fi
|
350
|
362
|
if grep -q "CPU_CORES" $CONFIGURATION_FILE; then
|
351
|
363
|
CPU_CORES=$(grep "CPU_CORES" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
352
|
364
|
fi
|
|
@@ -5328,6 +5340,43 @@ function create_git_project {
|
5328
|
5340
|
echo 'create_git_project' >> $COMPLETION_FILE
|
5329
|
5341
|
}
|
5330
|
5342
|
|
|
5343
|
+# Create daily backups of any projects on Github
|
|
5344
|
+# Then if Github goes away, turns evil, is censored or has
|
|
5345
|
+# outages then you still have access to your projects
|
|
5346
|
+function backup_github_projects {
|
|
5347
|
+ if grep -Fxq "backup_github_projects" $COMPLETION_FILE; then
|
|
5348
|
+ return
|
|
5349
|
+ fi
|
|
5350
|
+ if [ ! $GITHUB_USERNAME ]; then
|
|
5351
|
+ return 731
|
|
5352
|
+ fi
|
|
5353
|
+ if [ ! $GITHUB_BACKUP_DIRECTORY ]; then
|
|
5354
|
+ return 732
|
|
5355
|
+ fi
|
|
5356
|
+ apt-get -y install git
|
|
5357
|
+
|
|
5358
|
+ # create a github backups directory if needed
|
|
5359
|
+ if [ ! -d $GITHUB_BACKUP_DIRECTORY ]; then
|
|
5360
|
+ mkdir -p $GITHUB_BACKUP_DIRECTORY
|
|
5361
|
+ fi
|
|
5362
|
+
|
|
5363
|
+ # get the backup utility
|
|
5364
|
+ cd $INSTALL_DIR
|
|
5365
|
+ git clone https://github.com/josegonzalez/python-github-backup
|
|
5366
|
+
|
|
5367
|
+ # install it
|
|
5368
|
+ cd $INSTALL_DIR/python-github-backup
|
|
5369
|
+ python setup.py install
|
|
5370
|
+
|
|
5371
|
+ # add a daily cron entry
|
|
5372
|
+ echo '#!/bin/bash' > /etc/cron.daily/github
|
|
5373
|
+ echo "github-backup $GITHUB_USERNAME -o $GITHUB_BACKUP_DIRECTORY --repositories" >> /etc/cron.daily/github
|
|
5374
|
+ echo 'exit 0' >> /etc/cron.daily/github
|
|
5375
|
+ chmod +x /etc/cron.daily/github
|
|
5376
|
+
|
|
5377
|
+ echo 'backup_github_projects' >> $COMPLETION_FILE
|
|
5378
|
+}
|
|
5379
|
+
|
5331
|
5380
|
function install_final {
|
5332
|
5381
|
if grep -Fxq "install_final" $COMPLETION_FILE; then
|
5333
|
5382
|
return
|
|
@@ -5372,6 +5421,7 @@ set_your_domain_name
|
5372
|
5421
|
time_synchronisation
|
5373
|
5422
|
configure_internet_protocol
|
5374
|
5423
|
create_git_project
|
|
5424
|
+backup_github_projects
|
5375
|
5425
|
configure_ssh
|
5376
|
5426
|
check_hwrng
|
5377
|
5427
|
search_for_attached_usb_drive
|