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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos.package
Commits
3ba4a851
Commit
3ba4a851
authored
May 06, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issues for node config
parent
32de5cf4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
65 deletions
+92
-65
windows/scripts/slapos-all-in-one.iss
windows/scripts/slapos-all-in-one.iss
+3
-3
windows/scripts/slapos-client-config.sh
windows/scripts/slapos-client-config.sh
+5
-5
windows/scripts/slapos-node-config.sh
windows/scripts/slapos-node-config.sh
+81
-54
windows/scripts/slapos.iss
windows/scripts/slapos.iss
+3
-3
No files found.
windows/scripts/slapos-all-in-one.iss
View file @
3ba4a851
...
...
@@ -24,13 +24,13 @@ Source: "cygwin-packages\*"; DestDir: "{app}\cygwin-packages"; Flags: recursesub
Source: "publish\buildout\slapos\*"; DestDir: "{app}\cygwin\opt\slapos"; Flags: recursesubdirs;
Source: "opt\git\slapos.core\slapos.cfg.example"; DestDir: "{app}\cygwin\etc\slapos";
Source: "opt\git\slapos.core\slapos-client.cfg.example"; DestDir: "{app}\cygwin\etc\slapos";
Source: "opt\downloads\pyOpenSSL-0.13.tar.gz"; DestDir: "{app}\cygwin"; DestName: "pyOpenSSL.tar.gz"; Flags: deleteafterinstall;
Source: "opt\git\re6stnet\dist\re6stnet-0.1.tar.gz"; DestDir: "{app}\cygwin"; DestName: "re6stnet-0.1.tar.gz"; Flags: deleteafterinstall;
Source: "opt\downloads\miniupnpc-1.8.tar.gz"; DestDir: "{app}\cygwin"; DestName: "miniupnpc.tar.gz"; Flags: deleteafterinstall;
Source: "opt\git\slapos\component\cygwin\slapos-core.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\git\slapos\component\cygwin\slapos-cookbook-inotifyx.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\git\re6stnet\dist\re6stnet-0.1.tar.gz"; DestDir: "{app}\cygwin"; DestName: "re6stnet-0.1.tar.gz"; Flags: deleteafterinstall;
Source: "opt\downloads\miniupnpc-1.8.tar.gz"; DestDir: "{app}\cygwin"; DestName: "miniupnpc.tar.gz"; Flags: deleteafterinstall;
Source: "opt\git\qooxdoo\application\playground\build\*"; DestDir: "{app}\cygwin\etc\slapos\desktop"; Flags: recursesubdirs;
Source: "opt\git\qooxdoo\application\showcase\build\*"; DestDir: "{app}\cygwin\etc\slapos\node"; Flags: recursesubdirs;
...
...
windows/scripts/slapos-client-config.sh
View file @
3ba4a851
...
...
@@ -32,7 +32,7 @@ if [[ -f "$1" ]] ; then
elif
[[
!
-f
$client_certificate_file
]]
;
then
read
-p
"Where is certificate file: "
certificate_file
[[
!
-f
"
$certificate_file
"
]]
&&
\
echo
"Certificate file
%s
doesn't exists."
&&
exit
1
echo
"Certificate file
$certificate_file
doesn't exists."
&&
exit
1
echo
"Copy certificate from
$certificate_file
to
$client_certificate_file
"
cp
$certificate_file
$client_certificate_file
fi
...
...
@@ -43,18 +43,18 @@ if [[ -f "$2" ]] ; then
elif
[[
!
-f
$client_key_file
]]
;
then
read
-p
"Where is key file: "
key_file
[[
!
-f
"
$key_file
"
]]
&&
\
echo
"Key file
%s
doesn't exists."
&&
exit
1
echo
"Key file
$key_file
doesn't exists."
&&
exit
1
echo
"Copy key from
$key_file
to
$client_key_file
"
cp
$key_file
$client_key_file
fi
if
[[
!
-f
$client_configure_file
]]
;
then
[[
-f
$template_configure_file
]]
||
\
(
cd
/etc/slapos
;
wget
-O
slapos.cfg
http://git.erp5.org/gitweb/slapos.core.git/blob_plain/HEAD:/slapos-client.cfg.example
)
||
\
(
cd
/etc/slapos
;
wget http://git.erp5.org/gitweb/slapos.core.git/blob_plain/HEAD:/slapos-client.cfg.example
)
||
\
(
echo
"Download slapos-client.cfg.example failed."
;
exit
1
)
cp
$template_configure_file
$client_configure_file
fi
sed
-i
-e
"s
/^cert_file.*
$/
cert_file =
$client_certificate_file
/
"
\
-e
"s
/^key_file.*
$/
key_file =
$client_key_file
/
"
\
sed
-i
-e
"s
%^cert_file.*
$%
cert_file =
$client_certificate_file
%
"
\
-e
"s
%^key_file.*
$%
key_file =
$client_key_file
%
"
\
$client_configure_file
windows/scripts/slapos-node-config.sh
View file @
3ba4a851
...
...
@@ -13,7 +13,7 @@
# 4. Create node configure file by parameters ca/key and computer id
#
# 5. Add init-slapos-node.sh as system startup item
#
#
# Usage:
#
# ./slapos-node-config
...
...
@@ -35,15 +35,15 @@ function get_all_connections()
#
# If nothing found, return empty
# If more than one, return the first one
#
#
function
get_new_connection
()
{
original_connections
=
"
$*
X
"
original_connections
=
"
$*
"
current_connections
=
$(
get_all_connections
)
for
name
in
$current_connections
;
do
[[
"
$original_connections
"
==
".*
$name
.*"
]]
&&
\
echo
${
name
//%/
/
}
&&
return
0
[[
!
"
$original_connections
"
==
*
[
\
]
$name
[
\
]
*
]]
&&
\
echo
${
name
//%/
}
&&
return
0
done
}
...
...
@@ -54,12 +54,12 @@ function reset_connection()
{
ifname
=
${
1
-re6stnet-lo
}
for
addr
in
$(
netsh interface ipv6 show address
$ifname
level
=
normal |
\
grep
"^Manual"
\
grep
"^Manual"
|
\
sed
-e
"s/^
\(\w\+\s\+\)\{
4
\}
//"
)
;
do
netsh interface ipv6 del address
$ifname
$addr
done
for
addr
in
$(
netsh interface ip show address
$ifname
|
\
grep
"IP Address:"
\
grep
"IP Address:"
|
\
sed
-e
"s/IP Address://"
)
;
do
netsh interface del address
$ifname
$addr
done
...
...
@@ -76,37 +76,49 @@ function connection2guid()
sed
-e
"s/^GUID
\s
*:
\s
*//"
}
# Remove startup item first.
node_certificate_file
=
/etc/opt/slapos/ssl/certificate
node_key_file
=
/etc/opt/slapos/ssl/key
node_config_file
=
/etc/opt/slapos/slapos.cfg
node_template_file
=
/etc/slapos/slapos.cfg.example
run_key
=
'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
slapos_run_entry
=
SlapOS-Node
slapos_ifname
=
re6stnet-lo
# Remove startup item first.
regtool
-q
unset
"
$run_key
\\
$slapos_run_entry
"
#
# Add msloop network adapter, ane name it as "re6stnet-lo"
#
original_connections
=
$(
get_all_connections
)
if
[[
!
"
$original_connections
X"
==
".*
\b
re6stnet-lo
\b
.*X"
;
then
echo
Checking slapos network adapter:
$slapos_ifname
...
original_connections
=
$(
echo
$(
get_all_connections
))
if
[[
!
"
$original_connections
"
==
*
[
\
]
$slapos_ifname
[
\
]
*
]]
;
then
echo
Installing slapos network adapter ...
devcon
install
$WINDIR
\\
inf
\\
netloop.inf
*
MSLOOP
connection_name
=
$(
get_new_connection
$original_connections
)
[[
"X
$connection_name
"
==
"X"
]]
&&
\
echo
"Add msloop network adapter failed."
&&
\
exit
1
netsh interface
set
interface
"
$connection_name
"
newname
=
re6stnet-lo
echo
netsh interface
set
interface
name
=
"
$connection_name
"
newname
=
"
$slapos_ifname
"
fi
reset_connection re6stnet-lo
reset_connection
$slapos_ifname
echo
SlapOS network adapter OK.
#
# Generate Node Configure file
# Generate Node Configure file
#
echo
echo
echo
Before
continue
to configure, make sure you have register your server to
echo
slapos.org community Cloud, and have obtained X509 certificate and key
echo
which are needed
for
the following configuration process.
echo
echo
Refer to http://community.slapos.org/wiki/osoe-Lecture.SlapOS.Extended/developer-Installing.SlapOS.Slave.Node.Source
echo
echo
mkdir
-p
/etc/opt/slapos/ssl/partition_pki
if
[[
"
X
$1
"
==
"XCOMP-[0-9]+"
]]
;
then
if
[[
"
$1
"
==
COMP-+
([
0-9]
)
]]
;
then
computer_id
=
$1
else
[[
"X
$1
"
==
"X"
]]
||
echo
"Invalid computer id:
$1
"
...
...
@@ -114,59 +126,54 @@ else
echo
Please input computer
id
you have registered, it looks like COMP-XXXX
read
-p
"computer id: "
computer_id
fi
[[
"
X
$computer_id
"
==
"XCOMP-[0-9]+"
]]
||
\
[[
"
$computer_id
"
==
COMP-+
([
0-9]
)
]]
||
\
(
echo
"Invalid computer id specified."
;
exit
1
)
node_certificate_file
=
/etc/opt/slapos/ssl/certificate
if
[[
-f
"
$2
"
]]
;
then
echo
"Copy certificate from
$2
to
$node_certificate_file
"
cp
$2
$node_certificate_file
elif
[[
!
-f
$node_certificate_file
]]
;
then
read
-p
"Where is certificate file: "
certificate_file
[[
!
-f
"
$certificate_file
"
]]
&&
\
echo
"Certificate file
%s
doesn't exists."
&&
exit
1
echo
"Certificate file
$certificate_file
doesn't exists."
&&
exit
1
echo
"Copy certificate from
$certificate_file
to
$node_certificate_file
"
cp
$certificate_file
$node_certificate_file
cp
$certificate_file
$node_certificate_file
fi
node_key_file
=
/etc/opt/slapos/ssl/key
if
[[
-f
"
$3
"
]]
;
then
echo
"Copy key from
$3
to
$node_key_file
"
cp
$3
$node_key_file
elif
[[
!
-f
$node_key_file
]]
;
then
read
-p
"Where is key file: "
key_file
[[
!
-f
"
$key_file
"
]]
&&
\
echo
"Key file
%s
doesn't exists."
&&
exit
1
echo
"Key file
$key_file
doesn't exists."
&&
exit
1
echo
"Copy key from
$key_file
to
$node_key_file
"
cp
$key_file
$node_key_file
cp
$key_file
$node_key_file
fi
# Hope it will not confilct with original network in the local machine
ipv4_local_network
=
10.201.67.0/8
# Add ipv4 address
ip
-4
addr
$ipv4_local_network
dev re6stnet-lo
ip
-4
addr
add
$ipv4_local_network
dev
$slapos_ifname
# Create node configure file, replace interface_name with guid of
# re6stnet-lo
mkdir
-p
/etc/opt/slapos/ssl/partition_pki
nodecfgfile
=
/etc/opt/slapos/slapos.cfg
if
[[
!
-f
$node
cfg
file
]]
;
then
[[
-f
/etc/slapos/slapos.cfg.examp
le
]]
||
\
(
cd
/etc/slapos
;
wget
-O
slapos.cfg
http://git.erp5.org/gitweb/slapos.core.git/blob_plain/HEAD:/slapos.cfg.example
)
||
\
if
[[
!
-f
$node
_config_
file
]]
;
then
[[
-f
$node_template_fi
le
]]
||
\
(
cd
/etc/slapos
;
wget http://git.erp5.org/gitweb/slapos.core.git/blob_plain/HEAD:/slapos.cfg.example
)
||
\
(
echo
"Download slapos.cfg.example failed."
;
exit
1
)
cp
/etc/slapos/slapos.cfg.example
$nodecfgfile
cp
$node_template_file
$node_config_file
fi
interface_guid
=
$(
connection2guid
re6stnet-lo
)
interface_guid
=
$(
connection2guid
$slapos_ifname
)
# generate /etc/slapos/slapos.cfg
sed
-i
-e
"s
/^
\\
s*interface_name.*
$/
interface_name =
$interface_guid
/
"
\
-e
"s
/^#
\?\\
s*ipv6_interface.*
$/
# ipv6_interface =/
g"
\
-e
"s
/^ipv4_local_network.*
$/
ipv4_local_network =
$ipv4_local_network
/
"
\
-e
"s
/^computer_id.*
$/
computer_id =
$computer_id
/
"
\
$node
cfg
file
sed
-i
-e
"s
%^
\\
s*interface_name.*
$%
interface_name =
$interface_guid
%
"
\
-e
"s
%^#
\?\\
s*ipv6_interface.*
$%
# ipv6_interface =%
g"
\
-e
"s
%^ipv4_local_network.*
$%
ipv4_local_network =
$ipv4_local_network
%
"
\
-e
"s
%^computer_id.*
$%
computer_id =
$computer_id
%
"
\
$node
_config_
file
#
# Re6stnet
...
...
@@ -177,23 +184,41 @@ netsh interface ipv6 show interface > /dev/null || netsh interface ipv6 install
# miniupnpc is required by re6stnet
if
[[
!
-f
/opt/miniupnpc
]]
;
then
cd
/opt
if
[[
-f
/miniupnpc.tar.gz
]]
;
then
tar
xzf miniupnpc.tar.gz
mv
$(
ls
miniupnpc-
*
)
miniupnpc
echo
"Installing miniupnpc ..."
cd
/opt
tar
xzf /miniupnpc.tar.gz
--no-same-owner
mv
$(
ls
-d
miniupnpc-
*
)
miniupnpc
cd
miniupnpc
make
python setup.py
install
||
echo
"Install miniupnpc failed."
else
echo
"No miniupnpc source package found."
fi
fi
# pyOpenSSL is required by re6stnet
if
[[
!
-f
/opt/pyOpenSSL
]]
;
then
if
[[
-f
/pyOpenSSL.tar.gz
]]
;
then
echo
"Installing pyOpenSSL ..."
cd
/opt
tar
xzf /pyOpenSSL.tar.gz
--no-same-owner
mv
$(
ls
-d
pyOpenSSL-
*
)
pyOpenSSL
cd
pyOpenSSL
python setup.py
install
||
echo
"Install pyOpenSSL failed."
fi
fi
# Install re6stnet
if
[[
!
-f
/opt/re6stnet
]]
;
then
echo
"Installing re6stnet ..."
cd
/opt
if
[[
-f
/re6stnet.tar.gz
]]
;
then
tar
xzf
re6stnet.tar.gz
mv
$(
ls
re6stnet-
*
)
re6stnet
tar
xzf
/re6stnet.tar.gz
--no-same-owner
mv
$(
ls
-d
re6stnet-
*
)
re6stnet
else
git clone
-b
cygwin
-n
http://git.erp5.org/repos/re6stnet.git
echo
"Clone re6stnet from http://git.erp5.org/repos/re6stnet.git"
git clone
-b
cygwin
-n
http://git.erp5.org/repos/re6stnet.git
fi
cd
re6stnet
python setup.py
install
||
echo
"Install re6stnet failed."
...
...
@@ -206,18 +231,20 @@ if [[ ! -f re6stnet.conf ]] ; then
fi
[[
!
-f
re6stnet.conf
]]
&&
echo
"Register to nexedi re6stnet failed"
&&
exit
1
#
#
# Add run item when windows startup
#
init_script
_name
=
/etc/slapos/scripts/init-sal
pos-node
echo
"Add
${
init_script
_name
}
.sh as Windows startup item."
if
[[
!
-f
${
init_script_name
}
.bat
]]
;
then
cat
<<
EOF
>
${
init_script_name
}
.bat
\"
$(
cygpath
-w
/usr/bin/sh
)
\"
--login -i
${
init_script_name
}
.sh
EXIT 0
EOF
fi
init_script
=
/etc/slapos/scripts/init-sla
pos-node
echo
"Add
${
init_script
}
.sh as Windows startup item."
# if [[ ! -f ${init_script
}.bat ]] ; then
# cat <<EOF > ${init_script
}.bat
# "$(cygpath -w /usr/bin/bash)" --login -i ${init_script
}.sh
#
EXIT 0
#
EOF
#
fi
regtool
-q
set
"
$run_key
\\
$slapos_run_entry
"
\
"START
\"
$(
cygpath
-w
${
init_script_name
}
.bat
)
"
||
\
"
\"
$(
cygpath
-w
/usr/bin/bash
)
\"
--login -i
${
init_script
}
.sh
"
||
\
echo
"Add startup item failed."
exit
0
windows/scripts/slapos.iss
View file @
3ba4a851
...
...
@@ -22,12 +22,12 @@ Name: "{app}\cygwin\etc\slapos\patches"
Name: "{app}\cygwin\etc\slapos\images"
[Files]
Source: "opt\git\slapos\component\cygwin\slapos-core.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\git\slapos\component\cygwin\slapos-cookbook-inotifyx.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\git\re6stnet\dist\re6stnet-0.1.tar.gz"; DestDir: "{app}\cygwin"; DestName: "re6stnet-0.1.tar.gz"; Flags: deleteafterinstall;
Source: "opt\downloads\miniupnpc-1.8.tar.gz"; DestDir: "{app}\cygwin"; DestName: "miniupnpc.tar.gz"; Flags: deleteafterinstall;
Source: "opt\git\slapos\component\cygwin\slapos-core.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\git\slapos\component\cygwin\slapos-cookbook-inotifyx.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\git\qooxdoo\application\playground\build\*"; DestDir: "{app}\cygwin\etc\slapos\desktop"; Flags: recursesubdirs;
Source: "opt\git\qooxdoo\application\showcase\build\*"; DestDir: "{app}\cygwin\etc\slapos\node"; Flags: recursesubdirs;
...
...
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