Commit 7c62a50d authored by Jondy Zhao's avatar Jondy Zhao

Update user-guide document for windows

User need press any key to quit the configure script
parent 5ddfea4e
This diff is collapsed.
......@@ -40,7 +40,13 @@ bin/buildout -v -N
patch_file=/etc/slapos/patches/slapos-core-format.patch
if [[ -f $patch_file ]] ; then
echo "Apply patch: $patch_file"
(cd `ls -d $slapos_home/eggs/slapos.core-*-py2.7.egg` ; \
patch -p1 < $patch_file)
(cd /etc/slapos/patches ; mv $patch_file{,.done})
for x in $(find $slapos_home/eggs -name slapos.core-*.egg ; do
echo Patching $x ...
cd $x
patch --dry-run -p1 < $patch_file && patch -p1 < $patch_file && echo Patch $x OK.
done
fi
echo Build SlapOS successfully.
read -n 1 -p "Press any key to exit..."
exit 0
......@@ -73,7 +73,7 @@ fi
# Copy rebaseall.bat to /
if [[ ! -f /autorebase.bat ]] ; then
echo Create /autorebase.bat
copy <<EOF > /autorebase.bat
cat <<EOF > /autorebase.bat
@echo off
rem Postinstall scripts are always started from the Cygwin root dir
rem so we can just call dash from here
......@@ -99,5 +99,7 @@ for x in $(cygrunsrv --list) ; do
cygrunsrv -R $x
done
echo Run post-install script successfully.
read -n 1 -p "Press any key to exit..."
exit 0
......@@ -30,5 +30,7 @@ for x in $(cygrunsrv --list) ; do
cygrunsrv -R $x
done
echo Run pre-uninstall script successfully.
read -n 1 -p "Press any key to exit..."
exit 0
......@@ -3,10 +3,10 @@
[Setup]
AppName=SlapOS
AppVersion=0.158
AppVerName=SlapOS Windows 0.158.4
AppVerName=SlapOS Windows 0.158.5
DefaultDirName=C:\slapos
DefaultGroupName=SlapOS
OutputBaseFilename=slapos-0.158.4-windows-x86-all-in-one
OutputBaseFilename=slapos-0.158.5-windows-i386-all-in-one
OutputDir=D:\slapos\publish\Output
SourceDir=D:\slapos
Uninstallable=yes
......@@ -55,7 +55,7 @@ Source: "opt\git\slapos.package\windows\scripts\cyg_wscript"; DestDir: "{app}\cy
Source: "opt\git\slapos.package\windows\babeld\babeld.exe"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\git\slapos.package\windows\openvpn\src\openvpn\.libs\openvpn.exe"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\bin\devcon.exe"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\bin\*"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver";
Source: "opt\git\slapos.package\windows\scripts\init-slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
......@@ -73,8 +73,8 @@ Source: "opt\git\slapos.package\windows\docs\README.cygwin"; DestDir: "{app}"; D
[Icons]
Name: "{commondesktop}\SlapOS Desktop"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
Name: "{group}\Command Console"; Filename: "{app}\cygwin\cygtty.bat"; WorkingDir: "{app}\cygwin\opt\slapos"; IconFilename: "{app}\cygwin\etc\slapos\images\terminal.ico";
Name: "{group}\Configure SlapOS"; Filename: "{app}\cygwin\bin\mintty.exe"; Parameters: "-c ~/.minttyrc -h never -t ""Configure SlapOS Node"" /etc/slapos/scripts/slapos-client-config.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\configure.ico";
Name: "{group}\Node Runner"; Filename: "http://{app}\cygwin\etc\slapos\scripts\slap-runner.html"; IconFilename: "{app}\cygwin\etc\slapos\images\manager.ico";
Name: "{group}\Configure SlapOS"; Filename: "{app}\cygwin\bin\mintty.exe"; Parameters: "-c ~/.minttyrc -h never -t ""Configure SlapOS Node"" /etc/slapos/scripts/slapos-configure.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\configure.ico";
Name: "{group}\Node Runner"; Filename: "{app}\cygwin\etc\slapos\scripts\slap-runner.html"; IconFilename: "{app}\cygwin\etc\slapos\images\manager.ico";
Name: "{group}\SlapOS Desktop"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
Name: "{group}\SlapOS Node"; Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/slapos-node.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\node.ico";
Name: "{group}\Uninstall SlapOS"; Filename: "{uninstallexe}";
......@@ -86,7 +86,7 @@ Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scrip
Filename: "{app}\cygwin\autorebase.bat"; WorkingDir: "{app}\cygwin"; Flags: skipifdoesntexist;
[UninstallRun]
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/pre-uninstall.sh"; WorkingDir: "{app}\cygwin\bin"; Flags: skipifdoesntexist runhidden;
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/pre-uninstall.sh"; WorkingDir: "{app}\cygwin\bin"; Flags: skipifdoesntexist;
[UninstallDelete]
Type: filesandordirs; Name: "{app}\cygwin" ;
......
......@@ -24,8 +24,9 @@
#
export PATH=/usr/local/bin:/usr/bin:$PATH
grep -q "export CYGWIN=server" ~/.bash_profie || echo "export CYGWIN=server" >> ~/.bash_profile
grep -q "export CYGWIN=server" ~/.profie || echo "export CYGWIN=server" >> ~/.profile
for myprofile in ~/.bash_profile ~/.profile ; do
grep -q "export CYGWIN=server" $myprofile || echo "export CYGWIN=server" >> $myprofile
done
#-------------------------------------------------
# Common functions
......@@ -153,7 +154,8 @@ slapos_ifname=re6stnet-lo
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_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"
#-------------------------------------------------
......@@ -168,37 +170,35 @@ mkdir -p $slapos_client_home
#-------------------------------------------------
echo Checking cygserver service ...
cygrunsrv --query cygserver > /dev/null
cygrunsrv --query cygserver > /dev/null 2>&1
if (( $? )) ; then
echo Run cygserver-config ...
/usr/bin/cygserver-config --yes || \
show_error_exit "Failed to run cygserver-config"
echo OK.
else
echo The cygserver service has been installed.
fi
echo Checking syslog-ng service ...
cygrunsrv --query syslog-ng > /dev/null
cygrunsrv --query syslog-ng > /dev/null 2>&1
if (( $? )) ; then
echo Run syslog-ng-config ...
/usr/bin/syslog-ng-config --yes || \
show_error_exit "Failed to run syslog-ng-config"
echo OK.
else
echo The syslog-ng service has been installed.
fi
echo Checking cron service ...
cygrunsrv --query cron > /dev/null
if (( $? )) ; then
echo Run cron-config ...
/usr/bin/cron-config --yes || \
show_error_exit "Failed to run cron-config"
echo OK.
else
echo The cron service has been installed.
fi
# echo Checking cron service ...
# cygrunsrv --query cron > /dev/null
# if (( $? )) ; then
# echo Run cron-config ...
# /usr/bin/cron-config --yes || \
# show_error_exit "Failed to run cron-config"
# echo OK.
# else
# echo The cron service has been installed.
# fi
#-------------------------------------------------
# Configure slapos network
......@@ -280,10 +280,10 @@ interface_guid=$(connection2guid $slapos_ifname) || \
show_error_exit "Failed to get guid of interface: $slapos_ifname."
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
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
# generate /etc/slapos/slapos.cfg
sed -i -e "s%^\\s*interface_name.*$%interface_name = $interface_guid%" \
-e "s%^#\?\\s*ipv6_interface.*$%# ipv6_interface =%g" \
......@@ -427,21 +427,57 @@ grep -q "^table " re6stnet.conf || \
grep -q "^# Your subnet: " re6stnet.conf || \
show_error_exit "Error: no subnet found in the /etc/re6stnet/re6stnet.conf"
echo Check re6stnet configuration OK.
echo
#-------------------------------------------------
# Create openvpn tap-windows drivers used by re6stnet
#-------------------------------------------------
# Adding tap-windows driver will break others, so we add all drivers
# here. Get re6stnet client count, then remove extra drivers and add
# required drivers.
#
echo
echo Installing OpenVPN Tap-Windows Driver ...
echo
original_connections=$(echo $(get_all_connections))
client_count=$(sed -n -e "s/^client-count *//p" /etc/re6stnet/re6stnet.conf)
[[ -z $client_count ]] && client_count=10
echo Re6stnet client count = $client_count
re6stnet_name_list="re6stnet-tcp re6stnet-udp"
for (( i=1; i<=client_count; i=i+1 )) ; do
re6stnet_name_list="$re6stnet_name_list re6stnet$i"
done
for re6stnet_ifname in $re6stnet_name_list ; do
echo Checking interface $re6stnet_ifname ...
if [[ ! " $original_connections " == *[\ ]$re6stnet_ifname[\ ]* ]] ; then
echo Installing interface $re6stnet_ifname ...
ip vpntap add dev $re6stnet_ifname || show_error_exit "Failed to install openvpn tap-windows driver."
echo Interface $re6stnet_ifname installed.
else
echo $re6stnet_ifname has been installed.
fi
done
#
# Remove OpenVPN Tap-Windows Driver
#
# ip vpntap del dev re6stnet-x
#
#-------------------------------------------------
# Create instance of Web Runner
#-------------------------------------------------
grep -q "location.reload" $slapos_runner_file
grep -q "window.location.href" $slapos_runner_file
if (( $? )) ; then
echo
echo Installing Web Runner ...
echo
re6stnet_ipv6=$(cat /etc/re6stnet/re6stnet.conf | grep "Your subnet" | \
sed -e "s/^.*subnet: //g" -e "s/ (CN.*\$//g")1
sed -e "s/^.*subnet: //g" -e "s/\/80 (CN.*\$/1/g")
echo "Re6stnet address in this computer: $re6stnet_ipv6"
netsh interface ipv6 show addr $slapos_ifname | grep -q $re6stnet_ipv6 || \
netsh interface ipv6 add addr $slapos_ifname re6stnet_ipv6
netsh interface ipv6 show addr $slapos_ifname level=normal | grep -q $re6stnet_ipv6 || \
netsh interface ipv6 add addr $slapos_ifname $re6stnet_ipv6
echo Run slapformat ...
/opt/slapos/bin/slapos node format -cv --now ||
show_error_exit "Failed to run slapos format."
......@@ -451,29 +487,30 @@ if (( $? )) ; then
/opt/slapos/bin/slapos supply $slaprunner_cfg $computer_id
echo "Request an instance 'Node Runner' ..."
while true ; do
/opt/slapos/bin/slapos node software
/opt/slapos/bin/slapos node instance
/opt/slapos/bin/slapos request $slaprunner_title $slaprunner_cfg --node computer_guid=$computer_id && break
/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
sleep 5
done
# Connection parameters of instance are:
# {'backend_url': 'http://[2001:67c:1254:45::c5d5]:50000',
# 'cloud9-url': 'http://localhost:9999',
# '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 $slaprunner_title \
$slaprunner_cfg --node computer_guid=$computer_id \
| grep backend_url | sed -e "s/^.*': '//g" -e "s/',.*$//g")
slaprunner_url=$(/opt/slapos/bin/slapos request $client_config_file "Node Runner" $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."
echo <<EOF > $slapos_runner_file
cat <<EOF > $slapos_runner_file
<html>
<head><title>SlapOS Web Runner</title>
<script LANGUAGE="JavaScript">
<!--
function openwin() {
location.reload("$slaprunner_url")
window.location.href = "$slaprunner_url"
}
//-->
</script>
......@@ -490,7 +527,7 @@ EOF
for x in $(find /opt/slapgrid/ -name slapos.cookbook-*.egg) ; do
echo Apply to $x
cd $x
patch -p1 < $patch_file
patch --dry-run -p1 < $patch_file && patch -p1 < $patch_file
done
fi
echo
......@@ -501,9 +538,9 @@ fi
#-------------------------------------------------
# Configure crontab
#-------------------------------------------------
cron_file=/var/cron/tabs/$(whoami)
if [[ ! -f $cron_file ]] ; then
cat <<EOF > $cron_file
crontab_file=/var/cron/tabs/$(whoami)
if [[ ! -f $crontab_file ]] ; then
cat <<EOF > $crontab_file
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin
MAILTO=""
......@@ -522,6 +559,7 @@ MAILTO=""
# Make sure we have only good network routes if we use VPN
# * * * * * root if [ -f /etc/opt/slapos/openvpn-needed ]; then ifconfig tapVPN | grep "Scope:Global" > /dev/null ;if [ $? = 0 ]; then ROUTES=$(ip -6 r l | grep default | awk '{print $5}'); for GW in $ROUTES ; do if [ ! $GW = tapVPN ]; then /sbin/ip -6 route del default dev $GW > /dev/null 2>&1;fi ;done ;fi ;fi
EOF
echo Cron file $crontab_file created.
fi
echo SlapOS Node configure successfully.
......
......@@ -23,11 +23,14 @@ function check_cygwin_service()
service_account="$(cygrunsrv -VQ $service_name | sed -n -e 's/^Account[ :]*//p')" || \
show_error_exit "No $1 service install, please run Configure SlapOS to install it."
service_state=$(cygrunsrv --query $service_name | sed -n -e 's/^Current State[ :]*//p')
if [[ ! x$service_state == "xRunning" ]] ; then
echo Warning: Cygwin service $1 currnt state is $service_state, Running is expeted
echo Try to use cygrunsrv --start $1 to start this service
echo Cygwin service $1 currnt state is $service_state, try to use
echo \t\tcygrunsrv --start $1
echo to start this service
cygrunsrv --start $1 || show_error_exit "Failed to start service $1"
echo Cygwin $1 service is running.
fi
echo Check $1 service OVER.
}
......@@ -48,6 +51,12 @@ function show_error_exit()
#-------------------------------------------------
slapos_ifname=re6stnet-lo
#-------------------------------------------------
# Check cygserver, syslog-ng
#-------------------------------------------------
check_cygwin_service cygserver
check_cygwin_service syslog-ng
#-------------------------------------------------
# IPv6 Connection
#-------------------------------------------------
......@@ -58,15 +67,19 @@ check_ipv6_connection
if (( $? )) ; then
echo "No native IPv6."
echo Check re6stnet network ...
which re6stnet > /dev/null || show_error_exit "Error: no re6stnet installed, please run Configure SlapOS first."
which re6stnet > /dev/null 2>&1 || show_error_exit "Error: no re6stnet installed, please run Configure SlapOS first."
# re6st-conf --is-needed --registry http://re6stnet.nexedi.com/
# Check if babeld is running, so we guess whether re6stnet is running or not
ps -ef | grep -q babeld.exe
if (( $? )) ; then
echo "Start re6stnet ..."
# It need root rights to install tap-driver
(cd /etc/re6stnet; re6stnet @re6stnet.conf --ovpnlog -I $slapos_ifname -i $slapos_ifname &)
echo "Start re6stent in the background OK. You can check log files in the /var/log/re6stnet"
cd /etc/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
echo "Start re6stent (pid=$!) in the background OK."
echo "You can check log files in the /var/log/slapos-node-re6stnet.log and /var/log/re6stnet."
echo
echo "Waiting re6stent network work ..."
while true ; do
check_ipv6_connection && break
......@@ -77,35 +90,28 @@ else
echo "Native IPv6 Found."
fi
#-------------------------------------------------
# Check cygserver, syslog-ng
#-------------------------------------------------
check_cygwin_service cygserver
check_cygwin_service syslog-ng
#-------------------------------------------------
# Format slapos node, need root right
#-------------------------------------------------
[[ -f /etc/opt/slapos/slapos.cfg ]] || \
show_error_exit "Error: no node configure file found, please run Configure SlapOS first."
show_error_exit "Error: no node configure file found, please run Configure SlapOS first."
echo "Run Slapos format ..."
echo "Formating SlapOS Node ..."
/opt/slapos/bin/slapos node format -cv --now || \
show_error_exit "Failed to run slapos format."
echo "Format slapos node OK."
#-------------------------------------------------
# Release software
#-------------------------------------------------
echo "Releasing software ..."
/opt/slapos/bin/slapos node software --verbose
/opt/slapos/bin/slapos node software --verbose
#-------------------------------------------------
# Instance software
#-------------------------------------------------
echo "Creating instance ..."
/opt/slapos/bin/slapos node instance --verbose
/opt/slapos/bin/slapos node instance --verbose
#-------------------------------------------------
# Send report
......
......@@ -3,11 +3,11 @@
[Setup]
AppName=SlapOS
AppVersion=0.158
AppVerName=SlapOS Windows 0.158.4
AppVerName=SlapOS Windows 0.158.5
DefaultDirName=C:\slapos
DefaultGroupName=SlapOS
OutputDir=D:\slapos\publish\Output
OutputBaseFilename=slapos-0.158.4-windows-x86
OutputBaseFilename=slapos-0.158.5-windows-i386
SourceDir=D:\slapos
Uninstallable=yes
......@@ -49,7 +49,7 @@ Source: "opt\git\slapos.package\windows\scripts\cyg_wscript"; DestDir: "{app}\cy
Source: "opt\git\slapos.package\windows\babeld\babeld.exe"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\git\slapos.package\windows\openvpn\src\openvpn\.libs\openvpn.exe"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\bin\devcon.exe"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\bin\*"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver";
Source: "opt\git\slapos.package\windows\scripts\init-slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
......@@ -67,8 +67,8 @@ Source: "opt\git\slapos.package\windows\docs\README.cygwin"; DestDir: "{app}"; D
[Icons]
Name: "{commondesktop}\SlapOS Desktop"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
Name: "{group}\Command Console"; Filename: "{app}\cygwin\cygtty.bat"; WorkingDir: "{app}\cygwin\opt\slapos"; IconFilename: "{app}\cygwin\etc\slapos\images\terminal.ico";
Name: "{group}\Configure SlapOS"; Filename: "{app}\cygwin\bin\mintty.exe"; Parameters: "-c ~/.minttyrc -h never -t ""Configure SlapOS Node"" /etc/slapos/scripts/slapos-client-config.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\configure.ico";
Name: "{group}\Node Runner"; Filename: "http://{app}\cygwin\etc\slapos\scripts\slap-runner.html"; IconFilename: "{app}\cygwin\etc\slapos\images\manager.ico";
Name: "{group}\Configure SlapOS"; Filename: "{app}\cygwin\bin\mintty.exe"; Parameters: "-c ~/.minttyrc -h never -t ""Configure SlapOS Node"" /etc/slapos/scripts/slapos-configure.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\configure.ico";
Name: "{group}\Node Runner"; Filename: "{app}\cygwin\etc\slapos\scripts\slap-runner.html"; IconFilename: "{app}\cygwin\etc\slapos\images\manager.ico";
Name: "{group}\SlapOS Desktop"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
Name: "{group}\SlapOS Node"; Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/slapos-node.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\node.ico";
Name: "{group}\Uninstall SlapOS"; Filename: "{uninstallexe}";
......@@ -81,7 +81,7 @@ Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scrip
Filename: "{app}\cygwin\autorebase.bat"; WorkingDir: "{app}\cygwin"; Flags: skipifdoesntexist;
[UninstallRun]
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/pre-uninstall.sh"; WorkingDir: "{app}\cygwin\bin"; Flags: skipifdoesntexist runhidden;
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/pre-uninstall.sh"; WorkingDir: "{app}\cygwin\bin"; Flags: skipifdoesntexist;
[UninstallDelete]
Type: filesandordirs; Name: "{app}\cygwin" ;
......
......@@ -55,6 +55,7 @@ while getopts "Dd:g:G:p:s:r" opt ; do
USER_PASSWORD=$OPTARG
;;
s)
USER_SHELL=$OPTARG
;;
r)
;;
......
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