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
Xiaowu Zhang
slapos.package
Commits
46c238b1
Commit
46c238b1
authored
Jul 09, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove function get_all_connection and connection2guid, both of them
doesn't work in non-english environments.
parent
cc746401
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
45 deletions
+28
-45
windows/scripts/ip
windows/scripts/ip
+1
-2
windows/scripts/pre-uninstall.sh
windows/scripts/pre-uninstall.sh
+1
-1
windows/scripts/slapos-configure.sh
windows/scripts/slapos-configure.sh
+22
-29
windows/scripts/slapos-include.sh
windows/scripts/slapos-include.sh
+4
-13
No files found.
windows/scripts/ip
View file @
46c238b1
...
@@ -327,8 +327,7 @@ function install_tap_driver()
...
@@ -327,8 +327,7 @@ function install_tap_driver()
# check if ifname has been installed
# check if ifname has been installed
if
[[
!
"
$1
"
==
""
]]
;
then
if
[[
!
"
$1
"
==
""
]]
;
then
netsh interface ipv6 show interface |
grep
-q
"
\\
b
$1
\\
b"
if
netsh interface ipv6 show interface |
grep
-q
"
\\
b
$1
\\
b"
;
then
if
((
$?
==
0
))
;
then
echo
"Nothing need to do,
\"
$1
\"
has been installed."
echo
"Nothing need to do,
\"
$1
\"
has been installed."
return
0
return
0
fi
fi
...
...
windows/scripts/pre-uninstall.sh
View file @
46c238b1
...
@@ -45,7 +45,7 @@ for name in $(net user) ; do
...
@@ -45,7 +45,7 @@ for name in $(net user) ; do
if
[[
"x
$name
"
==
x
\*
slapuser
*
]]
;
then
if
[[
"x
$name
"
==
x
\*
slapuser
*
]]
;
then
echo
Remove user:
$name
echo
Remove user:
$name
net user
$name
/delete
net user
$name
/delete
elif
[[
"
$name
"
==
"sshd"
]]
;
then
elif
echo
"
$name
"
|
grep
-q
-E
"(sshd)|(cyg_server)"
;
then
echo
Remove user:
$name
echo
Remove user:
$name
net user
$name
/delete
net user
$name
/delete
fi
fi
...
...
windows/scripts/slapos-configure.sh
View file @
46c238b1
...
@@ -152,18 +152,9 @@ echo
...
@@ -152,18 +152,9 @@ echo
echo
echo
echo
Starting configure slapos network ...
echo
Starting configure slapos network ...
echo
echo
original_connections
=
$(
echo
$(
get_all_connections
))
if
!
netsh interface ipv6 show interface |
grep
-q
"
\\
b
$slapos_ifname
\\
b"
;
then
if
[[
!
"
$original_connections
"
==
*
[
\
]
$slapos_ifname
[
\
]
*
]]
;
then
echo
Installing slapos network adapter ...
echo
Installing slapos network adapter ...
devcon
install
$WINDIR
\\
inf
\\
netloop.inf
*
MSLOOP
ipwin
install
$WINDIR
\\
inf
\\
netloop.inf
*
msloop re6stnet-lo
connection_name
=
$(
get_new_connection
$original_connections
)
[[
"X
$connection_name
"
==
"X"
]]
&&
\
show_error_exit
"Add msloop network adapter failed."
echo
netsh interface
set
interface
name
=
"
$connection_name
"
newname
=
"
$slapos_ifname
"
||
\
show_error_exit
"Failed to rename connection to
$slapos_ifname
."
interface_guid
=
$(
connection2guid
$slapos_ifname
)
||
\
show_error_exit
"Failed to get guid of interface:
$slapos_ifname
."
fi
fi
#ip -4 addr add $ipv4_local_network dev $slapos_ifname
#ip -4 addr add $ipv4_local_network dev $slapos_ifname
# reset_connection $slapos_ifname
# reset_connection $slapos_ifname
...
@@ -195,7 +186,7 @@ echo
...
@@ -195,7 +186,7 @@ echo
show_error_exit
"Failed to create template configure file."
show_error_exit
"Failed to create template configure file."
if
[[
!
-f
$node_certificate_file
]]
;
then
if
[[
!
-f
$node_certificate_file
]]
;
then
read
-p
"Where is computer certificate file
(
/computer.crt): "
filename
read
-p
"Where is computer certificate file
$(
cygpath
-w
/computer.crt
)
: "
filename
[[
-z
"
$filename
"
]]
&&
filename
=
"/computer.crt"
[[
-z
"
$filename
"
]]
&&
filename
=
"/computer.crt"
[[
!
-r
"
$filename
"
]]
&&
\
[[
!
-r
"
$filename
"
]]
&&
\
show_error_exit
"Computer certificate file
$filename
doesn't exists."
show_error_exit
"Computer certificate file
$filename
doesn't exists."
...
@@ -209,7 +200,7 @@ openssl x509 -noout -in $node_certificate_file || \
...
@@ -209,7 +200,7 @@ openssl x509 -noout -in $node_certificate_file || \
show_error_exit
"Invalid computer certificate:
$node_certificate_file
."
show_error_exit
"Invalid computer certificate:
$node_certificate_file
."
if
[[
!
-f
$node_key_file
]]
;
then
if
[[
!
-f
$node_key_file
]]
;
then
read
-p
"Where is computer key file
(
/computer.key): "
filename
read
-p
"Where is computer key file
$(
cygpath
-w
/computer.key
)
: "
filename
[[
-z
"
$filename
"
]]
&&
filename
=
"/computer.key"
[[
-z
"
$filename
"
]]
&&
filename
=
"/computer.key"
[[
!
-f
"
$filename
"
]]
&&
\
[[
!
-f
"
$filename
"
]]
&&
\
show_error_exit
"Key file
$filename
doesn't exists."
show_error_exit
"Key file
$filename
doesn't exists."
...
@@ -219,25 +210,23 @@ if [[ ! -f $node_key_file ]] ; then
...
@@ -219,25 +210,23 @@ if [[ ! -f $node_key_file ]] ; then
else
else
echo
"Found computer key file:
$node_key_file
"
echo
"Found computer key file:
$node_key_file
"
fi
fi
openssl rsa
-noout
-in
$node_key_file
-check
||
\
openssl rsa
-noout
-in
$node_key_file
-check
||
show_error_exit
"Invalid node key:
$node_key_file
."
show_error_exit
"Invalid node key:
$node_key_file
."
if
[[
!
-f
$node_configure_file
]]
;
then
if
[[
!
-f
$node_configure_file
]]
;
then
echo
"Copy computer configure file from
$node_template_file
to
$node_configure_file
"
echo
"Copy 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
[[
-z
$interface_guid
]]
&&
\
interface_guid
=
$(
ipwin guid
*
msloop
$slapos_ifname
)
||
interface_guid
=
$(
sed
-n
-e
"s/^
\\
sinterface_name
\\
s*=
\\
s*//p"
$node_configure_file
)
show_error_exit
"Failed to get guid of interface:
$slapos_ifname
."
[[
-z
$interface_guid
]]
&&
\
[[
"
$interface_guid
"
==
{
*
-
*
-
*
-
*
}
]]
||
interface_guid
=
$(
connection2guid
$slapos_ifname
)
show_error_exit
"Invalid interface guid
$interface_guid
specified."
[[
-z
$interface_guid
]]
&&
\
show_error_exit
"Failed to get guid of interface:
$slapos_ifname
."
computer_guid
=
$(
grep
"CN=COMP"
$node_certificate_file
|
\
computer_guid
=
$(
grep
"CN=COMP"
$node_certificate_file
|
\
sed
-e
"s/^.*, CN=//g"
|
sed
-e
"s%/emailAddress.*
\$
%%g"
)
sed
-e
"s/^.*, CN=//g"
|
sed
-e
"s%/emailAddress.*
\$
%%g"
)
[[
"
$computer_guid
"
==
COMP-+
([
0-9]
)
]]
||
\
[[
"
$computer_guid
"
==
COMP-+
([
0-9]
)
]]
||
show_error_exit
"Invalid computer id '
$computer_guid
' specified."
show_error_exit
"Invalid computer id '
$computer_guid
' specified."
echo
"Computer configuration information:"
echo
"Computer configuration information:"
echo
" interface name:
$slapos_ifname
"
echo
" interface name:
$slapos_ifname
"
...
@@ -257,7 +246,7 @@ sed -i -e "s%^\\s*interface_name.*$%interface_name = $interface_guid%" \
...
@@ -257,7 +246,7 @@ sed -i -e "s%^\\s*interface_name.*$%interface_name = $interface_guid%" \
$node_configure_file
$node_configure_file
if
[[
!
-f
$client_certificate_file
]]
;
then
if
[[
!
-f
$client_certificate_file
]]
;
then
read
-p
"Where is client certificate file
(
/certificate): "
filename
read
-p
"Where is client certificate file
$(
cygpath
-w
/certificate
)
: "
filename
[[
-z
"
$filename
"
]]
&&
filename
=
"/certificate"
[[
-z
"
$filename
"
]]
&&
filename
=
"/certificate"
[[
!
-f
"
$filename
"
]]
&&
\
[[
!
-f
"
$filename
"
]]
&&
\
show_error_exit
"Client certificate file
$filename
doesn't exists."
show_error_exit
"Client certificate file
$filename
doesn't exists."
...
@@ -269,7 +258,7 @@ openssl x509 -noout -in $client_certificate_file || \
...
@@ -269,7 +258,7 @@ openssl x509 -noout -in $client_certificate_file || \
show_error_exit
"Invalid client certificate:
$client_certificate_file
."
show_error_exit
"Invalid client certificate:
$client_certificate_file
."
if
[[
!
-f
$client_key_file
]]
;
then
if
[[
!
-f
$client_key_file
]]
;
then
read
-p
"Where is client key file
(
/key): "
filename
read
-p
"Where is client key file
$(
cygpath
-w
/key
)
: "
filename
[[
-z
"
$filename
"
]]
&&
filename
=
"/key"
[[
-z
"
$filename
"
]]
&&
filename
=
"/key"
[[
!
-f
"
$filename
"
]]
&&
\
[[
!
-f
"
$filename
"
]]
&&
\
show_error_exit
"Key file
$filename
doesn't exists."
show_error_exit
"Key file
$filename
doesn't exists."
...
@@ -306,7 +295,6 @@ if check_re6stnet_needed ; then
...
@@ -306,7 +295,6 @@ if check_re6stnet_needed ; then
echo
echo
echo
Starting configure section taps ...
echo
Starting configure section taps ...
echo
echo
original_connections
=
$(
echo
$(
get_all_connections
))
client_count
=
$(
sed
-n
-e
"s/^client-count *//p"
$re6stnet_configure_file
)
client_count
=
$(
sed
-n
-e
"s/^client-count *//p"
$re6stnet_configure_file
)
[[
-z
"
$client_count
"
]]
&&
client_count
=
10
[[
-z
"
$client_count
"
]]
&&
client_count
=
10
echo
" Client count:
$client_count
"
echo
" Client count:
$client_count
"
...
@@ -314,11 +302,16 @@ re6stnet_name_list="re6stnet-tcp re6stnet-udp"
...
@@ -314,11 +302,16 @@ re6stnet_name_list="re6stnet-tcp re6stnet-udp"
for
((
i
=
1
;
i<
=
client_count
;
i
=
i+1
))
;
do
for
((
i
=
1
;
i<
=
client_count
;
i
=
i+1
))
;
do
re6stnet_name_list
=
"
$re6stnet_name_list
re6stnet
$i
"
re6stnet_name_list
=
"
$re6stnet_name_list
re6stnet
$i
"
done
done
filename
=
$(
cygpath
-w
$openvpn_tap_driver_inf
)
for
name
in
$re6stnet_name_list
;
do
for
name
in
$re6stnet_name_list
;
do
echo
"Checking interface
$name
..."
echo
"Checking interface
$name
..."
if
[[
!
"
$original_connections
"
==
*
[
\
]
$name
[
\
]
*
]]
;
then
if
!
netsh interface ipv6 show interface |
grep
-q
"
\\
b
$name
\\
b"
;
then
[[
-r
$openvpn_tap_driver_inf
]]
||
show_error_exit
"Failed to install OpenVPN Tap-Windows Driver, missing driver inf file:
$filename
"
echo
"Installing interface
$name
..."
echo
"Installing interface
$name
..."
ip vpntap add dev
$name
||
\
# ipwin install \"$filename\" $openvpn_tap_driver_hwid $name; ||
ip vpntap add dev
$name
||
show_error_exit
"Failed to install OpenVPN Tap-Windows Driver."
show_error_exit
"Failed to install OpenVPN Tap-Windows Driver."
echo
"Interface
$name
installed."
echo
"Interface
$name
installed."
else
else
...
...
windows/scripts/slapos-include.sh
View file @
46c238b1
...
@@ -35,6 +35,9 @@ slapos_ifname=re6stnet-lo
...
@@ -35,6 +35,9 @@ slapos_ifname=re6stnet-lo
# Change it if it confilcts with your local network
# Change it if it confilcts with your local network
ipv4_local_network
=
10.201.67.0/24
ipv4_local_network
=
10.201.67.0/24
openvpn_tap_driver_inf
=
/etc/slapos/driver/OemWin2k.inf
openvpn_tap_driver_hwid
=
tap0901
re6stnet_configure_file
=
/etc/re6stnet/re6stnet.conf
re6stnet_configure_file
=
/etc/re6stnet/re6stnet.conf
re6stnet_service_name
=
re6stnet
re6stnet_service_name
=
re6stnet
...
@@ -82,8 +85,7 @@ function check_cygwin_service()
...
@@ -82,8 +85,7 @@ function check_cygwin_service()
function
check_network_configure
()
function
check_network_configure
()
{
{
echo
Checking slapos network ...
echo
Checking slapos network ...
original_connections
=
$(
echo
$(
get_all_connections
))
if
!
netsh interface ipv6 show interface |
grep
-q
"
\\
b
$slapos_ifname
\\
b"
;
then
if
[[
!
"
$original_connections
"
==
*
[
\
]
$slapos_ifname
[
\
]
*
]]
;
then
echo
"Error: No connection name
$slapos_ifname
found, please "
echo
"Error: No connection name
$slapos_ifname
found, please "
echo
"run Configure SlapOS to install it."
echo
"run Configure SlapOS to install it."
return
1
return
1
...
@@ -173,17 +175,6 @@ function reset_slapos_connection()
...
@@ -173,17 +175,6 @@ function reset_slapos_connection()
netsh interface ip
set
address
$ifname
source
=
dhcp
netsh interface ip
set
address
$ifname
source
=
dhcp
}
# === reset_slapos_connection() === #
}
# === reset_slapos_connection() === #
# ======================================================================
# Routine: connection2guid
# Transfer connection name to GUID
# ======================================================================
function
connection2guid
()
{
local
ifname
=
${
1
-re6stnet-lo
}
local
hwid
=
${
2
-*msloop
}
ipwin guid tap0901
$hwid
$ifname
}
# === connection2guid() === #
# ======================================================================
# ======================================================================
# Routine: show_error_exit
# Routine: show_error_exit
# Show error message and wait for user to press any key to exit
# Show error message and wait for user to press any key to exit
...
...
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