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
Alain Takoudjou
slapos.package
Commits
5dd596a2
Commit
5dd596a2
authored
Jun 30, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change windows installer scripts
parent
51a4a9f5
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
550 additions
and
259 deletions
+550
-259
windows/docs/using-slapos-in-windows.xml
windows/docs/using-slapos-in-windows.xml
+69
-87
windows/scripts/post-install.sh
windows/scripts/post-install.sh
+53
-30
windows/scripts/pre-uninstall.sh
windows/scripts/pre-uninstall.sh
+8
-14
windows/scripts/slapos-all-in-one.iss
windows/scripts/slapos-all-in-one.iss
+7
-6
windows/scripts/slapos-configure.sh
windows/scripts/slapos-configure.sh
+291
-83
windows/scripts/slapos-node-runner.sh
windows/scripts/slapos-node-runner.sh
+19
-0
windows/scripts/slapos-node.sh
windows/scripts/slapos-node.sh
+96
-33
windows/scripts/slapos.iss
windows/scripts/slapos.iss
+7
-6
No files found.
windows/docs/using-slapos-in-windows.xml
View file @
5dd596a2
This diff is collapsed.
Click to expand it.
windows/scripts/post-install.sh
View file @
5dd596a2
...
...
@@ -6,47 +6,57 @@
#
# It will do:
#
#
1.
Set uid of Adminstrator to 0, and create root account
#
*
Set uid of Adminstrator to 0, and create root account
#
#
2.
Create .minttyrc and cygtty.bat, which used to start comand console
#
*
Create .minttyrc and cygtty.bat, which used to start comand console
#
#
3. Configure cygserver
#
* Create autorebase.bat, it used to fix cygwin dll problem
#
# 4. Configure syslog-ng
#
if
[[
!
"
$(
whoami
)
"
==
"Administrator"
]]
;
then
exit
1
# * Change readme.txt to dos format
#
password_filename
=
/etc/passwd
echo
Checking passwd file ...
if
[[
!
-f
$password_filename
]]
;
then
echo
No passwd file found.
mkpasswd
>
$password_filename
echo
Generate passwd file OK.
else
echo
Check passwd file OK.
fi
if
[[
!
-f
/etc/passwd
]]
;
then
mkpasswd
>
/etc/passwd
echo
Checking group file ...
if
[[
!
-f
/etc/group
]]
;
then
echo
No group file found.
mkgroup
>
/etc/group
echo
Generate group file OK.
else
cp
/etc/passwd /etc/passwd.orig
echo
Check group file OK.
fi
# sed -i -e "s/Administrator:unused:500:/Administrator:unused:0:/g" /etc/passwd
grep
-q
"^root:"
/etc/passwd
if
((
$?
!=
0
))
;
then
myaccount
=
$(
grep
"^Administrator:"
/etc/passwd |
\
sed
-e
"s/Administrator:unused:500:/root:unused:0:/g"
)
if
[[
"
${
myaccount
:0:4
}
"
==
root
]]
;
then
echo
$myaccount
>>
/etc/passwd
else
exit
1
fi
fi
# grep -q "^root:" $password_filename
# if (( $? != 0 )) ; then
# myaccount=$(grep "^Administrator:" $password_filename | \
# sed -e "s/Administrator:unused:500:/root:unused:0:/g")
# if [[ "${myaccount:0:4}" == root ]] ; then
# echo $myaccount >> $password_filename
# else
# exit 1
# fi
# fi
if
[[
!
-f
~/.minttyrc
]]
;
then
echo
Creating ~/.minttyrc
cat
<<
EOF
> ~/.minttyrc
BoldAsFont=no
Font=Courier New
FontHeight=16
Scrollbar=none
EOF
echo
File ~/.minttyrc created
fi
if
[[
!
-f
/cygtty.bat
]]
;
then
echo
Creating /cygtty.bat
cyghome
=
$(
cygpath
-w
/
)
cat
<<
EOF
> /cygtty.bat
@echo off
...
...
@@ -57,24 +67,37 @@ chdir ${cyghome}\\bin
start mintty.exe -i /Cygwin-Terminal.ico -
EOF
chmod
+x /cygtty.bat
echo
File /cygtty.bat created.
fi
# Configure cygserver
/usr/bin/cygserver-config
--yes
# Configure syslog-ng
/usr/bin/syslog-ng-config
--yes
# Copy rebaseall.bat to /
if
[[
-f
/etc/postinstall/autorebase.bat.done
]]
;
then
cp
/etc/postinstall/autorebase.bat.done /autorebase.bat
if
[[
!
-f
/autorebase.bat
]]
;
then
echo
Create /autorebase.bat
copy
<<
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
path .
\b
in;%path%
dash /bin/rebaseall -p
EOF
chmod
+x /autorebase.bat
echo
/autorebase.bat created.
fi
# Change format of readme.txt
readme_filepath
=
$(
cygpath
-m
/
)
/..
if
[[
-f
$readme_filepath
/Readme.txt
]]
;
then
unix2dos
$readme_filepath
/Readme.txt
echo
Change readme.txt to dos format OK.
fi
# Remove cygwin services to be sure these services will be configured
# in this cygwin enviroments when there are many cygwin instances
# installed in this computer.
for
x
in
$(
cygrunsrv
--list
)
;
do
echo
Removing cygservice
$x
cygrunsrv
-R
$x
done
exit
0
windows/scripts/pre-uninstall.sh
View file @
5dd596a2
#! /bin/bash
#
# When uninstall slapos, it will be called by uninstaller.
# When uninstall slapos, it will be called by uninstaller. Root right
# required to run this script.
#
# /bin/bash/ --login -i pre-uninstall.sh
#
...
...
@@ -8,24 +9,15 @@
#
# 1. Remove virtual netcards installed by re6stnet
#
# 2. Remove service cygserver and syslog-ng
# 2. Remove service c
ron, c
ygserver and syslog-ng
#
if
[[
!
"
$(
whoami
)
"
==
"Administrator"
]]
;
then
exit
1
fi
#
# Remove slapos-init script when windows startup
#
run_key
=
'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
slapos_run_entry
=
SlapOS-Node
regtool
-q
unset
"
$run_key
\\
$slapos_run_entry
"
#
# Remove virtual netcard installed by re6stnet
#
for
ifname
in
$(
netsh interface show interface | gawk
'{ print $3 }'
)
;
do
if
[[
(
"
$ifname
"
==
re6stnet
*
)
&&
(
"
$ifname
"
!=
"re6stnet-lo"
)
]]
;
then
echo
Removing network connection:
$ifname
ip vpntap del dev
$ifname
mode
true
fi
done
...
...
@@ -33,8 +25,10 @@ done
#
# Remove services installed by cygwin
#
cygrunsrv.exe
--remove
syslog-ng
cygrunsrv.exe
--remove
cygserver
for
x
in
$(
cygrunsrv
--list
)
;
do
echo
Removing cygservice
$x
cygrunsrv
-R
$x
done
exit
0
windows/scripts/slapos-all-in-one.iss
View file @
5dd596a2
...
...
@@ -64,6 +64,7 @@ Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app
Source: "opt\git\slapos.package\windows\scripts\build-slapos.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-configure.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-node-runner.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slap-runner.html"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\pre-uninstall.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\docs\using-slapos-in-windows.html"; DestDir: "{app}"; DestName: "user-guide.html";
...
...
@@ -71,18 +72,18 @@ 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}\SlapOS Desktop"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
Name: "{group}\Node Runner"; Filename: "{app}\cygwin\bin\mintty.exe"; Parameters: "-w hide -h never -l /var/log/slapos-node-runner.log /etc/slapos/scripts/slapos-node-runner.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\manager.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}\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 Client"" /etc/slapos/scripts/slapos-client-config.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\configure.ico";
Name: "{group}\User Guide"; Filename: "{app}\user-guide.html";
Name: "{group}\Uninstall SlapOS"; Filename: "{uninstallexe}";
Name: "{group}\User Guide"; Filename: "{app}\user-guide.html";
[Run]
Filename: "{app}\setup-cygwin.bat"; Parameters: """{app}"""; StatusMsg: "Installing Cygwin..."; Flags: runhidden;
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/post-install.sh"; WorkingDir: "{app}\cygwin\bin"; Description: "Configure Cygwin"; StatusMsg: "Configure Cygwin..."; Flags: skipifdoesntexist
runhidden
;
Filename: "{app}\cygwin\autorebase.bat"; WorkingDir: "{app}\cygwin"; Flags: skipifdoesntexist
runhidden
;
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/post-install.sh"; WorkingDir: "{app}\cygwin\bin"; Description: "Configure Cygwin"; StatusMsg: "Configure Cygwin..."; Flags: skipifdoesntexist;
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;
...
...
windows/scripts/slapos-configure.sh
View file @
5dd596a2
This diff is collapsed.
Click to expand it.
windows/scripts/slapos-node-runner.sh
View file @
5dd596a2
...
...
@@ -19,3 +19,22 @@ if [[ -f $current_path/node-runner.vbs ]] ; then
cyg_cscript
$current_path
/node-runner.vbs
||
(
echo
Failed to start slap-runner
;
exit
1
)
echo
Start slap-runner OK.
fi
cat
<<
EOF
> slap-runner.html
d>
<script LANGUAGE="JavaScript">
<!--
function openwin() {
location.reload("url")
}
//-->
</script>
</head>
<body onload="openwin()">
</body>
</html>
EOF
windows/scripts/slapos-node.sh
View file @
5dd596a2
#! /bin/bash
export
PATH
=
/usr/local/bin:/usr/bin:
$PATH
ifname
=
re6stnet-lo
#
# Check ipv6 connection by default ipv6 route
#
function
check_ipv6_connection
()
{
netsh interface ipv6 show route |
grep
-q
" ::/0 "
}
ping6 slap.vifib.com
>
/dev/null
#
# Check cygwin service
#
function
check_cygwin_service
()
{
service_name
=
$1
echo
Checking
$1
service ...
if
[
!
-e
/usr/bin/cygrunsrv.exe
]
;
then
show_error_exit
"No cygserver found, please install the cygrunsrv package first."
fi
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
fi
echo
Check
$1
service OVER.
}
#
# Show error message and waiting for user to press any key quit
#
function
show_error_exit
()
{
msg
=
${
1
-Failed to configure Slapos Node in this computer.
}
echo
$msg
read
-n
1
-p
"Press any key to exit..."
exit
1
}
#-------------------------------------------------
# Constants
#-------------------------------------------------
slapos_ifname
=
re6stnet-lo
#-------------------------------------------------
# IPv6 Connection
#-------------------------------------------------
echo
"Checking native IPv6 ..."
check_ipv6_connection
# Run re6stnet if no native ipv6
if
((
$?
))
;
then
echo
"Start re6stnet ..."
(
cd
/etc/re6stnet
;
re6stnet @re6stnet.conf
--ovpnlog
-I
$ifname
-i
$ifname
&
)
echo
"Start re6stent in the background OK."
echo
"Waiting re6stent network work ..."
while
true
;
do
ping6 slap.vifib.com
&&
break
done
echo
"No native IPv6."
echo
Check re6stnet network ...
which re6stnet
>
/dev/null
||
show_error_exit
"Error: no re6stnet installed, please run Configure SlapOS first."
# re6st-conf --is-needed --registry http://re6stnet.nexedi.com/
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"
echo
"Waiting re6stent network work ..."
while
true
;
do
check_ipv6_connection
&&
break
done
fi
echo
"re6stnet network OK."
else
echo
"Native IPv6 Found."
fi
# Format slapos node
#-------------------------------------------------
# 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 ..."
/opt/slapos/bin/slapos node format
-cv
--now
if
((
$?
))
;
then
echo
"Failed to run slapos format."
exit
1
else
echo
"Format slapos node OK."
fi
/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
if
((
$?
))
;
then
echo
"Failed to relase software in the slapos node."
exit
1
else
echo
"Release software OK."
fi
/opt/slapos/bin/slapos node software
--verbose
#-------------------------------------------------
# Instance software
#-------------------------------------------------
echo
"Creating instance ..."
/opt/slapos/bin/slapos node instance
if
((
$?
))
;
then
echo
"Failed to create instance in the slapos node."
exit
1
else
echo
"Create instance OK."
fi
/opt/slapos/bin/slapos node instance
--verbose
#-------------------------------------------------
# Send report
/opt/slapos/bin/slapos node report
#-------------------------------------------------
echo
"Sending report ..."
/opt/slapos/bin/slapos node report
--verbose
exit
0
windows/scripts/slapos.iss
View file @
5dd596a2
...
...
@@ -58,6 +58,7 @@ Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app
Source: "opt\git\slapos.package\windows\scripts\build-slapos.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-configure.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-node-runner.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slap-runner.html"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\pre-uninstall.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\docs\using-slapos-in-windows.html"; DestDir: "{app}"; DestName: "user-guide.html";
...
...
@@ -65,19 +66,19 @@ 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}\SlapOS Desktop"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
Name: "{group}\Node Runner"; Filename: "{app}\cygwin\bin\mintty.exe"; Parameters: "-w hide -h never -l /var/log/slapos-node-runner.log /etc/slapos/scripts/slapos-node-runner.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\manager.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}\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 Client"" /etc/slapos/scripts/slapos-client-config.sh"; WorkingDir: "{app}\cygwin\bin"; IconFilename: "{app}\cygwin\etc\slapos\images\configure.ico";
Name: "{group}\User Guide"; Filename: "{app}\user-guide.html";
Name: "{group}\Uninstall SlapOS"; Filename: "{uninstallexe}";
Name: "{group}\User Guide"; Filename: "{app}\user-guide.html";
[Run]
Filename: "{app}\setup-cygwin.bat"; Parameters: """{app}"" network"; StatusMsg: "Installing Cygwin..."; Flags: runhidden;
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/post-install.sh"; WorkingDir: "{app}\cygwin\bin"; Description: "Configure Cygwin"; StatusMsg: "Configure Cygwin..."; Flags: skipifdoesntexist
runhidden
;
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/post-install.sh"; WorkingDir: "{app}\cygwin\bin"; Description: "Configure Cygwin"; StatusMsg: "Configure Cygwin..."; Flags: skipifdoesntexist;
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/build-slapos.sh"; WorkingDir: "{app}\cygwin\bin"; Description: "Builout process"; StatusMsg: "Building SlapOS..."; Flags: skipifdoesntexist;
Filename: "{app}\cygwin\autorebase.bat"; WorkingDir: "{app}\cygwin"; Flags: skipifdoesntexist
runhidden
;
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;
...
...
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