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
2f2b32e3
Commit
2f2b32e3
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Abstract tomb creation
parent
37d26d58
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-image-mesh
+36
-29
36 additions, 29 deletions
src/freedombone-image-mesh
with
36 additions
and
29 deletions
src/freedombone-image-mesh
+
36
−
29
View file @
2f2b32e3
...
...
@@ -54,6 +54,7 @@ MESH_AMNESIC=/root/.amnesic
# size of the tomb used to store qtox settings
TOMB_TOX_SIZE_MB
=
64
TOMB_ZERONET_SIZE_MB
=
64
function
create_ram_disk
{
ramdisk_size_mb
=
$1
...
...
@@ -580,46 +581,52 @@ function mesh_restart_daemons {
echo
$'Daemons restarted'
>>
$INSTALL_LOG
}
function
setup_amnesic_tox_data
{
if
[
!
-f
$MESH_AMNESIC
]
;
then
return
fi
if
[
!
-d
/mnt/ramdisk
]
;
then
return
fi
function
create_tomb
{
tomb_name
=
$1
tomb_size
=
$2
# close any existing open tomb
if
[
-f
/tmp/tox.tomb
]
;
then
tomb slam /tmp/tox.tomb
if
[
-f
/tmp/
${
tomb_name
}
.tomb
]
;
then
tomb slam /tmp/
${
tomb_name
}
.tomb
fi
# make a temporary password
tomb dig
-s
$
TOMB_TOX_SIZE_MB
/tmp/tox
.tomb
if
[
!
-f
/tmp/
tox
.tomb
]
;
then
echo
"WARNING:
T
omb did not install properly"
>>
/var/log/
${
PROJECT_NAME
}
.log
tomb dig
-s
$
{
tomb_size
}
/tmp/
${
tomb_name
}
.tomb
if
[
!
-f
/tmp/
${
tomb_name
}
.tomb
]
;
then
echo
"WARNING:
${
tomb_name
}
t
omb did not install properly"
>>
/var/log/
${
PROJECT_NAME
}
.log
tomb
>>
/var/log/
${
PROJECT_NAME
}
.log
fi
TOMB_T
OX
_PASSWORD
=
"
$(
openssl rand
-base64
32 |
cut
-c1-30
)
"
tomb forge /mnt/ramdisk/
tox
.tomb.key
--tomb-pwd
"
${
TOMB_T
OX
_PASSWORD
}
"
--unsafe
tomb lock /tmp/
tox
.tomb
-k
/mnt/ramdisk/
tox
.tomb.key
--tomb-pwd
"
${
TOMB_T
OX
_PASSWORD
}
"
--unsafe
tomb open /tmp/
tox
.tomb
-k
/mnt/ramdisk/
tox
.tomb.key
--tomb-pwd
"
${
TOMB_T
OX
_PASSWORD
}
"
--unsafe
TOMB_T
EMP
_PASSWORD
=
"
$(
openssl rand
-base64
32 |
cut
-c1-30
)
"
tomb forge /mnt/ramdisk/
${
tomb_name
}
.tomb.key
--tomb-pwd
"
${
TOMB_T
EMP
_PASSWORD
}
"
--unsafe
tomb lock /tmp/
${
tomb_name
}
.tomb
-k
/mnt/ramdisk/
${
tomb_name
}
.tomb.key
--tomb-pwd
"
${
TOMB_T
EMP
_PASSWORD
}
"
--unsafe
tomb open /tmp/
${
tomb_name
}
.tomb
-k
/mnt/ramdisk/
${
tomb_name
}
.tomb.key
--tomb-pwd
"
${
TOMB_T
EMP
_PASSWORD
}
"
--unsafe
# clear the temporary password
TOMB_T
OX
_PASSWORD
=
TOMB_T
EMP
_PASSWORD
=
if
[
-d
/media/
tox
]
;
then
if
[
!
-d
/home/
$MY_USERNAME
/.config
]
;
then
mkdir
-p
/home/
$MY_USERNAME
/.config
if
[
-d
/media/
${
tomb_name
}
]
;
then
if
[
!
-d
/home/
$
{
MY_USERNAME
}
/.config
]
;
then
mkdir
-p
/home/
$
{
MY_USERNAME
}
/.config
fi
if
[
-d
/home/
$MY_USERNAME
/.config/
tox
]
;
then
rm
-rf
/home/
$MY_USERNAME
/.config/
tox
if
[
-d
/home/
$
{
MY_USERNAME
}
/.config/
${
tomb_name
}
]
;
then
rm
-rf
/home/
$
{
MY_USERNAME
}
/.config/
${
tomb_name
}
fi
ln
-s
/media/
tox
/home/
$MY_USERNAME
/.config/
tox
chown
-R
$MY_USERNAME
:
$MY_USERNAME
/home/
$MY_USERNAME
/.config
chown
-R
$MY_USERNAME
:
$MY_USERNAME
/media/
tox
echo
"
Tox T
omb created"
>>
/var/log/
${
PROJECT_NAME
}
.log
ln
-s
/media/
${
tomb_name
}
/home/
$
{
MY_USERNAME
}
/.config/
${
tomb_name
}
chown
-R
$
{
MY_USERNAME
}
:
$
{
MY_USERNAME
}
/home/
$
{
MY_USERNAME
}
/.config
chown
-R
$
{
MY_USERNAME
}
:
$
{
MY_USERNAME
}
/media/
${
tomb_name
}
echo
"
${
tomb_name
}
t
omb created"
>>
/var/log/
${
PROJECT_NAME
}
.log
else
echo
"WARNING: Tox Tomb not found"
>>
/var/log/
${
PROJECT_NAME
}
.log
echo
"WARNING:
${
tomb_name
}
tomb not found"
>>
/var/log/
${
PROJECT_NAME
}
.log
fi
}
function
setup_amnesic_data
{
if
[
!
-f
$MESH_AMNESIC
]
;
then
return
fi
if
[
!
-d
/mnt/ramdisk
]
;
then
return
fi
create_tomb tox
$TOMB_TOX_SIZE_MB
}
# whether to reset the identity
...
...
@@ -667,7 +674,7 @@ if [ -f $MESH_INSTALL_SETUP ]; then
configure_zeronet_mail
configure_zeronet_forum
configure_zeronet_id
setup_amnesic_
tox_
data
setup_amnesic_data
configure_toxcore
configure_zeronet
disable_password_logins
...
...
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