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
wget http://www.dashingsoft.com/products/slapos/slapos-patches.tar.gz
tar xzf slapos-patches.tar.gz --no-same-owner
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>
It seems netifaces.dll need to rebase,
<programlisting>
......@@ -213,8 +213,8 @@ After exit cygwin, double click autorebase.bat in the Windows explorer. If the c
<programlisting>
mkdir /opt/git
cd /opt/git
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.core.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
</programlisting>
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
Get re6stnet for cygwin
<programlisting>
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
python setup.py sdist
</programlisting>
......
......@@ -155,8 +155,6 @@ ipv4_local_network=10.201.67.0/24
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_title="SlapOS-Node-Runner-In-Windows"
slaprunner_title="Node Runner"
#-------------------------------------------------
# Create paths
......@@ -279,11 +277,11 @@ fi
interface_guid=$(connection2guid $slapos_ifname) || \
show_error_exit "Failed to get guid of interface: $slapos_ifname."
echo Computer configuration information:
echo \t\tinterface name: $slapos_ifname
echo \t\tGUID: $interface_guid
echo \t\tipv4_local_network: $ipv4_local_network
echo \t\tcomputer_id: $computer_id
echo "Computer configuration information:"
echo " interface name: $slapos_ifname"
echo " GUID: $interface_guid"
echo " ipv4_local_network: $ipv4_local_network"
echo " computer_id: $computer_id"
# generate /etc/slapos/slapos.cfg
sed -i -e "s%^\\s*interface_name.*$%interface_name = $interface_guid%" \
-e "s%^#\?\\s*ipv6_interface.*$%# ipv6_interface =%g" \
......@@ -467,6 +465,9 @@ done
#-------------------------------------------------
# Create instance of Web Runner
#-------------------------------------------------
slaprunner_title="SlapOS-Node-Runner-In-$computer_id"
grep -q "window.location.href" $slapos_runner_file
if (( $? )) ; then
echo
......@@ -490,7 +491,7 @@ if (( $? )) ; then
/opt/slapos/bin/slapos node software --verbose
/opt/slapos/bin/slapos node instance --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
done
# Connection parameters of instance are:
......@@ -499,11 +500,12 @@ if (( $? )) ; then
# 'password_recovery_code': 'e2d01c14',
# 'ssh_command': 'ssh 2001:67c:1254:45::c5d5 -p 2222',
# '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")
echo Got node runner url: $slaprunner_url
[[ -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
<html>
<head><title>SlapOS Web Runner</title>
......
......@@ -26,9 +26,8 @@ function check_cygwin_service()
service_state=$(cygrunsrv --query $service_name | sed -n -e 's/^Current State[ :]*//p')
if [[ ! x$service_state == "xRunning" ]] ; then
echo Cygwin service $1 currnt state is $service_state, try to use
echo \t\tcygrunsrv --start $1
echo to start this service
echo "Cygwin service $1 currnt state is $service_state, try to use"
echo " cygrunsrv --start $1 to start this service"
cygrunsrv --start $1 || show_error_exit "Failed to start service $1"
echo Cygwin $1 service is running.
fi
......@@ -75,6 +74,7 @@ if (( $? )) ; then
echo "Start re6stnet ..."
# It need root rights to install tap-driver
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 &
echo $! > /var/run/slapos-node-re6stnet.pid
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