#!/bin/bash # # .---. . . # | | | # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-' # ' ' --' --' -' - -' ' ' -' -' -' ' - --' # # Freedom in the Cloud # # Ghost blog # # License # ======= # # Copyright (C) 2016 Bob Mottram # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . VARIANTS="full full-vim writer" IN_DEFAULT_INSTALL=0 SHOW_ON_ABOUT=1 GHOST_DOMAIN_NAME= GHOST_CODE= GHOST_ONION_PORT=8104 GHOST_VERSION='0.11.3' GHOST_PORT=2368 ghost_variables=(GHOST_VERSION GHOST_DOMAIN_NAME GHOST_CODE GHOST_ADMIN_PASSWORD ONION_ONLY DDNS_PROVIDER MY_USERNAME) function ghost_replace_jquery { sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" content/themes/casper/default.hbs sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" core/server/data/migration/fixtures/004/01-move-jquery-with-alert.js sed -i "s|code.jquery.com/jquery-${previous_jquery_version}.min.js|$GHOST_DOMAIN_NAME/jquery-${jquery_version}.js|g" node_modules/gscan/app/tpl/layouts/default.hbs } function ghost_remove_offsite_links { cd /var/www/$GHOST_DOMAIN_NAME/htdocs # remove google font links # Note that the privacy options in config.js aren't sufficient to remove Google's tentacles sed -i "s/fonts.googleapis.com/$GHOST_DOMAIN_NAME/g" content/themes/casper/default.hbs sed -i "s/fonts.googleapis.com/$GHOST_DOMAIN_NAME/g" core/server/apps/amp/lib/views/amp.hbs # copy jquery locally previous_jquery_version='1.12.0' jquery_version='1.12.4' if [ ! -f /var/www/$GHOST_DOMAIN_NAME/htdocs/jquery-${jquery_version}.js ]; then wget https://code.jquery.com/jquery-${jquery_version}.js jquery_hash=$(sha256sum jquery-${jquery_version}.js | awk -F ' ' '{print $1}') if [[ "$jquery_hash" != '430f36f9b5f21aae8cc9dca6a81c4d3d84da5175eaedcf2fdc2c226302cb3575' ]]; then echo $'Unexpected jquery hash value' exit 258442 fi fi ghost_replace_jquery previous_jquery_version='1.11.3' ghost_replace_jquery } function ghost_replace_proprietary_services { replace_file=$1 sed -i 's|Twitter Profile|GNU Social Profile|g' $replace_file sed -i 's|Twitter Username|GNU Social Username|g' $replace_file sed -i 's|twitter.com|quitter.se|g' $replace_file sed -i 's|Facebook Page|Hubzilla Channel|g' $replace_file sed -i 's|www.facebook.com/username|hubzilladomain/username|g' $replace_file sed -i 's|www.facebook.com/ghost|hubzilladomain/username|g' $replace_file sed -i 's|www.facebook.com/testuser|hubzilladomain/username|g' $replace_file sed -i 's|www.facebook.com/testing|hubzilladomain/username|g' $replace_file sed -i 's|www.facebook.com/test|hubzilladomain/username|g' $replace_file sed -i 's|www.facebook.com/yourUsername|hubzilladomain/username|g' $replace_file sed -i 's|www.facebook.com/yourPage|hubzilladomain/username|g' $replace_file sed -i 's|Facebook Username|Hubzilla Channel|g' $replace_file sed -i 's|www.facebook.com|hubzilladomain|g' $replace_file sed -i 's|facebook value|hubzilla value|g' $replace_file sed -i '/