Commit 5be3ada3 authored by Jondy Zhao's avatar Jondy Zhao

Fix script couldn't repreat run in the user-guide

Fix web runner title is fixed in different computer
parent 2a8f0fbf
...@@ -196,7 +196,7 @@ cd /opt ...@@ -196,7 +196,7 @@ cd /opt
wget http://www.dashingsoft.com/products/slapos/slapos-patches.tar.gz wget http://www.dashingsoft.com/products/slapos/slapos-patches.tar.gz
tar xzf slapos-patches.tar.gz --no-same-owner tar xzf slapos-patches.tar.gz --no-same-owner
cd /opt/slapos/eggs/slapos.core-0.35-py2.7.egg cd /opt/slapos/eggs/slapos.core-0.35-py2.7.egg
patch -p1 < /opt/patches/slapos-core-format.patch patch --dry-run -p1 < /opt/patches/slapos-core-format.patch && patch -p1 < /opt/patches/slapos-core-format.patch
</programlisting> </programlisting>
It seems netifaces.dll need to rebase, It seems netifaces.dll need to rebase,
<programlisting> <programlisting>
...@@ -213,8 +213,8 @@ After exit cygwin, double click autorebase.bat in the Windows explorer. If the c ...@@ -213,8 +213,8 @@ After exit cygwin, double click autorebase.bat in the Windows explorer. If the c
<programlisting> <programlisting>
mkdir /opt/git mkdir /opt/git
cd /opt/git cd /opt/git
git clone -b cygwin http://git.erp5.org/repos/slapos.core.git git pull || git clone -b cygwin http://git.erp5.org/repos/slapos.core.git
git clone -b cygwin http://git.erp5.org/repos/slapos.package.git git pull || git clone -b cygwin http://git.erp5.org/repos/slapos.package.git
cp /opt/git/slapos.package/windows/scripts/* /usr/local/bin cp /opt/git/slapos.package/windows/scripts/* /usr/local/bin
</programlisting> </programlisting>
Then build babeld and openvpn for cygwin, we need use the sources in the slapos.package.git, they are patched for cygwin: Then build babeld and openvpn for cygwin, we need use the sources in the slapos.package.git, they are patched for cygwin:
...@@ -251,7 +251,7 @@ wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.tar.gz -O min ...@@ -251,7 +251,7 @@ wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.tar.gz -O min
Get re6stnet for cygwin Get re6stnet for cygwin
<programlisting> <programlisting>
cd /opt/git cd /opt/git
git clone -b cygwin http://git.erp5.org/repos/re6stnet.git git pull || git clone -b cygwin http://git.erp5.org/repos/re6stnet.git
cd re6stnet cd re6stnet
python setup.py sdist python setup.py sdist
</programlisting> </programlisting>
......
...@@ -155,8 +155,6 @@ ipv4_local_network=10.201.67.0/24 ...@@ -155,8 +155,6 @@ ipv4_local_network=10.201.67.0/24
slapos_runner_file=/etc/slapos/scripts/slap-runner.html slapos_runner_file=/etc/slapos/scripts/slap-runner.html
slaprunner_cfg='http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/slaprunner/software.cfg' slaprunner_cfg='http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/slaprunner/software.cfg'
# slaprunner_title="SlapOS-Node-Runner-In-Windows"
slaprunner_title="Node Runner"
#------------------------------------------------- #-------------------------------------------------
# Create paths # Create paths
...@@ -279,11 +277,11 @@ fi ...@@ -279,11 +277,11 @@ fi
interface_guid=$(connection2guid $slapos_ifname) || \ interface_guid=$(connection2guid $slapos_ifname) || \
show_error_exit "Failed to get guid of interface: $slapos_ifname." show_error_exit "Failed to get guid of interface: $slapos_ifname."
echo Computer configuration information: echo "Computer configuration information:"
echo \t\tinterface name: $slapos_ifname echo " interface name: $slapos_ifname"
echo \t\tGUID: $interface_guid echo " GUID: $interface_guid"
echo \t\tipv4_local_network: $ipv4_local_network echo " ipv4_local_network: $ipv4_local_network"
echo \t\tcomputer_id: $computer_id echo " computer_id: $computer_id"
# generate /etc/slapos/slapos.cfg # generate /etc/slapos/slapos.cfg
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" \
...@@ -467,6 +465,9 @@ done ...@@ -467,6 +465,9 @@ done
#------------------------------------------------- #-------------------------------------------------
# Create instance of Web Runner # Create instance of Web Runner
#------------------------------------------------- #-------------------------------------------------
slaprunner_title="SlapOS-Node-Runner-In-$computer_id"
grep -q "window.location.href" $slapos_runner_file grep -q "window.location.href" $slapos_runner_file
if (( $? )) ; then if (( $? )) ; then
echo echo
...@@ -490,7 +491,7 @@ if (( $? )) ; then ...@@ -490,7 +491,7 @@ if (( $? )) ; then
/opt/slapos/bin/slapos node software --verbose /opt/slapos/bin/slapos node software --verbose
/opt/slapos/bin/slapos node instance --verbose /opt/slapos/bin/slapos node instance --verbose
/opt/slapos/bin/slapos node report --verbose /opt/slapos/bin/slapos node report --verbose
/opt/slapos/bin/slapos request $client_config_file "Node Runner" $slaprunner_cfg --node computer_guid=$computer_id && break /opt/slapos/bin/slapos request $client_config_file $slaprunner_title $slaprunner_cfg --node computer_guid=$computer_id && break
sleep 5 sleep 5
done done
# Connection parameters of instance are: # Connection parameters of instance are:
...@@ -499,11 +500,12 @@ if (( $? )) ; then ...@@ -499,11 +500,12 @@ if (( $? )) ; then
# 'password_recovery_code': 'e2d01c14', # 'password_recovery_code': 'e2d01c14',
# 'ssh_command': 'ssh 2001:67c:1254:45::c5d5 -p 2222', # 'ssh_command': 'ssh 2001:67c:1254:45::c5d5 -p 2222',
# 'url': 'http://softinst39090.host.vifib.net/'} # 'url': 'http://softinst39090.host.vifib.net/'}
slaprunner_url=$(/opt/slapos/bin/slapos request $client_config_file "Node Runner" $slaprunner_cfg --node computer_guid=$computer_id | \ slaprunner_url=$(/opt/slapos/bin/slapos request $client_config_file $slaprunner_title $slaprunner_cfg --node computer_guid=$computer_id | \
grep backend_url | sed -e "s/^.*': '//g" -e "s/',.*$//g") grep backend_url | sed -e "s/^.*': '//g" -e "s/',.*$//g")
echo Got node runner url: $slaprunner_url echo Got node runner url: $slaprunner_url
[[ -z $slaprunner_url ]] && show_error_exit "Failed to create instance of SlapOS Web Runner." [[ -z $slaprunner_url ]] && show_error_exit "Failed to create instance of SlapOS Web Runner."
cp $slapos_runner_file{.html, .html.orig}
cat <<EOF > $slapos_runner_file cat <<EOF > $slapos_runner_file
<html> <html>
<head><title>SlapOS Web Runner</title> <head><title>SlapOS Web Runner</title>
......
...@@ -26,9 +26,8 @@ function check_cygwin_service() ...@@ -26,9 +26,8 @@ function check_cygwin_service()
service_state=$(cygrunsrv --query $service_name | sed -n -e 's/^Current State[ :]*//p') service_state=$(cygrunsrv --query $service_name | sed -n -e 's/^Current State[ :]*//p')
if [[ ! x$service_state == "xRunning" ]] ; then if [[ ! x$service_state == "xRunning" ]] ; then
echo Cygwin service $1 currnt state is $service_state, try to use echo "Cygwin service $1 currnt state is $service_state, try to use"
echo \t\tcygrunsrv --start $1 echo " cygrunsrv --start $1 to start this service"
echo to start this service
cygrunsrv --start $1 || show_error_exit "Failed to start service $1" cygrunsrv --start $1 || show_error_exit "Failed to start service $1"
echo Cygwin $1 service is running. echo Cygwin $1 service is running.
fi fi
...@@ -75,6 +74,7 @@ if (( $? )) ; then ...@@ -75,6 +74,7 @@ if (( $? )) ; then
echo "Start re6stnet ..." echo "Start re6stnet ..."
# It need root rights to install tap-driver # It need root rights to install tap-driver
cd /etc/re6stnet cd /etc/re6stnet
mkdir -p /var/log/re6stnet
re6stnet @re6stnet.conf --ovpnlog -I $slapos_ifname -i $slapos_ifname >> /var/log/re6stnet/slapos-node.log 2>&1 & re6stnet @re6stnet.conf --ovpnlog -I $slapos_ifname -i $slapos_ifname >> /var/log/re6stnet/slapos-node.log 2>&1 &
echo $! > /var/run/slapos-node-re6stnet.pid echo $! > /var/run/slapos-node-re6stnet.pid
disown -h disown -h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment