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
......@@ -24,13 +24,13 @@
<chapter id="ch_install_slapos"><title>Installing SlapOS node in the Windows</title>
<para>At first, we need to sign up in VIFIB community Cloud by clicking here <ulink url="https://www.slapos.org/login_form"/></para>
<para>Then download the latest slapos windows installer from <ulink url="http://www.erp5.org/dists/installer"></ulink>, the filename of windows installer look like slapos-XXX-windows-x86-all-in-one.exe or slapos-XXX-windows.exe, XXX stands for version-release information. The all-in-one installer include all the files required by slapos node, so it can run in the computer which doesn't access internat; the later will download most of packages from internet and build, so it need more time than all-in-one installer. It's recommanded to use the former installer in case of slow or unstable internet even if the size of all-in-one installer is more than 100MB, compare of the latter which size is about 2MB.</para>
<para>Then download the latest slapos windows installer from <ulink url="http://www.erp5.org/dists/installer"></ulink>, the filename of windows installer look like slapos-XXX-windows-YYY-all-in-one.exe or slapos-XXX-windows-YYY.exe, XXX stands for version-release information. YYY could be i386 or x86_64, the former means 32-bit, the latter 64-bit windows. The all-in-one installer include all the files required by slapos node, so it can run in the computer which doesn't access internat; the later will download most of packages from internet and build, so it need more time than all-in-one installer. It's recommanded to use the former installer in case of slow or unstable internet even if the size of all-in-one installer is more than 100MB, compare of the latter which size is about 2MB.</para>
<para>Double click the installer, click Next, Next ...
<note><para>If the current user isn't Administrator, you need run it as Administrator. Right click the installer, then click Run As Administrator.</para></note>
</para>
<para>At the final wizard page, click Install.</para>
<para>Waiting for everything done.</para>
<para>If you prefer to install slapos node from sources, refer to the chapter <xref linkend="ch_generate_window_installer"/>.</para>
<para>If you prefer to install slapos node from sources, refer to the chapter <xref linkend="ch_run_slapos_from_sources"/>.</para>
</chapter>
<chapter><title>Using Slapos in the Windows</title>
......@@ -44,14 +44,15 @@
<listitem><para>User Guide</para></listitem>
</itemizedlist>
</para>
<section><title>Configure SlapOS</title>
<section id="sec_configure_slapos"><title>Configure SlapOS</title>
<para>It used to generate all the configure files required by slapos slave node, you can run it anytime when you need change the configure of your slapos slave node.</para>
<para>Go to slapos.org (or any other SlapOS Master), register if not already done, go to My Account and request an SSL certificate:
<itemizedlist>
<listitem><para>Copy the certificate in a file, save it in C:/slapos/cygwin/certificate</para></listitem>
<listitem><para>Copy the key in a file, save it in C:/slapos/cygwin/key</para></listitem>
</itemizedlist>
You can save them anywhere, but it's better to save them in the path C:/slapos/cygwin which is your slapos installed, because it's the default path in the slapos configure script. More information refer to <ulink url="http://community.slapos.org/wiki/osoe-Lecture.SlapOS.Extended/developer-Installing.SlapOS.Client"></ulink></para>
You can save them anywhere, but it's better to save them in the path C:/slapos/cygwin which is your slapos installed, because it's the default path in the slapos configure script. </para>
<para>More information refer to <ulink url="http://community.slapos.org/wiki/osoe-Lecture.SlapOS.Extended/developer-Installing.SlapOS.Client"></ulink></para>
<para>Then register your computer to slapos.org community Cloud. By doing so, we will obtain X509 certificate and key which are later needed for the configuration process.
<itemizedlist>
<listitem><para>Login to www.slapos.org. Go to the "My Space" area and then to the "My Servers" section. Click on the button "New Server". This button will lead you to a page where you can specify the name of your server.</para></listitem>
......@@ -73,7 +74,7 @@ The configure script will guide you to configure slapos slave node, as the promp
<listitem><para>Type client certificate filename, if it's stored in the default path as above, type Enter directly</para></listitem>
<listitem><para>Type client key filename, if it's stored in the default path as above, type Enter directly</para></listitem>
</itemizedlist>
Be sure the configure scrip report successfully, otherwise fix the problem and run it again. You can run Slapos Configure at anytime, and netx time you needn't input anything, configure scripts just checks all then configuration and update the configure files.
Be sure the configure scrip report successfully, otherwise fix the problem and run it again. You can run Slapos Configure at anytime, and netx time you needn't input anything, configure scripts just checks all the configuration and update the configure files.
</para>
</section>
......@@ -111,91 +112,6 @@ Be sure the configure scrip report successfully, otherwise fix the problem and r
</section>
</chapter>
<!--
<chapter><title>Create slapos instance of Workpress in the Windows</title>
<para>After SlapOS has been installed successfully, you will find program group "SlapOS" which include the following entries:
Copy our cygwin inotifyx to download-cache/dist, so buildout will find it other than pypi.
</para>
<para>The common way to release a software is to login vifib website. But we haven't integrated this software.cfg into vifib, so we verify it in the local machine. It need a patch:
<programlisting>
$ cd /opt/slapos
$ wget http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/cygwin:/component/slapos/slapgrid-test-local-software.patch
$ cd /opt/slapos/eggs/slapos.core-0.33.1-py2.7.egg
$ patch -p1 &lt; /opt/slapos/slapgrid-test-local-software.patch
</programlisting>
Release Wordpress:
<programlisting>
$ mkdir -p /var/slapgrid/instance
$ mkdir -p /var/slapgrid/software
$ bin/slapgrid - - only_sr http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/cygwin:/software/wordpress/software.cfg /etc/slapos/slapos.cfg
</programlisting>
</para>
<para>Some dlls need to rebase in order to avoid fork issue in the Cygwin. Refer to <ulink url="http://cygwin.com/faq.html"></ulink> question 4.44 or search "rebase" in this page. First, exit all Cygwin processes and stop all Cygwin services.
<programlisting>
$ net stop cfgslapos
$ ps -ef | grep python2.7
# kill all these process which start by supervisord
$ exit
</programlisting>
If you install SlapOS node by MSI package, Click Start menu, select SlapOS program group, click Run rebaseall. Otherwise, download rebase-software.bat and save it in the cygwin root path.
<programlisting>
$ cd /
$ wget http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/cygwin:/component/cygwin/rebase-software.bat
$ exit
</programlisting>
Double click rebase-software.bat in the windows explorer. The file should be in the directory "C:/cygwin"
</para>
<para>Create an instance:
<programlisting>
$ net start cygslapos
$ bin/slapgrid - -only_sr http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/cygwin:/software/wordpress/software.cfg /etc/slapos/slapos.cfg
</programlisting>
Now wordpress should work. Type "http://localhost:8080/index.php" in your browser to check it.</para>
<para>Run the following to show a demo:
$ cd /opt/slapos
$ export SLAPOS_CLIENT_CONFIGURATION=/opt/slapos/slapos-client.cfg
$ echo " demoapp file:///opt/git/slapos/software/demoapp/software.cfg" >> slapos-client.cfg
or
$ echo " demoapp http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/demoapp/software.cfg" >> ~/.slapos/slapos.cfg
$ echo " nodemanager http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/slaprunner/software.cfg" >> ~/.slapos/slapos.cfg
$ bin/slapos node register SlapOS-Windows
Login: jondy
Password:
$ bin/slapos supply demoapp COMP-1500
$ bin/slapos request mydemoapp demoapp - -node computer_guid=COMP-1500
Wait for a while, otherwise there is no partition assigned
$ bin/slapos node software
$ bin/slapos node instance
$ bin/slapos node start all
or
$ bin/slapos node start demoapp
$ bin/slapos node restart all
Recreate instance
$ bin/slapos node instance - -only_cp slappart9
$ bin/slapos request mydemoapp demoapp # not this, it request node in the cloud
Now, you can visit the demo in the browser by the url.
Refer to: http://community.slapos.org/wiki/osoe-Lecture.SlapOS.Extended/developer-Installing.SlapOS.Client
</para>
</chapter>
-->
<chapter id="ch_generate_window_installer"><title>Generating windows installer from sources</title>
<para>This chapter describes how to generate windows installer from sources.</para>
<section><title>Setting Up Cygwin</title>
......@@ -207,19 +123,17 @@ Refer to: http://community.slapos.org/wiki/osoe-Lecture.SlapOS.Extended/develope
<para>Or you can install cygwin by command console, first you need download setup.exe from cygwin.com, save to D:\temp\setup.exe or somewhere else.
<itemizedlist>
<listitem><para>In the Windows destktop, Click Start</para></listitem>
<listitem><para>Click Run, type command: 'cmd', click OK to enter windows console. Be sure you start 'cmd' as Administrator:</para></listitem>
<listitem><para>Click Run, type command: 'cmd', click OK to enter windows console. Be sure you start 'cmd' as Administrator, if the login user isn't Administrator, run 'cmd' as Administrator:</para></listitem>
<listitem><para>Type the following commands:<programlisting>
D:
MD slapos
CD slapos
SET PACKAGES=-P autobuild -P autoconf -P automake -P autossh -P binutils -P bison -P bzip2 -P ca-certificates -P cron -P curl -P cygport -P cygrunsrv -P file -P flex -P gcc4 -P gdbm -P libgdbm-devel -P gettext -P gettext-devel -P libglib2.0-devel -P libglib2.0_0 -P libexpat1 -P libexpat1-devel -P libmpfr-devel -P libmpfr4 -P libtool -P libxml2 -P libxml2-devel -P libxslt -P libxslt-devel -P make -P m4 -P libncurses-devel -P libncursesw-devel -P patch -P patchutils -P pkg-config -P python -P python-setuptools -P openssh -P openssl-devel -P libopenssl098 -P libopenssl100 -P popt -P readline -P libsqlite3-devel -P libsqlite3_0 -P swig -P syslog-ng -P zlib-devel -P vim -P wget
REM If you require docbook-utils indeed, uncomment the next line (remove REM). Refer to <xref linkend="package-docbook-utils"/> to know what about docbook-utils.
REM SET PACKAGES=%PACKAGES% -P docbook-utils
MOVE d:\temp\setup.exe .\
setup.exe %PACKAGES% --no-verify -D -L -l D:\slapos\cygwin-packages -R D:\slapos\cygwin -s http://www.netgull.com/cygwin
</programlisting>Waiting for the installer finished.</para></listitem>
</itemizedlist>
A cygwin icon will be added in the windows desktop, click it to enter cygwin box, then run the following commands:
A cygwin icon will be added in the windows desktop, click it to enter cygwin box. If the current user isn't Administrator, then right click cygwin icon, click Run As Administrator. Be suer you have enough rights to run the following commands:
<!--
You can create your script to start Cygwin in a tty terminal
<programlisting>
......@@ -290,12 +204,10 @@ cp /etc/postinstall/autorebase.bat.done /autorebase.bat
echo Pause >> /autorebase.bat
exit
</programlisting>
After exit cygwin, double click autorebase.bat in the Windows explorer.
After exit cygwin, double click autorebase.bat in the Windows explorer. If the current user isn't Administrator, then right click it, click Run As Administrator.
</para>
</section>
<section><title>Generating windows installer</title>
<section><title>Preparing the sources files for installer</title>
<para>Let's we start cygwin box, then clone slapos.package.git
<programlisting>
......@@ -303,6 +215,7 @@ 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
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:
<programlisting>
......@@ -320,12 +233,12 @@ ac_cv_type_socklen_t=yes IFCONFIG="C:/WINDOWS/system32" LDFLAGS="-liphlpapi -lws
make
cp src/openvpn/.libs/openvpn.exe /usr/local/bin
</programlisting>
Then generate user-guide.html from using-slapos-in-windows.xml, it requires xslt and dockbook, make sure these packages installed in the Cygwin
Then generate user-guide.html from using-slapos-in-windows.xml, generally you need not do this, just copy this file (you're looking now) to /opt/git/slapos.package/windows/docs. If you require want to generate the document by your self, make sure docbook-utils package installed in the Cygwin. Refer to <xref linkend="package-docbook-utils"/> to know what about docbook-utils.
<programlisting>
cd /opt/git/slapos.package/windows/docs
# Before run make, be sure there is the file /usr/share/sgml/docbook/xsl-stylesheets/html/docbook.xsl, if not, find it first
# find /usr -name docbook.xsl
# Then replace the old file name with this one in the Makefile, then run make
# Then replace the old file name with this one in the ./Makefile, then run make
make
</programlisting>
Download pyOpenSSL-0.13.tar.gz, miniupnpc-1.8.tar.gz,
......@@ -373,57 +286,20 @@ Assum SourceDir in the section "Setup" is "D:\slapos", the builder will find "D:
<para>Click menu Build -> Compile, then wait for the building process finished. You can check the installer in the OutputDir.</para>
<para>There is another script "slapos.iss", it used to build network installer. All-in-one installer will include all the files, so no internet access required. However network installer need internet connection to download the files and packages. It's remarkable smaller than all-in-one installer.</para>
</section>
</chapter>
<!--
<section><title>IPv6 Support</title>
<para>If native IPv6 is available, skip this section. Otherwise be sure you have installed IPv6 by the command:
<programlisting>$ netsh interface ipv6 install</programlisting>
</para>
<para>Download openvpn windows installer, for example, openvpn-2.2.1-install.exe, then install openvpn. By default, it installed at <filename>C:\Program Files\OpenVPN</filename></para>
<para>Copy required files of openvpn to /opt/openvpn and edit client.ovpn
<programlisting>
$ mkdir -p /opt/openvpn
$ cd /opt/openvpn
$ cp "C:/Program Files/OpenVPN/bin/*" /opt/openvpn
$ cp -a "C:/Program Files/OpenVPN/config" /opt/openvpn
$ chmod 755 *.exe
$ cd config
$ wget http://www.slapos.org/vifib-ca.crt/getData -O ca.crt
$ http://www.slapos.org/vifib-client.crt/getData -O client-vifib.crt
$ wget http://www.slapos.org/vifib-client.key/getData -O client-vifib.key
$ mv client.ovpn vifib.ovpn
$ vi vifib.ovpn
# Edit the following options
dev tap
proto tcp
remote 176.31.103.87 443
ca ca.crt
cert client-vifib.crt
key client-vifib.key
</programlisting>
re6stnet configure or teredo.
</para>
</section>
<section><title>Run slapformat</title>
<para>Assume we have registered a server which id is 'COMP-161', and saved its key and certificate files in the home directory. So we can use script 'configure.sh' to do all the configuration.
<programlisting>
$ mkdir -p /etc/slapos/ssl
$ mkdir -p /etc/slapos/ssl/partition_pki
$ cd /
$ wget http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/cygwin:/component/cygwin/configure.sh
$ /configure.sh COMP-161 ~/computer.key ~/computer.crt
</programlisting>
</para>
<para>Finally, run slapformat
<chapter id="ch_run_slapos_from_sources"><title>Run SlapOS From Sources</title>
<para>This chapter describes how to run slapos slave node from sources in the windows.</para>
<para>First follow the instructions in the above chapter <xref linkend="ch_generate_window_installer"/>, except the last section Making Installer.</para>
<para>Next register to slapos community to get client and computer certificate and key files, refer to <xref linkend="sec_configure_slapos"/>.</para>
<para>Then open cygwin box as Administrator, if the current user isn't Administrator, then right click cygwin icon, click Run As Administrator. Be suer you have enough rights to run the following commands:
<programlisting>
$ cd /opt/slapos
$ bin/slapformat -c - -now /etc/slapos/slapos.cfg
(cd /opt/downloads; cp pyOpenSSL-0.13.tar.gz miniupnpc-1.8.tar.gz /)
/usr/local/bin/slapos-configure.sh
/usr/local/bin/slapos-node.sh
</programlisting>
If there are some errors when run both of scripts, fix them and run again, until no any error reported, and now you can run any slapos command in this terminal.
</para>
</section>
-->
</section>
</chapter>
<appendix id="appendix_cygwin_packages"><title>Cygwin Required Packages List</title>
......@@ -486,7 +362,7 @@ $ bin/slapformat -c - -now /etc/slapos/slapos.cfg
<listitem><para>Web/wget</para></listitem>
</itemizedlist>
<note id="package-docbook-utils"><para>
There is another package: Text/docbook-utils, it only used to generate user-guide.html from source file. But this package will increase required disk size remarkable, because many dependent packages are installed by Cygwin, so it recommand not to check this package when building slapos source or the installer.</para></note>
There is another package: Text/docbook-utils, it only used to generate user-guide.html from source file. But this package will increase required disk size remarkable, because many dependent packages are installed by Cygwin, so it recommand not to check this package when building slapos source or the installer. Only you really need to build the document, then install this package from cygwin setup gui interface by double clicking setup.exe downloaded from cygwin.com</para></note>
</para>
<!--
<para>
......
......@@ -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.
......
......@@ -26,8 +26,11 @@ function check_cygwin_service()
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,22 +90,15 @@ 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."
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
......
......@@ -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