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
Kasra Jamshidi
slapos.package
Commits
659e6633
Commit
659e6633
authored
Jul 26, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos-configure: refine code with csih_inform
parent
b36f860d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
121 deletions
+113
-121
windows/scripts/slapos-configure.sh
windows/scripts/slapos-configure.sh
+110
-120
windows/scripts/slapos-cygwin-bootstrip.sh
windows/scripts/slapos-cygwin-bootstrip.sh
+3
-1
No files found.
windows/scripts/slapos-configure.sh
View file @
659e6633
...
@@ -154,7 +154,7 @@ mkdir -p /etc/re6stnet
...
@@ -154,7 +154,7 @@ mkdir -p /etc/re6stnet
# -----------------------------------------------------------
# -----------------------------------------------------------
# Start seclogon service in the Windows XP
# Start seclogon service in the Windows XP
if
csih_is_xp
;
then
if
csih_is_xp
;
then
echo
"Set start property of seclogon to auto"
csih_inform
"Set start property of seclogon to auto"
sc config seclogon
start
=
auto
||
sc config seclogon
start
=
auto
||
csih_warning
"failed to set seclogon to auto start."
csih_warning
"failed to set seclogon to auto start."
# In the later, it's RunAs service, and will start by default
# In the later, it's RunAs service, and will start by default
...
@@ -167,24 +167,22 @@ csih_error "failed to create account ${_administrator}."
...
@@ -167,24 +167,22 @@ csih_error "failed to create account ${_administrator}."
# -----------------------------------------------------------
# -----------------------------------------------------------
# Configure cygwin services: cygserver syslog-ng sshd
# Configure cygwin services: cygserver syslog-ng sshd
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
csih_inform
"Starting configure cygwin services ..."
echo
Starting configure cygwin services ...
echo
if
!
cygrunsrv
--query
cygserver
>
/dev/null 2>&1
;
then
if
!
cygrunsrv
--query
cygserver
>
/dev/null 2>&1
;
then
echo
Run cygserver-config ...
csih_inform
"run cygserver-config ..."
/usr/bin/cygserver-config
--yes
||
\
/usr/bin/cygserver-config
--yes
||
\
csih_error
"
F
ailed to run cygserver-config"
csih_error
"
f
ailed to run cygserver-config"
else
else
echo
The cygserver service has been installed.
csih_inform
"the cygserver service has been installed"
fi
fi
check_cygwin_service cygserver
check_cygwin_service cygserver
if
!
cygrunsrv
--query
syslog-ng
>
/dev/null 2>&1
;
then
if
!
cygrunsrv
--query
syslog-ng
>
/dev/null 2>&1
;
then
echo
Run syslog-ng-config ...
csih_inform
"run syslog-ng-config ..."
/usr/bin/syslog-ng-config
--yes
||
\
/usr/bin/syslog-ng-config
--yes
||
\
csih_error
"
F
ailed to run syslog-ng-config"
csih_error
"
f
ailed to run syslog-ng-config"
else
else
echo
The syslog-ng service has been installed.
csih_inform
"the syslog-ng service has been installed"
fi
fi
check_cygwin_service syslog-ng
check_cygwin_service syslog-ng
...
@@ -192,12 +190,12 @@ if ! cygrunsrv --query sshd > /dev/null 2>&1 ; then
...
@@ -192,12 +190,12 @@ if ! cygrunsrv --query sshd > /dev/null 2>&1 ; then
if
csih_is_xp
&&
[[
-z
"
${
csih_PRIVILEGED_PASSWORD
}
"
]]
;
then
if
csih_is_xp
&&
[[
-z
"
${
csih_PRIVILEGED_PASSWORD
}
"
]]
;
then
slapos_request_password
${
_administrator
}
"Install sshd service need the password of
${
_administrator
}
."
slapos_request_password
${
_administrator
}
"Install sshd service need the password of
${
_administrator
}
."
fi
fi
echo
Run ssh-host-config ...
csih_inform
"run ssh-host-config ..."
/usr/bin/ssh-host-config
--yes
--cygwin
ntsec
--port
22002
\
/usr/bin/ssh-host-config
--yes
--cygwin
ntsec
--port
22002
\
--user
${
_administrator
}
--pwd
${
csih_PRIVILEGED_PASSWORD
}
||
--user
${
_administrator
}
--pwd
${
csih_PRIVILEGED_PASSWORD
}
||
csih_error
"Failed to run ssh-host-config"
csih_error
"Failed to run ssh-host-config"
else
else
echo
The sshd service has been installed.
csih_inform
"the sshd service has been installed"
fi
fi
check_cygwin_service sshd
check_cygwin_service sshd
...
@@ -210,53 +208,48 @@ if ! cygrunsrv --query cron > /dev/null 2>&1 ; then
...
@@ -210,53 +208,48 @@ if ! cygrunsrv --query cron > /dev/null 2>&1 ; then
slapos_request_password
${
_administrator
}
"Install cron service need the password of
${
_administrator
}
."
slapos_request_password
${
_administrator
}
"Install cron service need the password of
${
_administrator
}
."
fi
fi
echo
Run slapos-cron-config ...
csih_inform
"run slapos-cron-config ..."
${
slapos_cron_config
}
${
_administrator
}
${
csih_PRIVILEGED_PASSWORD
}
||
${
slapos_cron_config
}
${
_administrator
}
${
csih_PRIVILEGED_PASSWORD
}
||
csih_error
"Failed to run
${
slapos_cron_config
}
"
csih_error
"Failed to run
${
slapos_cron_config
}
"
else
else
echo
The cron service has been installed.
csih_inform
"the cron service has been installed"
fi
fi
check_cygwin_service cron
check_cygwin_service cron
echo
csih_inform
"Configure cygwin services OK"
echo
Configure cygwin services OK.
echo
""
echo
# -----------------------------------------------------------
# -----------------------------------------------------------
# Install network connection used by slapos node
# Install network connection used by slapos node
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
csih_inform
"Starting configure slapos network ..."
echo
Starting configure slapos network ...
echo
if
!
netsh interface ipv6 show interface |
grep
-q
"
\\
b
${
slapos_ifname
}
\\
b"
;
then
if
!
netsh interface ipv6 show interface |
grep
-q
"
\\
b
${
slapos_ifname
}
\\
b"
;
then
echo
Installing slapos network adapter ...
csih_inform
"Installing network interface
${
slapos_ifname
}
..."
ipwin
install
$WINDIR
\\
inf
\\
netloop.inf
*
msloop
${
slapos_ifname
}
ipwin
install
$WINDIR
\\
inf
\\
netloop.inf
*
msloop
${
slapos_ifname
}
||
csih_error
"install network interface
${
slapos_ifname
}
failed"
fi
fi
ip
-4
addr add
$(
echo
${
ipv4_local_network
}
|
sed
-e
"s%
\.
0/%.1/%g"
)
dev
${
slapos_ifname
}
ip
-4
addr add
$(
echo
${
ipv4_local_network
}
|
sed
-e
"s%
\.
0/%.1/%g"
)
dev
${
slapos_ifname
}
||
# reset_connection ${slapos_ifname}
csih_error
"add ipv4 address failed"
echo
echo
Configure slapos network OK.
csih_inform
"Configure slapos network OK"
echo
echo
""
# -----------------------------------------------------------
# -----------------------------------------------------------
# Check IPv6 protocol, install it if it isn't installed
# Check IPv6 protocol, install it if it isn't installed
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
csih_inform
"Starting configure IPv6 protocol ..."
echo
Starting configure IPv6 protocol ...
echo
netsh interface ipv6 show interface
>
/dev/null
||
\
netsh interface ipv6 show interface
>
/dev/null
||
\
netsh interface ipv6
install
||
\
netsh interface ipv6
install
||
\
csih_error
"
Failed to install IPv6 protocol.
"
csih_error
"
install IPv6 protocol failed
"
echo
echo
Configure IPv6 protocol OK.
csih_inform
"Configure IPv6 protocol OK"
echo
echo
""
# -----------------------------------------------------------
# -----------------------------------------------------------
# config: Generate slapos node and client configure file
# config: Generate slapos node and client configure file
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
csih_inform
"Starting configure slapos client and node ..."
echo
Starting configure section config ...
echo
[[
-r
${
node_template_file
}
&&
-r
${
client_template_file
}
]]
||
\
[[
-r
${
node_template_file
}
&&
-r
${
client_template_file
}
]]
||
\
create_template_configure_file
||
\
create_template_configure_file
||
\
csih_error
"Failed to create template configure file."
csih_error
"Failed to create template configure file."
...
@@ -279,11 +272,11 @@ if [[ ! -f ${node_certificate_file} ]] ; then
...
@@ -279,11 +272,11 @@ if [[ ! -f ${node_certificate_file} ]] ; then
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/computer.crt"
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/computer.crt"
[[
!
-r
"
${
_filename
}
"
]]
&&
\
[[
!
-r
"
${
_filename
}
"
]]
&&
\
csih_error
"Computer certificate file
${
_filename
}
doesn't exists."
csih_error
"Computer certificate file
${
_filename
}
doesn't exists."
echo
"C
opy certificate from
${
_filename
}
to
${
node_certificate_file
}
"
csih_inform
"c
opy certificate from
${
_filename
}
to
${
node_certificate_file
}
"
_filename
=
$(
cygpath
-u
${
_filename
}
)
_filename
=
$(
cygpath
-u
${
_filename
}
)
cp
${
_filename
}
${
node_certificate_file
}
cp
${
_filename
}
${
node_certificate_file
}
else
else
echo
"F
ound computer certificate file:
${
node_certificate_file
}
"
csih_inform
"f
ound computer certificate file:
${
node_certificate_file
}
"
fi
fi
openssl x509
-noout
-in
${
node_certificate_file
}
||
\
openssl x509
-noout
-in
${
node_certificate_file
}
||
\
csih_error
"Invalid computer certificate:
${
node_certificate_file
}
."
csih_error
"Invalid computer certificate:
${
node_certificate_file
}
."
...
@@ -295,17 +288,17 @@ if [[ ! -f ${node_key_file} ]] ; then
...
@@ -295,17 +288,17 @@ if [[ ! -f ${node_key_file} ]] ; then
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/computer.key"
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/computer.key"
[[
!
-f
"
${
_filename
}
"
]]
&&
\
[[
!
-f
"
${
_filename
}
"
]]
&&
\
csih_error
"Key file
${
_filename
}
doesn't exists."
csih_error
"Key file
${
_filename
}
doesn't exists."
echo
"C
opy key from
${
_filename
}
to
${
node_key_file
}
"
csih_inform
"c
opy key from
${
_filename
}
to
${
node_key_file
}
"
_filename
=
$(
cygpath
-u
${
_filename
}
)
_filename
=
$(
cygpath
-u
${
_filename
}
)
cp
${
_filename
}
${
node_key_file
}
cp
${
_filename
}
${
node_key_file
}
else
else
echo
"F
ound computer key file:
${
node_key_file
}
"
csih_inform
"f
ound computer key file:
${
node_key_file
}
"
fi
fi
openssl rsa
-noout
-in
${
node_key_file
}
-check
||
openssl rsa
-noout
-in
${
node_key_file
}
-check
||
csih_error
"Invalid node key:
${
node_key_file
}
."
csih_error
"Invalid node key:
${
node_key_file
}
."
if
[[
!
-f
${
node_configure_file
}
]]
;
then
if
[[
!
-f
${
node_configure_file
}
]]
;
then
echo
"C
opy computer configure file from
${
node_template_file
}
to
${
node_configure_file
}
"
csih_inform
"c
opy computer configure file from
${
node_template_file
}
to
${
node_configure_file
}
"
cp
${
node_template_file
}
${
node_configure_file
}
cp
${
node_template_file
}
${
node_configure_file
}
fi
fi
...
@@ -319,16 +312,16 @@ computer_guid=$(grep "CN=COMP" ${node_certificate_file} | \
...
@@ -319,16 +312,16 @@ computer_guid=$(grep "CN=COMP" ${node_certificate_file} | \
[[
"
$computer_guid
"
==
COMP-+
([
0-9]
)
]]
||
[[
"
$computer_guid
"
==
COMP-+
([
0-9]
)
]]
||
csih_error
"Invalid computer id '
$computer_guid
' specified."
csih_error
"Invalid computer id '
$computer_guid
' specified."
echo
"Computer configuration information:"
csih_inform
"Computer configuration information:"
echo
" interface name:
${
slapos_ifname
}
"
csih_inform
" interface name:
${
slapos_ifname
}
"
echo
" GUID:
$interface_guid
"
csih_inform
" GUID:
$interface_guid
"
echo
" ipv4_local_network:
$ipv4_local_network
"
csih_inform
" ipv4_local_network:
$ipv4_local_network
"
echo
" computer_id:
$computer_guid
"
csih_inform
" computer_id:
$computer_guid
"
echo
csih_inform
echo
" If ipv4_local_network confilcts with your local network, change it"
csih_inform
" If ipv4_local_network confilcts with your local network, change it"
echo
" in the file:
${
node_configure_file
}
"
csih_inform
" in the file:
${
node_configure_file
}
"
echo
" Or change it in the
$(
dirname
$0
)
/slapos-include.sh"
csih_inform
" Or change it in the
$(
dirname
$0
)
/slapos-include.sh"
echo
" and run Configure SlapOS again."
csih_inform
" and run Configure SlapOS again."
sed
-i
-e
"s%^
\\
s*interface_name.*
$%
interface_name =
$interface_guid
%"
\
sed
-i
-e
"s%^
\\
s*interface_name.*
$%
interface_name =
$interface_guid
%"
\
-e
"s%^#
\?\\
s*ipv6_interface.*
$%
# ipv6_interface =%g"
\
-e
"s%^#
\?\\
s*ipv6_interface.*
$%
# ipv6_interface =%g"
\
...
@@ -343,7 +336,7 @@ if [[ ! -f ${client_certificate_file} ]] ; then
...
@@ -343,7 +336,7 @@ if [[ ! -f ${client_certificate_file} ]] ; then
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/certificate"
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/certificate"
[[
!
-f
"
${
_filename
}
"
]]
&&
\
[[
!
-f
"
${
_filename
}
"
]]
&&
\
csih_error
"Client certificate file
${
_filename
}
doesn't exists."
csih_error
"Client certificate file
${
_filename
}
doesn't exists."
echo
"C
opy client certificate from
${
_filename
}
to
${
client_certificate_file
}
"
csih_inform
"c
opy client certificate from
${
_filename
}
to
${
client_certificate_file
}
"
_filename
=
$(
cygpath
-u
${
_filename
}
)
_filename
=
$(
cygpath
-u
${
_filename
}
)
cp
${
_filename
}
${
client_certificate_file
}
cp
${
_filename
}
${
client_certificate_file
}
fi
fi
...
@@ -357,7 +350,7 @@ if [[ ! -f ${client_key_file} ]] ; then
...
@@ -357,7 +350,7 @@ if [[ ! -f ${client_key_file} ]] ; then
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/key"
[[
-z
"
${
_filename
}
"
]]
&&
_filename
=
"/key"
[[
!
-f
"
${
_filename
}
"
]]
&&
\
[[
!
-f
"
${
_filename
}
"
]]
&&
\
csih_error
"Key file
${
_filename
}
doesn't exists."
csih_error
"Key file
${
_filename
}
doesn't exists."
echo
"C
opy client key from
${
_filename
}
to
${
client_key_file
}
"
csih_inform
"c
opy client key from
${
_filename
}
to
${
client_key_file
}
"
_filename
=
$(
cygpath
-u
${
_filename
}
)
_filename
=
$(
cygpath
-u
${
_filename
}
)
cp
${
_filename
}
${
client_key_file
}
cp
${
_filename
}
${
client_key_file
}
fi
fi
...
@@ -365,81 +358,79 @@ openssl rsa -noout -in ${client_key_file} -check || \
...
@@ -365,81 +358,79 @@ openssl rsa -noout -in ${client_key_file} -check || \
csih_error
"Invalid client key:
${
client_key_file
}
."
csih_error
"Invalid client key:
${
client_key_file
}
."
if
[[
!
-f
${
client_configure_file
}
]]
;
then
if
[[
!
-f
${
client_configure_file
}
]]
;
then
echo
"C
opy client configure file from
${
client_template_file
}
to
${
client_configure_file
}
"
csih_inform
"c
opy client configure file from
${
client_template_file
}
to
${
client_configure_file
}
"
cp
${
client_template_file
}
${
client_configure_file
}
cp
${
client_template_file
}
${
client_configure_file
}
fi
fi
echo
"Client configuration information:"
csih_inform
"Client configuration information:"
echo
" client certificate file:
${
client_certificate_file
}
"
csih_inform
" client certificate file:
${
client_certificate_file
}
"
echo
" client key file:
${
client_key_file
}
"
csih_inform
" client key file:
${
client_key_file
}
"
sed
-i
-e
"s%^cert_file.*
$%
cert_file =
${
client_certificate_file
}
%"
\
sed
-i
-e
"s%^cert_file.*
$%
cert_file =
${
client_certificate_file
}
%"
\
-e
"s%^key_file.*
$%
key_file =
${
client_key_file
}
%"
\
-e
"s%^key_file.*
$%
key_file =
${
client_key_file
}
%"
\
${
client_configure_file
}
${
client_configure_file
}
echo
echo
Configure section config OK.
csih_inform
"Configure slapos client and node OK"
echo
echo
""
# -----------------------------------------------------------
# -----------------------------------------------------------
# re6stnet: Install required packages and register to nexedi
# re6stnet: Install required packages and register to nexedi
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
csih_inform
"Starting configure section re6stnet ..."
echo
Starting configure section re6stnet ...
echo
echo
Checking miniupnpc ...
csih_inform
"checking miniupnpc ..."
if
[[
!
-d
/opt/miniupnpc
]]
;
then
if
[[
!
-d
/opt/miniupnpc
]]
;
then
_filename
=
/opt/downloads/miniupnpc.tar.gz
_filename
=
/opt/downloads/miniupnpc.tar.gz
[[
-r
${
_filename
}
]]
||
csih_error
"No package found:
${
_filename
}
"
[[
-r
${
_filename
}
]]
||
csih_error
"No package found:
${
_filename
}
"
echo
"I
nstalling miniupnpc ..."
csih_inform
"i
nstalling miniupnpc ..."
cd
/opt
cd
/opt
tar
xzf
${
_filename
}
--no-same-owner
tar
xzf
${
_filename
}
--no-same-owner
mv
$(
ls
-d
miniupnpc-
*
)
miniupnpc
mv
$(
ls
-d
miniupnpc-
*
)
miniupnpc
cd
miniupnpc
cd
miniupnpc
make
make
python setup.py
install
||
csih_error
"Failed to install miniupnpc."
python setup.py
install
||
csih_error
"Failed to install miniupnpc."
echo
"Install miniupnpc OK.
"
csih_inform
"install miniupnpc OK
"
else
else
echo
Check miniupnpc OK.
csih_inform
"check miniupnpc OK"
fi
fi
echo
Checking pyOpenSSL ...
csih_inform
"checking pyOpenSSL ..."
if
[[
!
-d
/opt/pyOpenSSL
]]
;
then
if
[[
!
-d
/opt/pyOpenSSL
]]
;
then
_filename
=
/opt/downloads/pyOpenSSL.tar.gz
_filename
=
/opt/downloads/pyOpenSSL.tar.gz
[[
-r
${
_filename
}
]]
||
csih_error
"No package found:
${
_filename
}
"
[[
-r
${
_filename
}
]]
||
csih_error
"No package found:
${
_filename
}
"
echo
"I
nstalling pyOpenSSL ..."
csih_inform
"i
nstalling pyOpenSSL ..."
cd
/opt
cd
/opt
tar
xzf
${
_filename
}
--no-same-owner
tar
xzf
${
_filename
}
--no-same-owner
mv
$(
ls
-d
pyOpenSSL-
*
)
pyOpenSSL
mv
$(
ls
-d
pyOpenSSL-
*
)
pyOpenSSL
cd
pyOpenSSL
cd
pyOpenSSL
python setup.py
install
||
csih_error
"Failed ot install pyOpenSSL."
python setup.py
install
||
csih_error
"Failed ot install pyOpenSSL."
echo
"Install pyOpenSSL OK.
"
csih_inform
"install pyOpenSSL OK
"
else
else
echo
Check pyOpenSSL OK.
csih_inform
"check pyOpenSSL OK"
fi
fi
echo
Checking re6stnet ...
echo
Checking re6stnet ...
if
[[
!
-d
/opt/re6stnet
]]
;
then
if
[[
!
-d
/opt/re6stnet
]]
;
then
echo
"I
nstalling re6stnet ..."
csih_inform
"i
nstalling re6stnet ..."
_filename
=
/opt/downloads/re6stnet.tar.gz
_filename
=
/opt/downloads/re6stnet.tar.gz
cd
/opt
cd
/opt
if
[[
-r
${
_filename
}
]]
;
then
if
[[
-r
${
_filename
}
]]
;
then
tar
xzf
${
_filename
}
--no-same-owner
tar
xzf
${
_filename
}
--no-same-owner
mv
$(
ls
-d
re6stnet-
*
)
re6stnet
mv
$(
ls
-d
re6stnet-
*
)
re6stnet
else
else
echo
"C
lone re6stnet from http://git.erp5.org/repos/re6stnet.git"
csih_inform
"c
lone re6stnet from http://git.erp5.org/repos/re6stnet.git"
git clone
-b
cygwin http://git.erp5.org/repos/re6stnet.git
||
git clone
-b
cygwin http://git.erp5.org/repos/re6stnet.git
||
csih_error
"Failed to clone re6stnet.git"
csih_error
"Failed to clone re6stnet.git"
fi
fi
cd
re6stnet
cd
re6stnet
python setup.py
install
||
csih_error
"Failed to install re6stnet."
python setup.py
install
||
csih_error
"Failed to install re6stnet."
echo
"Install re6stnet OK.
"
csih_inform
"install re6stnet OK
"
else
else
echo
Check re6stnet OK.
csih_inform
"check re6stnet OK"
fi
fi
echo
Checking re6stnet configuration ...
csih_inform
"checking re6stnet configuration ..."
if
[[
!
-r
${
re6stnet_configure_file
}
]]
;
then
if
[[
!
-r
${
re6stnet_configure_file
}
]]
;
then
echo
"R
egistering to http://re6stnet.nexedi.com ..."
csih_inform
"r
egistering to http://re6stnet.nexedi.com ..."
cd
$(
dirname
${
re6stnet_configure_file
}
)
cd
$(
dirname
${
re6stnet_configure_file
}
)
# Your subnet: 2001:67c:1254:e:19::/80 (CN=917529/32)
# Your subnet: 2001:67c:1254:e:19::/80 (CN=917529/32)
subnet
=
$(
re6st-conf
--registry
http://re6stnet.nexedi.com/
--anonymous
|
\
subnet
=
$(
re6st-conf
--registry
http://re6stnet.nexedi.com/
--anonymous
|
\
...
@@ -447,22 +438,21 @@ if [[ ! -r ${re6stnet_configure_file} ]] ; then
...
@@ -447,22 +438,21 @@ if [[ ! -r ${re6stnet_configure_file} ]] ; then
csih_error
"Register to nexedi re6stnet failed"
csih_error
"Register to nexedi re6stnet failed"
[[
-r
re6stnet.conf
]]
||
\
[[
-r
re6stnet.conf
]]
||
\
csih_error
"No
${
re6stnet_configure_file
}
found."
csih_error
"No
${
re6stnet_configure_file
}
found."
echo
Register re6stnet OK.
csih_inform
"register re6stnet OK"
echo
"Write information to re6stnet.conf:"
csih_inform
"Write information to re6stnet.conf:"
echo
" #
$subnet
"
csih_inform
" #
$subnet
"
echo
" table 0"
csih_inform
" table 0"
echo
" ovpnlog"
csih_inform
" ovpnlog"
echo
" main-interface
${
slapos_ifname
}
"
csih_inform
" main-interface
${
slapos_ifname
}
"
echo
" interface
${
slapos_ifname
}
"
csih_inform
" interface
${
slapos_ifname
}
"
echo
-e
"#
$subnet
\n
table 0
\n
ovpnlog"
\
echo
-e
"#
$subnet
\n
table 0
\n
ovpnlog"
\
"
\n
main-interface
${
slapos_ifname
}
\n
interface
${
slapos_ifname
}
"
\
"
\n
main-interface
${
slapos_ifname
}
\n
interface
${
slapos_ifname
}
"
\
>>
${
re6stnet_configure_file
}
>>
${
re6stnet_configure_file
}
fi
fi
echo
csih_inform
"Configure section re6stnet OK"
echo
Configure section re6stnet OK.
echo
""
echo
# -----------------------------------------------------------
# -----------------------------------------------------------
# taps: Install openvpn tap-windows drivers used by re6stnet
# taps: Install openvpn tap-windows drivers used by re6stnet
...
@@ -471,9 +461,8 @@ echo
...
@@ -471,9 +461,8 @@ echo
# Adding tap-windows driver will break others, so we add all drivers
# Adding tap-windows driver will break others, so we add all drivers
# here. Get re6stnet client count, then remove extra drivers and add
# here. Get re6stnet client count, then remove extra drivers and add
# required drivers.
# required drivers.
echo
csih_inform
"Starting configure section taps ..."
echo
Starting configure section taps ...
echo
if
check_re6stnet_needed
;
then
if
check_re6stnet_needed
;
then
csih_inform
"Disable IPv6 6to4 interface ... "
csih_inform
"Disable IPv6 6to4 interface ... "
netsh interface ipv6 6to4
set
state disable
&&
csih_inform
"OK."
netsh interface ipv6 6to4
set
state disable
&&
csih_inform
"OK."
...
@@ -484,25 +473,25 @@ if check_re6stnet_needed ; then
...
@@ -484,25 +473,25 @@ if check_re6stnet_needed ; then
_count
=
$(
sed
-n
-e
"s/^client-count *//p"
${
re6stnet_configure_file
}
)
_count
=
$(
sed
-n
-e
"s/^client-count *//p"
${
re6stnet_configure_file
}
)
[[
-z
"
${
_count
}
"
]]
&&
_count
=
10
[[
-z
"
${
_count
}
"
]]
&&
_count
=
10
echo
"R
e6stnet client-count:
${
_count
}
"
csih_inform
"r
e6stnet client-count:
${
_count
}
"
_name_list
=
"re6stnet-tcp re6stnet-udp"
_name_list
=
"re6stnet-tcp re6stnet-udp"
for
((
i
=
1
;
i<
=
${
_count
}
;
i
=
i+1
))
;
do
for
((
i
=
1
;
i<
=
${
_count
}
;
i
=
i+1
))
;
do
_name_list
=
"
${
_name_list
}
re6stnet
$i
"
_name_list
=
"
${
_name_list
}
re6stnet
$i
"
done
done
_filename
=
$(
cygpath
-w
${
openvpn_tap_driver_inf
}
)
_filename
=
$(
cygpath
-w
${
openvpn_tap_driver_inf
}
)
for
name
in
${
_name_list
}
;
do
for
_
name
in
${
_name_list
}
;
do
echo
"Checking interface
$name
..."
csih_inform
"checking interface
${
_name
}
..."
if
!
netsh interface ipv6 show interface |
grep
-q
"
\\
b
$
name
\\
b"
;
then
if
!
netsh interface ipv6 show interface |
grep
-q
"
\\
b
$
{
_name
}
\\
b"
;
then
[[
-r
${
openvpn_tap_driver_inf
}
]]
||
[[
-r
${
openvpn_tap_driver_inf
}
]]
||
csih_error
"Failed to install OpenVPN Tap-Windows Driver, missing driver inf file:
${
_filename
}
"
csih_error
"Failed to install OpenVPN Tap-Windows Driver, missing driver inf file:
${
_filename
}
"
echo
"Installing interface
$name
..."
csih_inform
"installing interface
${
_name
}
..."
# ipwin install \"${_filename}\" $openvpn_tap_driver_hwid $
name
; ||
# ipwin install \"${_filename}\" $openvpn_tap_driver_hwid $
{_name}
; ||
ip vpntap add dev
$
name
||
ip vpntap add dev
$
{
_name
}
||
csih_error
"Failed to install OpenVPN Tap-Windows Driver."
csih_error
"Failed to install OpenVPN Tap-Windows Driver."
echo
"Interface
$name
installed."
csih_inform
"interface
${
_name
}
installed."
else
else
echo
"
$name
has been installed."
csih_inform
"
${
_name
}
has been installed."
fi
fi
done
done
...
@@ -518,7 +507,7 @@ if check_re6stnet_needed ; then
...
@@ -518,7 +507,7 @@ if check_re6stnet_needed ; then
-u
${
_administrator
}
-w
${
csih_PRIVILEGED_PASSWORD
}
||
-u
${
_administrator
}
-w
${
csih_PRIVILEGED_PASSWORD
}
||
csih_error
"Failed to install
${
re6stnet_service_name
}
service."
csih_error
"Failed to install
${
re6stnet_service_name
}
service."
fi
fi
echo
"Y
ou can check log files in the /var/log/re6stnet/*.log"
csih_inform
"y
ou can check log files in the /var/log/re6stnet/*.log"
if
!
check_cygwin_service
${
re6stnet_service_name
}
;
then
if
!
check_cygwin_service
${
re6stnet_service_name
}
;
then
csih_inform
"Service
${
re6stnet_service_name
}
is not running. One possible case"
csih_inform
"Service
${
re6stnet_service_name
}
is not running. One possible case"
csih_inform
"is that re6stnet service is shutdown in unusual ways, in this case"
csih_inform
"is that re6stnet service is shutdown in unusual ways, in this case"
...
@@ -530,19 +519,17 @@ if check_re6stnet_needed ; then
...
@@ -530,19 +519,17 @@ if check_re6stnet_needed ; then
csih_error
"Failed to start
${
re6stnet_service_name
}
service."
csih_error
"Failed to start
${
re6stnet_service_name
}
service."
fi
fi
else
else
echo
"N
ative IPv6 found, no taps required."
csih_request
"n
ative IPv6 found, no taps required."
fi
fi
echo
csih_inform
"Configure section taps OK"
echo
Configure section taps OK.
echo
""
echo
# -----------------------------------------------------------
# -----------------------------------------------------------
# tab: Install cron service and create crontab
# tab: Install cron service and create crontab
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
csih_inform
"Starting configure section cron ..."
echo
Starting configure section cron ...
echo
_cron_user
=
${
_administrator
}
_cron_user
=
${
_administrator
}
_crontab_file
=
"/var/cron/tabs/
${
_cron_user
}
"
_crontab_file
=
"/var/cron/tabs/
${
_cron_user
}
"
if
[[
!
-f
${
_crontab_file
}
]]
;
then
if
[[
!
-f
${
_crontab_file
}
]]
;
then
...
@@ -562,22 +549,22 @@ MAILTO=""
...
@@ -562,22 +549,22 @@ MAILTO=""
0 * * * * /opt/slapos/bin/slapos node format >> /opt/slapos/log/slapos-node-format.log 2>&1
0 * * * * /opt/slapos/bin/slapos node format >> /opt/slapos/log/slapos-node-format.log 2>&1
EOF
EOF
fi
fi
echo
Change owner of
${
_crontab_file
}
to
${
_cron_user
}
csih_inform
"change owner of
${
_crontab_file
}
to
${
_cron_user
}
"
chown
${
_cron_user
}
${
_crontab_file
}
chown
${
_cron_user
}
${
_crontab_file
}
echo
Change mode of
${
_crontab_file
}
to 644
csih_inform
"change mode of
${
_crontab_file
}
to 644"
chmod
644
${
_crontab_file
}
chmod
644
${
_crontab_file
}
ls
-l
${
_crontab_file
}
ls
-l
${
_crontab_file
}
echo
csih_inform
"begin of crontab of
${
_administrator
}
:"
echo
Begin of crontab of
${
_administrator
}
:
csih_inform
"************************************************************"
echo
------------------------------------------------------------
cat
${
_crontab_file
}
||
csih_error
"No crob tab found."
cat
${
_crontab_file
}
||
csih_error
"No crob tab found."
echo
------------------------------------------------------------
csih_inform
"************************************************************"
echo
End of crontab of
${
_administrator
}
.
csih_inform
"end of crontab of
${
_administrator
}
"
echo
csih_inform
"Configure section cron OK"
echo
Configure section cron OK.
echo
""
echo
# -----------------------------------------------------------
# -----------------------------------------------------------
# startup: Start slapos-configure when windows startup
# startup: Start slapos-configure when windows startup
...
@@ -597,6 +584,9 @@ echo
...
@@ -597,6 +584,9 @@ echo
# echo Configure section startup OK.
# echo Configure section startup OK.
# echo
# echo
echo
Configure SlapOS successfully.
echo
""
csih_inform
"Configure SlapOS successfully"
echo
""
read
-n
1
-t
60
-p
"Press any key to exit..."
read
-n
1
-t
60
-p
"Press any key to exit..."
exit
0
exit
0
windows/scripts/slapos-cygwin-bootstrip.sh
View file @
659e6633
...
@@ -116,7 +116,7 @@ if ! netsh interface ipv6 show interface | grep -q "\\b${slapos_ifname}\\b" ; th
...
@@ -116,7 +116,7 @@ if ! netsh interface ipv6 show interface | grep -q "\\b${slapos_ifname}\\b" ; th
ipwin
install
$WINDIR
\\
inf
\\
netloop.inf
*
msloop
${
slapos_ifname
}
||
ipwin
install
$WINDIR
\\
inf
\\
netloop.inf
*
msloop
${
slapos_ifname
}
||
csih_error
"install network interface
${
slapos_ifname
}
failed"
csih_error
"install network interface
${
slapos_ifname
}
failed"
fi
fi
ip
-4
addr add
$(
echo
${
ipv4_local_network
}
|
sed
-e
"s%
\.
0/%.1/%g"
)
dev
$
slapos_ifname
||
ip
-4
addr add
$(
echo
${
ipv4_local_network
}
|
sed
-e
"s%
\.
0/%.1/%g"
)
dev
$
{
slapos_ifname
}
||
csih_error
"add ipv4 address failed"
csih_error
"add ipv4 address failed"
csih_inform
"Configure slapos network OK"
csih_inform
"Configure slapos network OK"
...
@@ -129,6 +129,7 @@ csih_inform "Starting configure IPv6 protocol ..."
...
@@ -129,6 +129,7 @@ csih_inform "Starting configure IPv6 protocol ..."
netsh interface ipv6 show interface
>
/dev/null
||
\
netsh interface ipv6 show interface
>
/dev/null
||
\
netsh interface ipv6
install
||
\
netsh interface ipv6
install
||
\
csih_error
"install IPv6 protocol failed"
csih_error
"install IPv6 protocol failed"
csih_inform
"Configure IPv6 protocol OK"
csih_inform
"Configure IPv6 protocol OK"
echo
""
echo
""
...
@@ -231,6 +232,7 @@ csih_inform "************************************************************"
...
@@ -231,6 +232,7 @@ csih_inform "************************************************************"
csih_inform
"Configure slapos client and node OK"
csih_inform
"Configure slapos client and node OK"
echo
""
echo
""
# -----------------------------------------------------------
# -----------------------------------------------------------
# Format slapos node
# Format slapos node
# -----------------------------------------------------------
# -----------------------------------------------------------
...
...
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