Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
42f0a4be
Commit
42f0a4be
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Script to create git-ssb repos
parent
92a26a38
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-app-scuttlebot
+71
-0
71 additions, 0 deletions
src/freedombone-app-scuttlebot
with
71 additions
and
0 deletions
src/freedombone-app-scuttlebot
+
71
−
0
View file @
42f0a4be
...
...
@@ -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'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment