Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nayuos-ebuilds
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Lorenzo Martinico
nayuos-ebuilds
Commits
37b63740
Commit
37b63740
authored
Nov 19, 2015
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quotes!
parent
408e181b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
net-misc/re6stnet/files/grdn-cfg
net-misc/re6stnet/files/grdn-cfg
+9
-9
net-misc/re6stnet/files/grdn-run
net-misc/re6stnet/files/grdn-run
+15
-15
No files found.
net-misc/re6stnet/files/grdn-cfg
View file @
37b63740
...
@@ -6,25 +6,25 @@ configdir="/home/chronos/user/.re6stconf"
...
@@ -6,25 +6,25 @@ configdir="/home/chronos/user/.re6stconf"
configfile
=
"
${
configdir
}
/re6stnet.conf"
configfile
=
"
${
configdir
}
/re6stnet.conf"
options
=()
options
=()
install
-d
${
configdir
}
install
-d
"
${
configdir
}
"
echo
"After having run this script, you will be able to join the Grandenet network, based on re6st, a resilient overlay mesh network providing IPv6."
echo
"After having run this script, you will be able to join the Grandenet network, based on re6st, a resilient overlay mesh network providing IPv6."
read
-p
"token (you can get one on http://www.grandenet.cn): "
token
read
-p
"token (you can get one on http://www.grandenet.cn): "
token
read
-p
"registry [http://re6stnet.grandenet.cn]: "
registry
read
-p
"registry [http://re6stnet.grandenet.cn]: "
registry
if
[
"
$
registry
"
==
""
]
;
then
if
[
"
$
{
registry
}
"
==
""
]
;
then
registry
=
"http://re6stnet.grandenet.cn"
registry
=
"http://re6stnet.grandenet.cn"
fi
fi
read
-p
"set re6st route as default [Y/n]? "
default
read
-p
"set re6st route as default [Y/n]? "
default
if
[
"
$
default
"
==
"y"
-o
"
$default
"
==
"Y"
-o
"
$default
"
==
""
]
;
then
if
[
"
$
{
default
}
"
==
"y"
-o
"
${
default
}
"
==
"Y"
-o
"
${
default
}
"
==
""
]
;
then
options+
=(
'default'
)
options+
=(
'default'
)
fi
fi
read
-p
"save configuration on an external device [Y/n]? "
save
read
-p
"save configuration on an external device [Y/n]? "
save
if
[
"
$save
"
==
"y"
-o
"
$save
"
==
"Y"
-o
"
$save
"
==
""
]
;
then
if
[
"
$save
"
==
"y"
-o
"
$save
"
==
"Y"
-o
"
$save
"
==
""
]
;
then
save
=
1
save
=
1
if
[[
$(
ls
-d
${
mountpoint
}
/
*
)
]]
;
then
if
[[
$(
ls
-d
"
${
mountpoint
}
"
/
*
)
]]
;
then
echo
"Detected external partitions:"
echo
"Detected external partitions:"
for
mnt
in
/media/removable/
*
;
do
for
mnt
in
/media/removable/
*
;
do
echo
" *
$mnt
"
echo
" *
$mnt
"
...
@@ -40,11 +40,11 @@ else
...
@@ -40,11 +40,11 @@ else
echo
"Configuration will be placed in
${
configfile
}
, please do manually backup later or you could lose your access."
echo
"Configuration will be placed in
${
configfile
}
, please do manually backup later or you could lose your access."
fi
fi
#re6st-conf --registry "${registry}" --token "${token}" --dir
${configdir}
#re6st-conf --registry "${registry}" --token "${token}" --dir
"${configdir}"
printf
'%s\n'
"
${
options
[@]
}
"
>>
${
configfile
}
printf
'%s\n'
"
${
options
[@]
}
"
>>
"
${
configfile
}
"
echo
"
""
echo
"
*filter
*filter
:FORWARD ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT DROP [0:0]
:OUTPUT DROP [0:0]
...
@@ -55,12 +55,12 @@ echo """
...
@@ -55,12 +55,12 @@ echo """
-A OUTPUT -p udp -m udp --dport 6696 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 6696 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 326 -j ACCEPT
-A OUTPUT -p udp -m udp --dport 326 -j ACCEPT
COMMIT
COMMIT
"
""
>
${
configdir
}
/ip6tables.conf
"
>
"
${
configdir
}
/ip6tables.conf"
if
[
$save
-a
$place
]
;
then
if
[
$save
-a
$place
]
;
then
sudo install
-d
"
${
place
}
"
sudo install
-d
"
${
place
}
"
for
file
in
"
${
configdir
}
"
/
*
;
do
for
file
in
"
${
configdir
}
"
/
*
;
do
install
${
file
}
"
${
place
}
"
install
"
${
file
}
"
"
${
place
}
"
done
done
fi
fi
...
...
net-misc/re6stnet/files/grdn-run
View file @
37b63740
...
@@ -20,13 +20,13 @@ if [[ $(pgrep re6stnet) ]] ; then
...
@@ -20,13 +20,13 @@ if [[ $(pgrep re6stnet) ]] ; then
fi
fi
# get configuration
# get configuration
if
[
-r
${
configfile
}
-a
-r
${
configdir
}
/cert.crt
-a
-r
${
configdir
}
/cert.key
-a
-r
${
configdir
}
/ca.crt
]
;
then
if
[
-r
"
${
configfile
}
"
-a
-r
"
${
configdir
}
/cert.crt"
-a
-r
"
${
configdir
}
/cert.key"
-a
-r
"
${
configdir
}
/ca.crt"
]
;
then
echo
"configuration was found in
${
configdir
}
"
echo
"configuration was found in
${
configdir
}
"
else
else
echo
"no configuration was found in
${
configdir
}
, looking for it elsewhere..."
echo
"no configuration was found in
${
configdir
}
, looking for it elsewhere..."
path
=
""
path
=
""
if
[[
$(
find
${
mountpoint
}
-type
d |
grep
re6stconf
)
]]
;
then
if
[[
$(
find
"
${
mountpoint
}
"
-type
d |
grep
re6stconf
)
]]
;
then
tempath
=
$(
find
${
mountpoint
}
-type
d |
grep
-m
1 re6stconf
)
tempath
=
$(
find
"
${
mountpoint
}
"
-type
d |
grep
-m
1 re6stconf
)
read
-p
"Use configuration directory found at:
${
tempath
}
[Y/n]? "
confirm
read
-p
"Use configuration directory found at:
${
tempath
}
[Y/n]? "
confirm
if
[
"
${
confirm
}
"
==
"y"
-o
"
${
confirm
}
"
==
"Y"
-o
"
${
confirm
}
"
==
""
]
;
then
if
[
"
${
confirm
}
"
==
"y"
-o
"
${
confirm
}
"
==
"Y"
-o
"
${
confirm
}
"
==
""
]
;
then
path
=
$tempath
path
=
$tempath
...
@@ -46,10 +46,10 @@ else
...
@@ -46,10 +46,10 @@ else
echo
"Invalid path
${
path
}
, you can generate a valid configuration using grdn-cfg command. Exiting."
echo
"Invalid path
${
path
}
, you can generate a valid configuration using grdn-cfg command. Exiting."
exit
1
exit
1
fi
fi
if
[
-r
${
path
}
/re6stnet.conf
-a
-r
${
path
}
/cert.crt
-a
-r
${
path
}
/cert.key
-a
-r
${
path
}
/ca.crt
]
;
then
if
[
-r
"
${
path
}
/re6stnet.conf"
-a
-r
"
${
path
}
/cert.crt"
-a
-r
"
${
path
}
/cert.key"
-a
-r
"
${
path
}
/ca.crt"
]
;
then
install
-d
${
configdir
}
install
-d
"
${
configdir
}
"
for
file
in
"
${
path
}
"
;
do
for
file
in
"
${
path
}
"
;
do
install
-m
600
"
${
path
}
"
/
*
${
configdir
}
install
-m
600
"
${
file
}
"
"
${
configdir
}
"
done
done
else
else
echo
"Missing some configuration files in
${
path
}
, you can generate a valid configuration using grdn-cfg command. Exiting."
echo
"Missing some configuration files in
${
path
}
, you can generate a valid configuration using grdn-cfg command. Exiting."
...
@@ -60,15 +60,15 @@ fi
...
@@ -60,15 +60,15 @@ fi
# setup
# setup
# saving firewall configuration
# saving firewall configuration
ip6tables-save
>
${
configdir
}
/ip6tables.save
ip6tables-save
>
"
${
configdir
}
/ip6tables.save"
# clean before exiting
# clean before exiting
cleanup
()
{
cleanup
()
{
printf
"
\n
Cleaning up and exiting...
\n
"
printf
"
\n
Cleaning up and exiting...
\n
"
if
[
-r
${
configdir
}
/ip6tables.save
]
;
then
if
[
-r
"
${
configdir
}
/ip6tables.save"
]
;
then
echo
"Removing changes in ip6tables rules"
echo
"Removing changes in ip6tables rules"
ip6tables-restore <
${
configdir
}
/ip6tables.save
ip6tables-restore <
"
${
configdir
}
/ip6tables.save"
rm
${
configdir
}
/ip6tables.save
rm
"
${
configdir
}
/ip6tables.save"
fi
fi
echo
""
echo
""
exit
0
exit
0
...
@@ -77,8 +77,8 @@ cleanup() {
...
@@ -77,8 +77,8 @@ cleanup() {
trap
cleanup SIGHUP SIGINT SIGTERM
trap
cleanup SIGHUP SIGINT SIGTERM
# firewall configuration
# firewall configuration
if
[
-r
"
${
configdir
}
"
/ip6tables.conf
]
;
then
if
[
-r
"
${
configdir
}
/ip6tables.conf"
]
;
then
ip6tables-restore <
"
${
configdir
}
"
/ip6tables.conf
ip6tables-restore <
"
${
configdir
}
/ip6tables.conf"
else
else
# accept ports needed for re6stnet
# accept ports needed for re6stnet
ip6tables
-P
FORWARD ACCEPT
ip6tables
-P
FORWARD ACCEPT
...
@@ -113,7 +113,7 @@ read -p "Should the interface accept router advertisement via IPv6 [y/N]? " acce
...
@@ -113,7 +113,7 @@ read -p "Should the interface accept router advertisement via IPv6 [y/N]? " acce
interface_names
=
"
$(
ip
-o
link
show |
awk
-F
': '
'{print $2}'
)
"
interface_names
=
"
$(
ip
-o
link
show |
awk
-F
': '
'{print $2}'
)
"
interface
=
"
$(
ip
-o
link
show |
grep
'state UP'
|
awk
-F
': '
'{print $2}'
||
echo
${
interface_names
}
|
grep
0
||
echo
${
interface_names
}
|
grep
1
)
"
interface
=
"
$(
ip
-o
link
show |
grep
'state UP'
|
awk
-F
': '
'{print $2}'
||
echo
${
interface_names
}
|
grep
0
||
echo
${
interface_names
}
|
grep
1
)
"
read
-p
"Is
$interface
the name of the interface that is used to access the Internet (via IPv4) [Y/n]? "
confirm
read
-p
"Is
'
${
interface
}
'
the name of the interface that is used to access the Internet (via IPv4) [Y/n]? "
confirm
if
[
"
$confirm
"
!=
"y"
-a
"
$confirm
"
!=
"Y"
-a
"
$confirm
"
!=
""
]
;
then
if
[
"
$confirm
"
!=
"y"
-a
"
$confirm
"
!=
"Y"
-a
"
$confirm
"
!=
""
]
;
then
printf
"running interfaces found:
\n
${
interface_names
}
\n
"
printf
"running interfaces found:
\n
${
interface_names
}
\n
"
...
@@ -133,7 +133,7 @@ for i in {0..2} ; do
...
@@ -133,7 +133,7 @@ for i in {0..2} ; do
done
done
echo
""
echo
""
while
[[
$(
grep
default
${
configfile
}
)
&&
$(
ip
-6
r |
grep
default
)
]]
;
do
while
[[
$(
grep
default
"
${
configfile
}
"
)
&&
$(
ip
-6
r |
grep
default
)
]]
;
do
printf
"Default route was found for interface '
${
interface
}
':
\n
$(
ip
-6
r |
grep
default
)
\n
whereas option 'default' is in
${
configfile
}
.
\n
"
printf
"Default route was found for interface '
${
interface
}
':
\n
$(
ip
-6
r |
grep
default
)
\n
whereas option 'default' is in
${
configfile
}
.
\n
"
read
-p
"Use ip route (i) or try restarting shill (s) [I/s]: "
choice
read
-p
"Use ip route (i) or try restarting shill (s) [I/s]: "
choice
if
[
"
$choice
"
!=
"s"
-a
"
$confirm
"
!=
"S"
]
;
then
if
[
"
$choice
"
!=
"s"
-a
"
$confirm
"
!=
"S"
]
;
then
...
@@ -146,5 +146,5 @@ while [[ $( grep default ${configfile} ) && $( ip -6 r | grep default ) ]] ; do
...
@@ -146,5 +146,5 @@ while [[ $( grep default ${configfile} ) && $( ip -6 r | grep default ) ]] ; do
done
done
# join re6st network
# join re6st network
cd
${
configdir
}
cd
"
${
configdir
}
"
re6stnet @re6stnet.conf
re6stnet @re6stnet.conf
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment