More mediagoblin stuff

This commit is contained in:
Bob Mottram 2016-03-30 09:49:35 +01:00
parent 8eb58e8419
commit 756c1c32e9
6 changed files with 552 additions and 453 deletions

View File

@ -1251,6 +1251,12 @@ function read_configuration {
if grep -q "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE; then
MEDIAGOBLIN_CODE=$(grep "MEDIAGOBLIN_CODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_REPO" $CONFIGURATION_FILE; then
MEDIAGOBLIN_REPO=$(grep "MEDIAGOBLIN_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "MEDIAGOBLIN_COMMIT" $CONFIGURATION_FILE; then
MEDIAGOBLIN_COMMIT=$(grep "MEDIAGOBLIN_COMMIT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
if grep -q "GIT_ADMIN_PASSWORD" $CONFIGURATION_FILE; then
GIT_ADMIN_PASSWORD=$(grep "GIT_ADMIN_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
fi
@ -1486,6 +1492,9 @@ function set_default_onion_domains {
if [ ${#GIT_DOMAIN_NAME} -gt 1 ]; then
GIT_DOMAIN_NAME='git.local'
fi
if [ ${#MEDIAGOBLIN_DOMAIN_NAME} -gt 1 ]; then
MEDIAGOBLIN_DOMAIN_NAME='media.local'
fi
}
function nginx_disable_sniffing {
@ -9607,6 +9616,12 @@ function install_mediagoblin {
cd $MEDIAGOBLIN_WORKING_DIRECTORY
git checkout $MEDIAGOBLIN_COMMIT -b $MEDIAGOBLIN_COMMIT
if ! grep -q "Mediagoblin commit" $COMPLETION_FILE; then
echo "Mediagoblin commit:$MEDIAGOBLIN_COMMIT" >> $COMPLETION_FILE
else
sed -i "s/Mediagoblin commit.*/Mediagoblin commit:$MEDIAGOBLIN_COMMIT/g" $COMPLETION_FILE
fi
./bootstrap.sh
if [ ! "$?" = "0" ]; then
exit 278826
@ -9668,6 +9683,13 @@ function install_mediagoblin {
systemctl enable mediagoblin
systemctl start mediagoblin
MEDIAGOBLIN_ONION_HOSTNAME=$(add_onion_service mediagoblin 80 ${MEDIAGOBLIN_ONION_PORT})
if ! grep -q "Mediagoblin onion domain" $COMPLETION_FILE; then
echo "Mediagoblin onion domain:${MEDIAGOBLIN_ONION_HOSTNAME}" >> $COMPLETION_FILE
else
sed -i "s|Mediagoblin onion domain.*|Mediagoblin onion domain:${MEDIAGOBLIN_ONION_HOSTNAME}|g" $COMPLETION_FILE
fi
# web config
MEDIAGOBLIN_VIRTUAL_HOST=/etc/nginx/sites-available/$MEDIAGOBLIN_DOMAIN_NAME
nginx_http_redirect $MEDIAGOBLIN_DOMAIN_NAME

View File

@ -104,6 +104,10 @@ function update_domains {
if grep -q "Owncloud domain" $COMPLETION_FILE; then
OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
fi
MEDIAGOBLIN_DOMAIN_NAME='mediagoblin'
if grep -q "Mediagoblin domain" $COMPLETION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
fi
}
function mount_drive {
@ -377,6 +381,7 @@ function backup_directories {
"none, none, /var/www/${HUBZILLA_DOMAIN_NAME}/htdocs, hubzilla"
"none, none, /var/www/${FULLBLOG_DOMAIN_NAME}/htdocs, blog"
"none, none, /var/lib/tor, tor"
"none, none, /var/www/${MEDIAGOBLIN_DOMAIN_NAME}/htdocs, mediagoblin"
)
for dr in "${backup_dirs[@]}"
@ -533,6 +538,7 @@ function valid_backup_destination {
"$destination_dir" == "owncloudfiles" || \
"$destination_dir" == "owncloudconfig" || \
"$destination_dir" == "ownclouddata" || \
"$destination_dir" == "mediagoblin" || \
"$destination_dir" == "mailinglist" ]]; then
is_valid="no"
fi

View File

@ -341,6 +341,16 @@ function backup_owncloud {
fi
}
function backup_mediagoblin {
if grep -q "Mediagoblin domain" $COMPLETION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
suspend_site ${MEDIAGOBLIN_DOMAIN_NAME}
echo $"Backing up Mediagoblin"
backup_directory_to_friend /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs mediagoblin
restart_site
fi
}
function backup_gogs {
if [ -d /home/git/go/src/github.com/gogits ]; then
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
@ -603,6 +613,7 @@ if [[ $TEST_MODE == "no" ]]; then
backup_rss_reader
backup_hubzilla
backup_owncloud
backup_mediagoblin
backup_gogs
backup_wiki
backup_blog

View File

@ -393,6 +393,15 @@ function show_domains {
fi
echo ''
fi
if grep -q "Mediagoblin domain" $COMPLETION_FILE; then
echo -n -e "$(pad_string 'Mediagoblin')"
MEDIADOM=$(cat ${COMPLETION_FILE} | grep 'Mediagoblin domain' | awk -F ':' '{print $2}')
echo -n -e "$(pad_string ${MEDIADOM})"
if [ -d /var/lib/tor/hidden_service_mediagoblin ]; then
echo -n "$(cat /var/lib/tor/hidden_service_mediagoblin/hostname)"
fi
echo ''
fi
echo ''
}
@ -1074,7 +1083,7 @@ function restore_from_usb {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"Restore from USB backup" \
--radiolist $"Choose an application to restore:" 31 70 28 \
--radiolist $"Choose an application to restore:" 32 70 28 \
1 $"Everything" off \
2 $"Return to the backup and restore menu" on \
3 $"Configuration files" off \
@ -1105,7 +1114,8 @@ function restore_from_usb {
28 $"DLNA" off \
29 $"VoIP" off \
30 $"RSS reader" off \
31 $"Tox" off 2> $data
31 $"Tox" off \
32 $"Mediagoblin" off 2> $data
sel=$?
case $sel in
1) break;;
@ -1148,6 +1158,7 @@ function restore_from_usb {
29) ${PROJECT_NAME}-restore-local $USB_DRIVE voip;;
30) ${PROJECT_NAME}-restore-local $USB_DRIVE ttrss;;
31) ${PROJECT_NAME}-restore-local $USB_DRIVE tox;;
32) ${PROJECT_NAME}-restore-local $USB_DRIVE mediagoblin;;
esac
done
any_key

View File

@ -58,6 +58,7 @@ DATABASE_PASSWORD=$(cat /root/dbpass)
MICROBLOG_DOMAIN_NAME=
HUBZILLA_DOMAIN_NAME=
OWNCLOUD_DOMAIN_NAME=
MEDIAGOBLIN_DOMAIN_NAME=
GIT_DOMAIN_NAME=
WIKI_DOMAIN_NAME=
FULLBLOG_DOMAIN_NAME=
@ -249,6 +250,9 @@ function update_domains {
if grep -q "Owncloud domain" $COMPLETION_FILE; then
OWNCLOUD_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Owncloud domain" | awk -F ':' '{print $2}')
fi
if grep -q "Mediagoblin domain" $COMPLETION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
fi
if grep -q "Gogs domain" $COMPLETION_FILE; then
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
fi
@ -865,6 +869,28 @@ function restore_owncloud {
fi
}
function restore_mediagoblin {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'mediagoblin' ]]; then
return
fi
fi
if [ ! $MEDIAGOBLIN_DOMAIN_NAME ]; then
return
fi
if [ -d $USB_MOUNT/backup/mediagoblin ]; then
restore_directory_from_usb /root/tempmediagoblin mediagoblin
cp -r /root/tempmediagoblin/* /
if [ ! "$?" = "0" ]; then
unmount_drive
exit 67843
fi
rm -rf /root/tempmediagoblin
chown -hR mediagoblin:www-data /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
fi
}
function restore_gogs {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'gogs' ]]; then
@ -1149,6 +1175,7 @@ restore_gnu_social
restore_hubzilla
restore_rss_reader
restore_owncloud
restore_mediagoblin
restore_gogs
restore_wiki
restore_blog

View File

@ -735,6 +735,27 @@ function restore_owncloud {
fi
}
function restore_mediagoblin {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'mediagoblin' ]]; then
return
fi
fi
if grep -q "Mediagoblin domain" $COMPLETION_FILE; then
MEDIAGOBLIN_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Mediagoblin domain" | awk -F ':' '{print $2}')
if [ -d $SERVER_DIRECTORY/backup/mediagoblin ]; then
echo $"Restoring Mediagoblin installation"
restore_directory_from_friend /root/tempmediagoblin mediagoblin
cp -r /root/tempmediagoblin/* /
if [ ! "$?" = "0" ]; then
exit 5626
fi
rm -rf /root/tempmediagoblin
fi
chown -hR mediagoblin:www-data /var/www/$MEDIAGOBLIN_DOMAIN_NAME/htdocs
fi
}
function restore_gogs {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'gogs' ]]; then
@ -992,6 +1013,7 @@ restore_gnu_social
restore_hubzilla
restore_rss_reader
restore_owncloud
restore_mediagoblin
restore_gogs
restore_wiki
restore_blog