Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
slapos.package
Commits
f9cb2f01
Commit
f9cb2f01
authored
May 04, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine script init-slapos-node.sh
parent
393a4a28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
12 deletions
+30
-12
windows/scripts/init-slapos-node.sh
windows/scripts/init-slapos-node.sh
+30
-12
No files found.
windows/scripts/init-slapos-node.sh
View file @
f9cb2f01
#! /bin/bash
#! /bin/bash
#
# It used to initialzie slapos node when the computer startup:
#
# 1. Start re6stnet,
#
# 2. Check whether IPv6 connection is availabe
#
# 3. Run slapformat to synchornize information with master
#
# 4. Start slapproxy, it will used by slapos desktop and node manager
#
# Get connection name by GUID name, for example
#
# $ guid2name {C8D7F065-AD35-4777-A768-122451282533}
#
function
guid2name
()
function
guid2name
()
{
{
if
[[
"
$1
"
==
""
]]
;
then
if
[[
"
$1
"
==
""
]]
;
then
echo
echo
else
else
netsh interface ipv6 show interface
level
=
verbose |
\
netsh interface ipv6 show interface
level
=
verbose |
\
grep
-B
1
"
{C8D7F065-AD35-4777-A768-122451282533}
"
|
\
grep
-B
1
"
$1
"
|
\
grep
"^Connection"
|
\
grep
"^Connection"
|
\
sed
-e
"s/^Connection Name
\\
s*:
\\
s*//g"
sed
-e
"s/^Connection Name
\\
s*:
\\
s*//g"
fi
fi
}
}
cfilename
=
/etc/opt/slapos/slapos.cfg
# Default node configure filename
cfilename
=
${
1
:/etc/opt/slapos/slapos.cfg
}
if
[[
!
-f
$cfilename
]]
;
then
if
[[
!
-f
$cfilename
]]
;
then
echo
"Error: no found configure file
$cfilename
, the computer "
echo
"Error: no found configure file
$cfilename
, the computer "
...
@@ -20,31 +36,33 @@ if [[ ! -f $cfilename ]] ; then
...
@@ -20,31 +36,33 @@ if [[ ! -f $cfilename ]] ; then
exit
1
exit
1
fi
fi
interface
=
$(
grep
"^interface_name
\\
s*="
$cfilename
|
sed
-e
"s/^interface_name
\\
s*=
\\
s*//g"
)
interface
=
$(
grep
"^interface_name
\\
s*="
$cfilename
|
\
sed
-e
"s/^interface_name
\\
s*=
\\
s*//g"
)
if
((
$?
==
0
))
;
then
if
((
$?
==
0
))
;
then
ifname
=
$(
guid2name
$interface
)
ifname
=
$(
guid2name
$interface
)
else
else
echo
"Error: no interface found in the configure file
$cfilename
"
echo
"Error: no interface found in the configure file
$cfilename
"
exit
1
exit
1
fi
fi
if
[[
"
$ifname
"
==
""
]]
;
then
if
[[
"
$ifname
"
==
""
]]
;
then
echo
"Error: no ipv6 interface found in the configure file
$cfilename
"
echo
"Error: no ipv6 interface found in the configure file
$cfilename
"
exit
1
exit
1
fi
fi
# Run re6stnet, waiting until it works
cd
/etc/re6stnet
cd
/etc/re6stnet
re6stnet @re6stnet.conf
-I
$ifname
-i
$ifname
re6stnet @re6stnet.conf
-I
$ifname
-i
$ifname
echo
Waiting Re6stent network work ...
echo
"Waiting re6stent network work ..."
while
true
;
do
while
true
;
do
ping6 slap.vifib.com
>
/dev/null
&&
break
ping6 slap.vifib.com
>
/dev/null
&&
break
done
done
echo
"re6stnet network OK."
if
((
$?
==
0
))
;
then
# Run slapformat
echo
Re6stnet network OK.
/opt/slapos/bin/slapformat
-c
--now
$cfilename
||
\
else
(
echo
"Error: initialize SlapOS Node failed."
;
exit
1
)
echo
SlapOS Node initialize failed, no any IPv6 connection.
echo
"run slapformat OK."
exit
1
fi
/opt/slapos/bin/slapformat
-c
--now
/etc/opt/slapos/slapos.cfg
# Run slapproxy
/opt/slapos/bin/slapproxy
||
echo
"Warning: start slapproxy failed"
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