Script to create git-ssb repos
This commit is contained in:
parent
92a26a388c
commit
42f0a4befc
|
@ -200,8 +200,11 @@ function remove_scuttlebot {
|
|||
rm /etc/nginx/sites-available/${SCUTTLEBOT_DOMAIN_NAME}
|
||||
fi
|
||||
|
||||
systemctl stop git_ssb
|
||||
systemctl stop scuttlebot
|
||||
systemctl disable git_ssb
|
||||
systemctl disable scuttlebot
|
||||
rm /etc/systemd/system/git_ssb.service
|
||||
rm /etc/systemd/system/scuttlebot.service
|
||||
systemctl daemon-reload
|
||||
|
||||
|
@ -210,13 +213,44 @@ function remove_scuttlebot {
|
|||
if [ -d /etc/scuttlebot ]; then
|
||||
rm -rf /etc/scuttlebot
|
||||
fi
|
||||
if [ -f /usr/bin/git-ssb-create ]; then
|
||||
rm /usr/bin/git-ssb-create
|
||||
fi
|
||||
|
||||
remove_completion_param install_scuttlebot
|
||||
sed -i '/scuttlebot /d' $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function git_ssb_script {
|
||||
if [[ "$1" == "mesh" ]]; then
|
||||
git_ssb_script_name=$rootdir/usr/bin/git-ssb-create
|
||||
else
|
||||
git_ssb_script_name=/usr/bin/git-ssb-create
|
||||
fi
|
||||
echo '#!/bin/bash' > $git_ssb_script_name
|
||||
echo 'reponame="$1"' >> $git_ssb_script_name
|
||||
echo '' >> $git_ssb_script_name
|
||||
echo 'if [[ "$reponame" != "" ]]; then' >> $git_ssb_script_name
|
||||
echo ' mkdir $reponame' >> $git_ssb_script_name
|
||||
echo ' cd $reponame' >> $git_ssb_script_name
|
||||
echo ' git ssb create ssb $reponame' >> $git_ssb_script_name
|
||||
echo ' git push --tags ssb master' >> $git_ssb_script_name
|
||||
echo 'fi' >> $git_ssb_script_name
|
||||
echo 'exit 0' >> $git_ssb_script_name
|
||||
chmod +x $git_ssb_script_name
|
||||
}
|
||||
|
||||
function scuttlebot_git_setup {
|
||||
if [[ "$1" == "mesh" ]]; then
|
||||
if [ ! -d $rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight ]; then
|
||||
mkdir $rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight
|
||||
fi
|
||||
if [ ! -f $rootdir/usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css ]; then
|
||||
echo $'Could not find foundation.css'
|
||||
exit 347687245
|
||||
fi
|
||||
cp $rootdir/usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css $rootdir/usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css
|
||||
|
||||
git_ssb_nginx_site=$rootdir/etc/nginx/sites-available/git_ssb
|
||||
echo 'server {' > $git_ssb_nginx_site
|
||||
echo " listen $NGINX_GIT_SSB_PORT default_server;" >> $git_ssb_nginx_site
|
||||
|
@ -232,6 +266,16 @@ function scuttlebot_git_setup {
|
|||
if [ ! $SCUTTLEBOT_DOMAIN_NAME ]; then
|
||||
exit 7357225
|
||||
fi
|
||||
|
||||
if [ ! -d /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight ]; then
|
||||
mkdir /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight
|
||||
fi
|
||||
if [ ! -f /usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css ]; then
|
||||
echo $'Could not find foundation.css'
|
||||
exit 347687245
|
||||
fi
|
||||
cp /usr/local/lib/node_modules/git-ssb/node_modules/highlight.js/styles/foundation.css /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web/highlight/foundation.css
|
||||
|
||||
git_ssb_nginx_site=/etc/nginx/sites-available/${SCUTTLEBOT_DOMAIN_NAME}
|
||||
function_check nginx_http_redirect
|
||||
nginx_http_redirect $SCUTTLEBOT_DOMAIN_NAME "index index.html"
|
||||
|
@ -251,6 +295,8 @@ function scuttlebot_git_setup {
|
|||
nginx_disable_sniffing $SCUTTLEBOT_DOMAIN_NAME
|
||||
fi
|
||||
|
||||
echo '' >> $git_ssb_nginx_site
|
||||
echo ' root /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web;' >> $git_ssb_nginx_site
|
||||
echo '' >> $git_ssb_nginx_site
|
||||
echo ' location = / {' >> $git_ssb_nginx_site
|
||||
echo " proxy_pass http://localhost:${GIT_SSB_PORT};" >> $git_ssb_nginx_site
|
||||
|
@ -276,6 +322,8 @@ function scuttlebot_git_setup {
|
|||
echo ' add_header X-Content-Type-Options nosniff;' >> $git_ssb_nginx_site
|
||||
echo ' add_header X-Frame-Options SAMEORIGIN;' >> $git_ssb_nginx_site
|
||||
echo '' >> $git_ssb_nginx_site
|
||||
echo ' root /usr/local/lib/node_modules/git-ssb/node_modules/git-ssb-web;' >> $git_ssb_nginx_site
|
||||
echo '' >> $git_ssb_nginx_site
|
||||
echo ' location = / {' >> $git_ssb_nginx_site
|
||||
echo " proxy_pass http://localhost:${GIT_SSB_PORT};" >> $git_ssb_nginx_site
|
||||
echo ' proxy_set_header X-Real-IP $remote_addr;' >> $git_ssb_nginx_site
|
||||
|
@ -336,6 +384,7 @@ EOF
|
|||
echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/scuttlebot.service
|
||||
|
||||
scuttlebot_git_setup mesh
|
||||
git_ssb_script mesh
|
||||
}
|
||||
|
||||
function install_scuttlebot {
|
||||
|
@ -375,6 +424,24 @@ 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
|
||||
|
@ -384,6 +451,9 @@ 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
|
||||
|
||||
|
@ -419,6 +489,7 @@ function install_scuttlebot {
|
|||
|
||||
SCUTTLEBOT_ONION_HOSTNAME=$(add_onion_service scuttlebot 80 ${SCUTTLEBOT_ONION_PORT})
|
||||
scuttlebot_git_setup
|
||||
git_ssb_script
|
||||
|
||||
function_check create_site_certificate
|
||||
create_site_certificate ${SCUTTLEBOT_DOMAIN_NAME} 'yes'
|
||||
|
|
Loading…
Reference in New Issue