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
1d994359
Unverified
Commit
1d994359
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
ipfs mesh implementation
parent
2f18dec9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/freedombone-app-ipfs
+67
-0
67 additions, 0 deletions
src/freedombone-app-ipfs
src/freedombone-image-customise
+1
-0
1 addition, 0 deletions
src/freedombone-image-customise
src/freedombone-image-mesh
+31
-0
31 additions, 0 deletions
src/freedombone-image-mesh
with
99 additions
and
0 deletions
src/freedombone-app-ipfs
+
67
−
0
View file @
1d994359
...
...
@@ -201,7 +201,74 @@ function configure_firewall_for_ipfs {
echo
'configure_firewall_for_ipfs'
>>
$COMPLETION_FILE
}
function
mesh_install_ipfs_js
{
if
grep
-Fxq
"mesh_install_ipfs_js"
$COMPLETION_FILE
;
then
return
fi
chroot
${
rootdir
}
apt-get
-y
install
npm
chroot
${
rootdir
}
apt-get
-y
install
libpam0g-dev fuse
chroot
${
rootdir
}
npm cache clean
-f
chroot
${
rootdir
}
npm
install
-g
n
chroot
${
rootdir
}
n
${
IPFS_NODE_VERSION
}
chroot
${
rootdir
}
npm
install
ronin@
${
IPFS_JS_RONIN_VERSION
}
--global
chroot
${
rootdir
}
npm
install
ipfs@
${
IPFS_JS_VERSION
}
--global
IPFS_PATH
=
/usr/local/bin
if
[
!
-f
${
rootdir
}
$IPFS_PATH
/jsipfs
]
;
then
exit
637292
fi
# directories to mount to
if
[
!
-d
${
rootdir
}
/ipfs
]
;
then
chroot
${
rootdir
}
mkdir
/ipfs
chroot
${
rootdir
}
mkdir
/ipns
chroot
${
rootdir
}
chown
$MY_USERNAME
:
$MY_USERNAME
/ipfs
chroot
${
rootdir
}
chown
$MY_USERNAME
:
$MY_USERNAME
/ipns
fi
if
[
-f
${
rootdir
}
/etc/fuse.conf
]
;
then
chroot
${
rootdir
}
chown
$MY_USERNAME
:
$MY_USERNAME
/etc/fuse.conf
fi
if
[
-f
${
rootdir
}
/dev/fuse
]
;
then
chroot
${
rootdir
}
chown
$MY_USERNAME
:
$MY_USERNAME
/dev/fuse
fi
IPFS_DAEMON_NAME
=
ipfs
IPFS_DAEMON_FILE
=
${
rootdir
}
/etc/systemd/system/
${
IPFS_DAEMON_NAME
}
.service
echo
'[Unit]'
>
$IPFS_DAEMON_FILE
echo
'Description=IPFS javascript daemon'
>>
$IPFS_DAEMON_FILE
echo
'After=syslog.target'
>>
$IPFS_DAEMON_FILE
echo
'After=network.target'
>>
$IPFS_DAEMON_FILE
echo
''
>>
$IPFS_DAEMON_FILE
echo
'[Service]'
>>
$IPFS_DAEMON_FILE
echo
'Type=simple'
>>
$IPFS_DAEMON_FILE
echo
"User=
$MY_USERNAME
"
>>
$IPFS_DAEMON_FILE
echo
"Group=
$MY_USERNAME
"
>>
$IPFS_DAEMON_FILE
echo
"WorkingDirectory=/home/
$MY_USERNAME
"
>>
$IPFS_DAEMON_FILE
echo
"ExecStart=
${
IPFS_PATH
}
/jsipfs daemon --mount"
>>
$IPFS_DAEMON_FILE
echo
'Restart=on-failure'
>>
$IPFS_DAEMON_FILE
echo
"Environment=
\"
USER=
$MY_USERNAME
\"
\"
HOME=/home/
$MY_USERNAME
\"
"
>>
$IPFS_DAEMON_FILE
echo
''
>>
$IPFS_DAEMON_FILE
echo
'[Install]'
>>
$IPFS_DAEMON_FILE
echo
'WantedBy=multi-user.target'
>>
$IPFS_DAEMON_FILE
chroot
${
rootdir
}
systemctl
enable
${
IPFS_DAEMON_NAME
}
chroot
${
rootdir
}
systemctl daemon-reload
function_check create_avahi_service
create_avahi_service ipfs
"ipfs"
udp
$IPFS_PORT
"IPFS_PEER_ID"
echo
'mesh install_ipfs_js'
>>
$COMPLETION_FILE
}
function
install_ipfs_js
{
if
[[
$SYSTEM_TYPE
==
"
$VARIANT_MESH
"
]]
;
then
mesh_install_ipfs_js
return
fi
if
grep
-Fxq
"install_ipfs_js"
$COMPLETION_FILE
;
then
return
fi
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-image-customise
+
1
−
0
View file @
1d994359
...
...
@@ -550,6 +550,7 @@ initialise_mesh() {
install_tomb
install_tox
install_web_server
install_ipfs
if
[
$ENABLE_ZERONET
]
;
then
install_zeronet
fi
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-image-mesh
+
31
−
0
View file @
1d994359
...
...
@@ -723,6 +723,36 @@ function setup_amnesic_data {
fi
}
function
setup_ipfs
{
IPFS_PATH
=
/usr/local/bin
IPFS_KEY_LENGTH
=
2048
su
-c
"
$IPFS_PATH
/jsipfs init -b
$IPFS_KEY_LENGTH
"
-
$MY_USERNAME
if
[
!
-d
${
rootdir
}
/home/
$MY_USERNAME
/.ipfs
]
;
then
echo
"IPFS could not be initialised for user
$MY_USERNAME
"
>>
$INSTALL_LOG
exit
7358
fi
TEMP_IPFS_ID
=
/tmp/ipfsid
su
-c
"echo
$(
$IPFS_PATH
/jsipfs
id
|
grep
'\"ID\":'
|
awk
-F
'\"'
'{print $4}'
)
>
$TEMP_IPFS_ID
"
-
$MY_USERNAME
if
[
!
-f
$TEMP_IPFS_ID
]
;
then
echo
'No IPFS identity was created'
>>
$INSTALL_LOG
exit
37895
fi
IPFS_PEER_ID
=
$(
cat
$TEMP_IPFS_ID
)
if
[
${#
IPFS_PEER_ID
}
-lt
10
]
;
then
echo
'Invalid IPFS peer ID'
>>
$INSTALL_LOG
echo
"
$IPFS_PEER_ID
"
>>
$INSTALL_LOG
exit
74782
fi
# TODO in avahi service for ipfs replace IPFS_PEER_ID
rm
$TEMP_IPFS_ID
echo
'IPFS installed with ID $IPFS_PEER_ID'
>>
$INSTALL_LOG
}
# whether to reset the identity
set_new_identity
=
if
[
$2
]
;
then
...
...
@@ -778,6 +808,7 @@ if [ -f $MESH_INSTALL_SETUP ]; then
fi
configure_toxcore
create_tox_user
setup_ipfs
mesh_amnesic
if
[
!
-f
$MESH_AMNESIC
]
;
then
...
...
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