Merge branch 'stretch' of https://github.com/bashrc/freedombone
This commit is contained in:
commit
9605ba0a48
|
@ -0,0 +1,438 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# .---. . .
|
||||
# | | |
|
||||
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
||||
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
||||
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
||||
#
|
||||
# Freedom in the Cloud
|
||||
#
|
||||
# Federated wiki
|
||||
#
|
||||
# License
|
||||
# =======
|
||||
#
|
||||
# Copyright (C) 2017 Bob Mottram <bob@freedombone.net>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
VARIANTS="full full-vim media"
|
||||
|
||||
IN_DEFAULT_INSTALL=0
|
||||
SHOW_ON_ABOUT=1
|
||||
|
||||
FEDWIKI_DOMAIN_NAME=
|
||||
FEDWIKI_CODE=
|
||||
FEDWIKI_VERSION='0.13.0'
|
||||
FEDWIKI_ONION_PORT=8131
|
||||
FEDWIKI_PORT=3053
|
||||
FEDWIKI_DATA=/var/lib/fedwiki
|
||||
|
||||
fedwiki_variables=(FEDWIKI_DOMAIN_NAME
|
||||
FEDWIKI_CODE
|
||||
FEDWIKI_ADMIN_PASSWORD
|
||||
ONION_ONLY
|
||||
DDNS_PROVIDER
|
||||
MY_USERNAME
|
||||
MY_EMAIL_ADDRESS)
|
||||
|
||||
function fedwiki_remove_bad_links {
|
||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js ]; then
|
||||
sed -i 's|maxcdn.bootstrapcdn.com|localhost|g' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
|
||||
fi
|
||||
|
||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css ]; then
|
||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css
|
||||
fi
|
||||
|
||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html ]; then
|
||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/addAlternativeDialog.html
|
||||
fi
|
||||
|
||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/done.html ]; then
|
||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/done.html
|
||||
fi
|
||||
|
||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html ]; then
|
||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/personaDialog.html
|
||||
fi
|
||||
|
||||
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html ]; then
|
||||
sed -i '/googleapi/d' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-passportjs/views/securityDialog.html
|
||||
fi
|
||||
|
||||
if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-google-oauth20 ]; then
|
||||
rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-google-oauth20
|
||||
fi
|
||||
|
||||
if [ -d /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2 ]; then
|
||||
rm -rf /usr/local/lib/node_modules/wiki/node_modules/passport-oauth2
|
||||
fi
|
||||
}
|
||||
|
||||
function logging_on_fedwiki {
|
||||
echo -n ''
|
||||
}
|
||||
|
||||
function logging_off_fedwiki {
|
||||
echo -n ''
|
||||
}
|
||||
|
||||
function remove_user_fedwiki {
|
||||
remove_username="$1"
|
||||
}
|
||||
|
||||
function add_user_fedwiki {
|
||||
if [[ $(app_is_installed fedwiki) == "0" ]]; then
|
||||
echo '0'
|
||||
return
|
||||
fi
|
||||
|
||||
new_username="$1"
|
||||
new_user_password="$2"
|
||||
|
||||
echo '0'
|
||||
}
|
||||
|
||||
function install_interactive_fedwiki {
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
FEDWIKI_DOMAIN_NAME='fedwiki.local'
|
||||
write_config_param "FEDWIKI_DOMAIN_NAME" "$FEDWIKI_DOMAIN_NAME"
|
||||
else
|
||||
function_check interactive_site_details
|
||||
interactive_site_details "fedwiki" "FEDWIKI_DOMAIN_NAME" "FEDWIKI_CODE"
|
||||
fi
|
||||
APP_INSTALLED=1
|
||||
}
|
||||
|
||||
function change_password_fedwiki {
|
||||
FEDWIKI_USERNAME="$1"
|
||||
FEDWIKI_PASSWORD="$2"
|
||||
if [ ${#FEDWIKI_PASSWORD} -lt 8 ]; then
|
||||
echo $'Fedwiki password is too short'
|
||||
return
|
||||
fi
|
||||
#${PROJECT_NAME}-pass -u $FEDWIKI_USERNAME -a fedwiki -p "$FEDWIKI_PASSWORD"
|
||||
}
|
||||
|
||||
function reconfigure_fedwiki {
|
||||
echo -n ''
|
||||
}
|
||||
|
||||
function upgrade_fedwiki {
|
||||
CURR_FEDWIKI_VERSION=$(get_completion_param "fedwiki version")
|
||||
if [[ "$CURR_FEDWIKI_VERSION" == "$FEDWIKI_VERSION" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
systemctl stop fedwiki
|
||||
npm upgrade -g wiki@$FEDWIKI_VERSION
|
||||
fedwiki_remove_bad_links
|
||||
chown -R fedwiki:fedwiki $FEDWIKI_DATA
|
||||
systemctl start fedwiki
|
||||
|
||||
set_completion_param "fedwiki version" "$FEDWIKI_VERSION"
|
||||
}
|
||||
|
||||
function backup_local_fedwiki {
|
||||
FEDWIKI_DOMAIN_NAME='fedwiki.local'
|
||||
if grep -q "fedwiki domain" $COMPLETION_FILE; then
|
||||
FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
|
||||
fi
|
||||
|
||||
systemctl stop fedwiki
|
||||
suspend_site ${FEDWIKI_DOMAIN_NAME}
|
||||
|
||||
fedwiki_path=$FEDWIKI_DATA
|
||||
if [ -d $fedwiki_path ]; then
|
||||
backup_directory_to_usb $fedwiki_path fedwiki
|
||||
fi
|
||||
|
||||
restart_site
|
||||
systemctl start fedwiki
|
||||
}
|
||||
|
||||
function restore_local_fedwiki {
|
||||
FEDWIKI_DOMAIN_NAME='fedwiki.local'
|
||||
if grep -q "fedwiki domain" $COMPLETION_FILE; then
|
||||
FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
|
||||
fi
|
||||
if [ $FEDWIKI_DOMAIN_NAME ]; then
|
||||
suspend_site ${FEDWIKI_DOMAIN_NAME}
|
||||
systemctl stop fedwiki
|
||||
|
||||
temp_restore_dir=/root/tempfedwiki
|
||||
function_check restore_directory_from_usb
|
||||
restore_directory_from_usb $temp_restore_dir fedwiki
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
if [ -d $temp_restore_dir$FEDWIKI_DATA ]; then
|
||||
cp -r $temp_restore_dir$FEDWIKI_DATA/* $FEDWIKI_DATA/
|
||||
else
|
||||
cp -r $temp_restore_dir/* $FEDWIKI_DATA/
|
||||
fi
|
||||
chown -R fedwiki:fedwiki $FEDWIKI_DATA
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
systemctl start fedwiki
|
||||
restart_site
|
||||
fi
|
||||
}
|
||||
|
||||
function backup_remote_fedwiki {
|
||||
FEDWIKI_DOMAIN_NAME='fedwiki.local'
|
||||
if grep -q "fedwiki domain" $COMPLETION_FILE; then
|
||||
FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
|
||||
fi
|
||||
|
||||
systemctl stop fedwiki
|
||||
suspend_site ${FEDWIKI_DOMAIN_NAME}
|
||||
|
||||
temp_backup_dir=$FEDWIKI_DATA
|
||||
if [ -d $temp_backup_dir ]; then
|
||||
backup_directory_to_friend $temp_backup_dir fedwiki
|
||||
else
|
||||
echo $"Fedwiki domain specified but not found in $temp_backup_dir"
|
||||
exit 63542852
|
||||
fi
|
||||
|
||||
restart_site
|
||||
systemctl start fedwiki
|
||||
}
|
||||
|
||||
function restore_remote_fedwiki {
|
||||
FEDWIKI_DOMAIN_NAME='fedwiki.local'
|
||||
if grep -q "fedwiki domain" $COMPLETION_FILE; then
|
||||
FEDWIKI_DOMAIN_NAME=$(get_completion_param "fedwiki domain")
|
||||
fi
|
||||
|
||||
systemctl stop fedwiki
|
||||
suspend_site ${FEDWIKI_DOMAIN_NAME}
|
||||
|
||||
temp_restore_dir=/root/tempfedwiki
|
||||
function_check restore_directory_from_friend
|
||||
restore_directory_from_friend $temp_restore_dir fedwiki
|
||||
if [ -d $temp_restore_dir ]; then
|
||||
if [ -d $temp_restore_dir$FEDWIKI_DATA ]; then
|
||||
cp -r $temp_restore_dir$FEDWIKI_DATA/* $FEDWIKI_DATA/
|
||||
else
|
||||
cp -r $temp_restore_dir/* $FEDWIKI_DATA/
|
||||
fi
|
||||
chown -R fedwiki: $FEDWIKI_DATA
|
||||
rm -rf $temp_restore_dir
|
||||
fi
|
||||
|
||||
systemctl start fedwiki
|
||||
restart_site
|
||||
}
|
||||
|
||||
function remove_fedwiki {
|
||||
if [ ${#FEDWIKI_DOMAIN_NAME} -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
systemctl stop fedwiki
|
||||
systemctl disable fedwiki
|
||||
rm /etc/systemd/system/fedwiki.service
|
||||
systemctl daemon-reload
|
||||
|
||||
npm uninstall -g wiki
|
||||
|
||||
function_check remove_nodejs
|
||||
remove_nodejs fedwiki
|
||||
|
||||
read_config_param "FEDWIKI_DOMAIN_NAME"
|
||||
nginx_dissite $FEDWIKI_DOMAIN_NAME
|
||||
remove_certs ${FEDWIKI_DOMAIN_NAME}
|
||||
if [ -f /etc/nginx/sites-available/$FEDWIKI_DOMAIN_NAME ]; then
|
||||
rm -f /etc/nginx/sites-available/$FEDWIKI_DOMAIN_NAME
|
||||
fi
|
||||
if [ -d /var/www/$FEDWIKI_DOMAIN_NAME ]; then
|
||||
rm -rf /var/www/$FEDWIKI_DOMAIN_NAME
|
||||
fi
|
||||
remove_config_param FEDWIKI_DOMAIN_NAME
|
||||
remove_config_param FEDWIKI_CODE
|
||||
function_check remove_onion_service
|
||||
remove_onion_service fedwiki ${FEDWIKI_ONION_PORT}
|
||||
remove_completion_param "install_fedwiki"
|
||||
sed -i '/fedwiki/d' $COMPLETION_FILE
|
||||
|
||||
groupdel -f fedwiki
|
||||
userdel -r fedwiki
|
||||
|
||||
if [ -d $FEDWIKI_DATA ]; then
|
||||
rm -rf $FEDWIKI_DATA
|
||||
fi
|
||||
|
||||
function_check remove_ddns_domain
|
||||
remove_ddns_domain $FEDWIKI_DOMAIN_NAME
|
||||
}
|
||||
|
||||
function fedwiki_setup_web {
|
||||
fedwiki_nginx_file=/etc/nginx/sites-available/$FEDWIKI_DOMAIN_NAME
|
||||
|
||||
if [[ $ONION_ONLY == "no" ]]; then
|
||||
echo 'server {' > $fedwiki_nginx_file
|
||||
echo ' listen 80;' >> $fedwiki_nginx_file
|
||||
echo ' listen [::]:80;' >> $fedwiki_nginx_file
|
||||
echo " server_name $FEDWIKI_DOMAIN_NAME;" >> $fedwiki_nginx_file
|
||||
echo ' rewrite ^ https://$server_name$request_uri? permanent;' >> $fedwiki_nginx_file
|
||||
echo '}' >> $fedwiki_nginx_file
|
||||
echo '' >> $fedwiki_nginx_file
|
||||
echo 'server {' >> $fedwiki_nginx_file
|
||||
echo ' listen 443 ssl;' >> $fedwiki_nginx_file
|
||||
echo ' listen [::]:443 ssl;' >> $fedwiki_nginx_file
|
||||
echo " server_name $FEDWIKI_DOMAIN_NAME;" >> $fedwiki_nginx_file
|
||||
echo '' >> $fedwiki_nginx_file
|
||||
function_check nginx_ssl
|
||||
nginx_ssl $FEDWIKI_DOMAIN_NAME mobile
|
||||
|
||||
echo ' add_header X-Robots-Tag none;' >> $fedwiki_nginx_file
|
||||
echo ' add_header X-Download-Options noopen;' >> $fedwiki_nginx_file
|
||||
echo ' add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file
|
||||
echo ' add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file
|
||||
echo ' add_header Strict-Transport-Security max-age=15768000;' >> $fedwiki_nginx_file
|
||||
echo '' >> $fedwiki_nginx_file
|
||||
echo ' location / {' >> $fedwiki_nginx_file
|
||||
echo " proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file
|
||||
echo ' proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file
|
||||
echo ' proxy_set_header Host $host;' >> $fedwiki_nginx_file
|
||||
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $fedwiki_nginx_file
|
||||
echo ' client_max_body_size 1M;' >> $fedwiki_nginx_file
|
||||
echo ' }' >> $fedwiki_nginx_file
|
||||
echo '}' >> $fedwiki_nginx_file
|
||||
echo '' >> $fedwiki_nginx_file
|
||||
else
|
||||
echo -n '' > $fedwiki_nginx_file
|
||||
fi
|
||||
echo 'server {' >> $fedwiki_nginx_file
|
||||
echo " listen 127.0.0.1:$FEDWIKI_ONION_PORT default_server;" >> $fedwiki_nginx_file
|
||||
echo " server_name $FEDWIKI_ONION_HOSTNAME;" >> $fedwiki_nginx_file
|
||||
echo '' >> $fedwiki_nginx_file
|
||||
echo ' add_header X-Robots-Tag none;' >> $fedwiki_nginx_file
|
||||
echo ' add_header X-Download-Options noopen;' >> $fedwiki_nginx_file
|
||||
echo ' add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file
|
||||
echo ' add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file
|
||||
echo '' >> $fedwiki_nginx_file
|
||||
echo ' location / {' >> $fedwiki_nginx_file
|
||||
echo " proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file
|
||||
echo ' proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file
|
||||
echo ' proxy_set_header Host $host;' >> $fedwiki_nginx_file
|
||||
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $fedwiki_nginx_file
|
||||
echo ' client_max_body_size 1M;' >> $fedwiki_nginx_file
|
||||
echo ' }' >> $fedwiki_nginx_file
|
||||
echo '}' >> $fedwiki_nginx_file
|
||||
|
||||
function_check create_site_certificate
|
||||
create_site_certificate $FEDWIKI_DOMAIN_NAME 'yes'
|
||||
|
||||
function_check nginx_ensite
|
||||
nginx_ensite $FEDWIKI_DOMAIN_NAME
|
||||
}
|
||||
|
||||
function install_fedwiki {
|
||||
if [[ $VARIANT == "mesh"* ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! $ONION_ONLY ]; then
|
||||
ONION_ONLY='no'
|
||||
fi
|
||||
|
||||
if [ ! $FEDWIKI_DOMAIN_NAME ]; then
|
||||
echo $'The fedwiki domain name was not specified'
|
||||
exit 893635
|
||||
fi
|
||||
|
||||
if [ ! -d /var/www/$FEDWIKI_DOMAIN_NAME/htdocs ]; then
|
||||
mkdir -p /var/www/$FEDWIKI_DOMAIN_NAME/htdocs
|
||||
fi
|
||||
|
||||
if [ ! -d $FEDWIKI_DATA ]; then
|
||||
mkdir -p $FEDWIKI_DATA
|
||||
fi
|
||||
|
||||
groupadd fedwiki
|
||||
useradd -c "Fedwiki system account" -d $FEDWIKI_DATA -m -r -g fedwiki fedwiki
|
||||
if [ -d $FEDWIKI_DATA/Maildir ]; then
|
||||
rm -rf $FEDWIKI_DATA/Maildir
|
||||
fi
|
||||
|
||||
function_check install_nodejs
|
||||
install_nodejs fedwiki
|
||||
|
||||
npm install -g wiki@$FEDWIKI_VERSION
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $'Failed to install fedwiki'
|
||||
exit 6293523
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/local/bin/wiki ]; then
|
||||
echo $'wiki was not installed'
|
||||
exit 5293524
|
||||
fi
|
||||
|
||||
if [ ! -d /usr/local/lib/node_modules/wiki ]; then
|
||||
echo $'wiki directory not found /usr/local/lib/node_modules/wiki'
|
||||
exit 6285324
|
||||
fi
|
||||
|
||||
FEDWIKI_ONION_HOSTNAME=$(add_onion_service fedwiki 80 ${FEDWIKI_ONION_PORT})
|
||||
|
||||
echo '[Unit]' > /etc/systemd/system/fedwiki.service
|
||||
echo 'Description=Fedwiki Decentralized video streaming platform' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'After=syslog.target' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'After=network.target' >> /etc/systemd/system/fedwiki.service
|
||||
echo '' >> /etc/systemd/system/fedwiki.service
|
||||
echo '[Service]' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'User=fedwiki' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'Group=fedwiki' >> /etc/systemd/system/fedwiki.service
|
||||
echo "WorkingDirectory=/usr/local/lib/node_modules/wiki" >> /etc/systemd/system/fedwiki.service
|
||||
echo "ExecStart=/usr/local/bin/wiki --data $FEDWIKI_DATA -p $FEDWIKI_PORT" >> /etc/systemd/system/fedwiki.service
|
||||
echo 'StandardOutput=syslog' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'StandardError=syslog' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'SyslogIdentifier=fedwiki' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'Restart=always' >> /etc/systemd/system/fedwiki.service
|
||||
echo "Environment=NODE_ENV=production" >> /etc/systemd/system/fedwiki.service
|
||||
echo '' >> /etc/systemd/system/fedwiki.service
|
||||
echo '[Install]' >> /etc/systemd/system/fedwiki.service
|
||||
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/fedwiki.service
|
||||
|
||||
chown -R fedwiki:fedwiki $FEDWIKI_DATA
|
||||
|
||||
fedwiki_setup_web
|
||||
|
||||
${PROJECT_NAME}-pass -u $MY_USERNAME -a fedwiki -p "$FEDWIKI_ADMIN_PASSWORD"
|
||||
|
||||
function_check add_ddns_domain
|
||||
add_ddns_domain $FEDWIKI_DOMAIN_NAME
|
||||
|
||||
fedwiki_remove_bad_links
|
||||
|
||||
systemctl enable fedwiki
|
||||
systemctl daemon-reload
|
||||
systemctl start fedwiki
|
||||
systemctl restart nginx
|
||||
|
||||
set_completion_param "fedwiki domain" "$FEDWIKI_DOMAIN_NAME"
|
||||
set_completion_param "fedwiki version" "$FEDWIKI_VERSION"
|
||||
APP_INSTALLED=1
|
||||
}
|
||||
|
||||
# NOTE: deliberately no exit 0
|
|
@ -34,7 +34,7 @@ VARIANTS="full full-vim writer"
|
|||
IN_DEFAULT_INSTALL=0
|
||||
SHOW_ON_ABOUT=1
|
||||
|
||||
GHOST_VERSION=1.6.2
|
||||
GHOST_VERSION=1.19.0
|
||||
GHOST_DOMAIN_NAME=
|
||||
GHOST_CODE=
|
||||
GHOST_ONION_PORT=8104
|
||||
|
@ -209,7 +209,8 @@ function upgrade_ghost {
|
|||
cd /var/www/$GHOST_DOMAIN_NAME/htdocs
|
||||
|
||||
npm i -g ghost-cli
|
||||
/usr/local/bin/ghost update
|
||||
/usr/local/bin/ghost update &
|
||||
sleep 200
|
||||
ghost_bust
|
||||
|
||||
ghost_replace_services
|
||||
|
|
|
@ -224,8 +224,10 @@ function remove_scuttlebot {
|
|||
function git_ssb_script {
|
||||
if [[ "$1" == "mesh" ]]; then
|
||||
git_ssb_script_name=$rootdir/usr/bin/git-ssb-create
|
||||
git_ssb_daemon_filename=$rootdir/etc/systemd/system/git_ssb.service
|
||||
else
|
||||
git_ssb_script_name=/usr/bin/git-ssb-create
|
||||
git_ssb_daemon_filename=/etc/systemd/system/git_ssb.service
|
||||
fi
|
||||
echo '#!/bin/bash' > $git_ssb_script_name
|
||||
echo 'reponame="$1"' >> $git_ssb_script_name
|
||||
|
@ -239,6 +241,24 @@ function git_ssb_script {
|
|||
echo 'fi' >> $git_ssb_script_name
|
||||
echo 'exit 0' >> $git_ssb_script_name
|
||||
chmod +x $git_ssb_script_name
|
||||
|
||||
echo '[Unit]' > $git_ssb_daemon_filename
|
||||
echo 'Description=Git SSB (SSB git web interface)' >> $git_ssb_daemon_filename
|
||||
echo 'After=syslog.target' >> $git_ssb_daemon_filename
|
||||
echo 'After=network.target' >> $git_ssb_daemon_filename
|
||||
echo 'After=scuttlebot.target' >> $git_ssb_daemon_filename
|
||||
echo '' >> $git_ssb_daemon_filename
|
||||
echo '[Service]' >> $git_ssb_daemon_filename
|
||||
echo 'Type=simple' >> $git_ssb_daemon_filename
|
||||
echo 'User=scuttlebot' >> $git_ssb_daemon_filename
|
||||
echo 'Group=scuttlebot' >> $git_ssb_daemon_filename
|
||||
echo "WorkingDirectory=/etc/scuttlebot" >> $git_ssb_daemon_filename
|
||||
echo "ExecStart=/usr/bin/git ssb web --public localhost:$GIT_SSB_PORT" >> $git_ssb_daemon_filename
|
||||
echo 'Restart=always' >> $git_ssb_daemon_filename
|
||||
echo 'Environment="USER=scuttlebot"' >> $git_ssb_daemon_filename
|
||||
echo '' >> $git_ssb_daemon_filename
|
||||
echo '[Install]' >> $git_ssb_daemon_filename
|
||||
echo 'WantedBy=multi-user.target' >> $git_ssb_daemon_filename
|
||||
}
|
||||
|
||||
function scuttlebot_git_setup {
|
||||
|
@ -336,7 +356,9 @@ function scuttlebot_git_setup {
|
|||
echo ' }' >> $git_ssb_nginx_site
|
||||
echo '}' >> $git_ssb_nginx_site
|
||||
fi
|
||||
if [[ "$1" != "mesh" ]]; then
|
||||
nginx_ensite git_ssb
|
||||
fi
|
||||
}
|
||||
|
||||
function mesh_install_scuttlebot {
|
||||
|
@ -425,24 +447,6 @@ function install_scuttlebot {
|
|||
echo '[Install]' >> /etc/systemd/system/scuttlebot.service
|
||||
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/scuttlebot.service
|
||||
|
||||
echo '[Unit]' > /etc/systemd/system/git_ssb.service
|
||||
echo 'Description=Git SSB (SSB git web interface)' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'After=syslog.target' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'After=network.target' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'After=scuttlebot.target' >> /etc/systemd/system/git_ssb.service
|
||||
echo '' >> /etc/systemd/system/git_ssb.service
|
||||
echo '[Service]' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'Type=simple' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'User=scuttlebot' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'Group=scuttlebot' >> /etc/systemd/system/git_ssb.service
|
||||
echo "WorkingDirectory=/etc/scuttlebot" >> /etc/systemd/system/git_ssb.service
|
||||
echo "ExecStart=/usr/bin/git ssb web --public localhost:$GIT_SSB_PORT" >> /etc/systemd/system/git_ssb.service
|
||||
echo 'Restart=always' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'Environment="USER=scuttlebot"' >> /etc/systemd/system/git_ssb.service
|
||||
echo '' >> /etc/systemd/system/git_ssb.service
|
||||
echo '[Install]' >> /etc/systemd/system/git_ssb.service
|
||||
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/git_ssb.service
|
||||
|
||||
chown -R scuttlebot:scuttlebot /etc/scuttlebot
|
||||
|
||||
# files gw_name myhostname mdns4_minimal [NOTFOUND=return] dns
|
||||
|
@ -452,9 +456,6 @@ function install_scuttlebot {
|
|||
systemctl enable scuttlebot.service
|
||||
systemctl daemon-reload
|
||||
systemctl start scuttlebot.service
|
||||
systemctl enable git_ssb.service
|
||||
systemctl daemon-reload
|
||||
systemctl start git_ssb.service
|
||||
|
||||
sleep 3
|
||||
|
||||
|
@ -492,6 +493,10 @@ function install_scuttlebot {
|
|||
scuttlebot_git_setup
|
||||
git_ssb_script
|
||||
|
||||
systemctl enable git_ssb.service
|
||||
systemctl daemon-reload
|
||||
systemctl start git_ssb.service
|
||||
|
||||
function_check create_site_certificate
|
||||
create_site_certificate ${SCUTTLEBOT_DOMAIN_NAME} 'yes'
|
||||
|
||||
|
|
|
@ -772,6 +772,13 @@ function create_searx_config {
|
|||
echo ' tr : Türkçe (Turkish)' >> $settings_file
|
||||
echo ' uk : українська мова (Ukrainian)' >> $settings_file
|
||||
echo ' zh : 中文 (Chinese)' >> $settings_file
|
||||
echo '' >> $settings_file
|
||||
echo 'doi_resolvers :' >> $settings_file
|
||||
echo " oadoi.org : 'https://oadoi.org/'" >> $settings_file
|
||||
echo " doi.org : 'https://doi.org/'" >> $settings_file
|
||||
echo " doai.io : 'http://doai.io/'" >> $settings_file
|
||||
echo '' >> $settings_file
|
||||
echo "default_doi_resolver : 'oadoi.org'" >> $settings_file
|
||||
}
|
||||
|
||||
function upgrade_searx {
|
||||
|
|
|
@ -384,6 +384,7 @@ function upgrade_xmpp {
|
|||
fi
|
||||
function_check update_prosody_modules
|
||||
update_prosody_modules
|
||||
xmpp_onion_addresses /etc/prosody/prosody.cfg.lua
|
||||
|
||||
curr_prosody_filename=$(cat $COMPLETION_FILE | grep "prosody_filename" | awk -F ':' '{print $2}')
|
||||
if [[ "$curr_prosody_filename" != "$prosody_filename" ]]; then
|
||||
|
|
|
@ -588,8 +588,7 @@ cd /etc/patchwork
|
|||
npm install --arch=$NPM_ARCH --build-from-source
|
||||
npm install --arch=$NPM_ARCH --save-dev electron-rebuild
|
||||
./node_modules/.bin/electron-rebuild
|
||||
npm install --arch=$NPM_ARCH -g git-ssb --registry=http://localhost:8043/
|
||||
#npm install --arch=$NPM_ARCH git-ssb
|
||||
npm install --arch=$NPM_ARCH git-ssb
|
||||
EOF
|
||||
chroot "$rootdir" /bin/chmod +x /usr/bin/install_patchwork
|
||||
chroot "$rootdir" /usr/bin/install_patchwork
|
||||
|
@ -699,11 +698,11 @@ initialise_mesh() {
|
|||
#install_tahoelafs
|
||||
#install_librevault
|
||||
install_patchwork
|
||||
install_web_server
|
||||
mesh_install_scuttlebot
|
||||
#install_ferment
|
||||
install_ipfs
|
||||
install_tox
|
||||
install_web_server
|
||||
install_pelican
|
||||
mesh_install_cryptpad
|
||||
#mesh_install_peertube
|
||||
|
|
|
@ -872,6 +872,7 @@ function mesh_amnesic {
|
|||
function mesh_restart_daemons {
|
||||
systemctl restart avahi-daemon
|
||||
systemctl restart tox-bootstrapd
|
||||
systemctl restart nginx
|
||||
echo $'Daemons restarted' >> $INSTALL_LOG
|
||||
}
|
||||
|
||||
|
@ -1288,7 +1289,7 @@ function mesh_setup_vpn {
|
|||
function initialise_scuttlebot_pub {
|
||||
chown -R scuttlebot:scuttlebot /etc/scuttlebot
|
||||
|
||||
systemctl enable scuttlebot.service
|
||||
systemctl enable git_ssb.service
|
||||
systemctl daemon-reload
|
||||
systemctl start scuttlebot.service
|
||||
|
||||
|
@ -1301,7 +1302,7 @@ function initialise_scuttlebot_pub {
|
|||
fi
|
||||
|
||||
echo '{' > /etc/scuttlebot/.ssb/config
|
||||
echo " \"host\": \"${HOSTNAME}\"," >> /etc/scuttlebot/.ssb/config
|
||||
echo " \"host\": \"$P{PEER_ID}.local\"," >> /etc/scuttlebot/.ssb/config
|
||||
echo " \"port\": ${SCUTTLEBOT_PORT}," >> /etc/scuttlebot/.ssb/config
|
||||
echo ' "allowPrivate": true,' >> /etc/scuttlebot/.ssb/config
|
||||
echo ' "timeout": 30000,' >> /etc/scuttlebot/.ssb/config
|
||||
|
@ -1322,6 +1323,15 @@ function initialise_scuttlebot_pub {
|
|||
chown scuttlebot:scuttlebot /etc/scuttlebot/.ssb/config
|
||||
systemctl restart scuttlebot.service
|
||||
echo "scuttlebot pub started" >> /var/log/${PROJECT_NAME}.log
|
||||
|
||||
# git ssb site
|
||||
if [ -f /etc/nginx/sites-available/git_ssb ]; then
|
||||
sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
|
||||
ln -s /etc/nginx/sites-available/git_ssb /etc/nginx/sites-enabled/git_ssb
|
||||
systemctl enable git_ssb.service
|
||||
systemctl start git_ssb.service
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
# whether to reset the identity
|
||||
|
|
|
@ -483,7 +483,11 @@ function start {
|
|||
sed -i "s|\"host\": .*|\"host\": \"$(get_ipv4_wlan)\",|g" /etc/scuttlebot/.ssb/config
|
||||
systemctl restart scuttlebot
|
||||
else
|
||||
if [ ! -f /etc/nginx/sites-available/git_ssb ]; then
|
||||
systemctl stop scuttlebot
|
||||
else
|
||||
systemctl restart scuttlebot
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -503,6 +507,11 @@ function start {
|
|||
systemctl disable tor
|
||||
fi
|
||||
|
||||
sed -i "s|\"host\":.*|\"host\": \"${HOSTNAME}.local\",|g" /etc/scuttlebot/.ssb/config
|
||||
sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
|
||||
systemctl restart scuttlebot
|
||||
systemctl restart nginx
|
||||
|
||||
verify
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue