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
Lisa Casino
slapos.package
Commits
36ac3ca0
Commit
36ac3ca0
authored
Jul 31, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add slapos prefix for slapos windows node
so that it could run multi-instances in one machine
parent
699b5f33
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
154 additions
and
132 deletions
+154
-132
windows/scripts/post-install.sh
windows/scripts/post-install.sh
+35
-33
windows/scripts/pre-uninstall.sh
windows/scripts/pre-uninstall.sh
+55
-42
windows/scripts/slapos-configure.sh
windows/scripts/slapos-configure.sh
+14
-16
windows/scripts/slapos-cron-config
windows/scripts/slapos-cron-config
+28
-27
windows/scripts/slapos-cygwin-bootstrip.sh
windows/scripts/slapos-cygwin-bootstrip.sh
+3
-2
windows/scripts/slapos-include.sh
windows/scripts/slapos-include.sh
+14
-7
windows/scripts/slapos-node.sh
windows/scripts/slapos-node.sh
+5
-5
No files found.
windows/scripts/post-install.sh
View file @
36ac3ca0
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#
#
# When cygwin is installed, then call this script by Administrator:
# When cygwin is installed, then call this script by Administrator:
#
#
# /bin/bash/ --login -i
init-cygwin.sh
# /bin/bash/ --login -i
post-install.sh PREFIX
#
#
# It will do:
# It will do:
#
#
...
@@ -14,28 +14,33 @@
...
@@ -14,28 +14,33 @@
#
#
# * Change readme.txt to dos format
# * Change readme.txt to dos format
#
#
# * Set prefix for this slapos node
#
function
show_error_exit
()
function
show_error_exit
()
{
{
echo
Error:
${
1
-Run post-install script failed.
}
echo
Error:
${
1
-Run post-install script failed.
}
read
-n
1
-p
"Press any key to exit..."
read
-n
1
-p
"Press any key to exit..."
exit
1
exit
1
}
}
readonly
-f
show_error_exit
declare
-r
cyghome
=
$(
cygpath
-w
/
)
declare
-r
cyghome
=
$(
cygpath
-w
/
)
declare
-r
password_filename
=
/etc/passwd
declare
-r
slapos_prefix
=
$1
echo
Checking /etc/passwd ...
_filename
=
/etc/passwd
if
[[
!
-f
${
password_filename
}
]]
;
then
echo
"Checking
${
_filename
}
..."
mkpasswd
-l
>
${
password_filename
}
||
show_error_exit
"Error: mkpasswd failed"
if
[[
!
-f
${
_filename
}
]]
;
then
echo
File /etc/passwd has been generated.
mkpasswd
-l
>
${
_filename
}
||
show_error_exit
"Error: mkpasswd failed"
echo
"
${
_filename
}
has been generated."
else
else
echo
OK.
echo
OK.
fi
fi
echo
Checking /etc/group ...
_filename
=
/etc/group
if
[[
!
-f
/etc/group
]]
;
then
echo
"Checking
${
_filename
}
..."
mkgroup
-l
>
/etc/group
||
show_error_exit
"Error: mkgroup failed"
if
[[
!
-f
${
_filename
}
]]
;
then
echo
File /etc/group has been generated.
mkgroup
-l
>
${
_filename
}
||
show_error_exit
"Error: mkgroup failed"
echo
"
${
_filename
}
has been generated."
else
else
echo
OK.
echo
OK.
fi
fi
...
@@ -51,9 +56,8 @@ fi
...
@@ -51,9 +56,8 @@ fi
# fi
# fi
# fi
# fi
echo
Checking Windows OEM Codepage ...
_charset
=
$(
ipwin codepage
)
||
_charset
=
""
_charset
=
$(
ipwin codepage
)
||
_charset
=
""
echo
Windows OEM Codepage is
${
_charset
}
echo
"Windows OEM Codepage is
${
_charset
}
"
_filename
=
".minttyrc"
_filename
=
".minttyrc"
echo
Checking
${
_filename
}
...
echo
Checking
${
_filename
}
...
...
@@ -66,7 +70,7 @@ Scrollbar=none
...
@@ -66,7 +70,7 @@ Scrollbar=none
Locale=C
Locale=C
Charset=
${
_charset
}
Charset=
${
_charset
}
EOF
EOF
echo
File
${
_filename
}
has been generated.
echo
"
${
_filename
}
has been generated."
else
else
echo
OK.
echo
OK.
fi
fi
...
@@ -83,7 +87,7 @@ chdir ${cyghome}\\bin
...
@@ -83,7 +87,7 @@ chdir ${cyghome}\\bin
start mintty.exe -i /Cygwin-Terminal.ico -
start mintty.exe -i /Cygwin-Terminal.ico -
EOF
EOF
chmod
+x
${
_filename
}
chmod
+x
${
_filename
}
echo
File
${
_filename
}
has been generated.
echo
"
${
_filename
}
has been generated."
else
else
echo
OK.
echo
OK.
fi
fi
...
@@ -108,7 +112,7 @@ path .\bin;%path%
...
@@ -108,7 +112,7 @@ path .\bin;%path%
dash /bin/rebaseall -T /myfile.list -v
dash /bin/rebaseall -T /myfile.list -v
EOF
EOF
chmod
+x
${
_filename
}
chmod
+x
${
_filename
}
echo
File
${
_filename
}
has been generated.
echo
"
${
_filename
}
has been generated."
else
else
echo
OK.
echo
OK.
fi
fi
...
@@ -116,60 +120,58 @@ fi
...
@@ -116,60 +120,58 @@ fi
# Change format of readme.txt
# Change format of readme.txt
_filename
=
$(
cygpath
-u
$(
cygpath
-m
/
)
/../readme.txt
)
_filename
=
$(
cygpath
-u
$(
cygpath
-m
/
)
/../readme.txt
)
if
[[
-f
${
_filename
}
]]
;
then
if
[[
-f
${
_filename
}
]]
;
then
echo
Changing
$(
cygpath
-w
${
_filename
}
)
as dos format ...
echo
"Changing
$(
cygpath
-w
${
_filename
}
)
as dos format ..."
unix2dos
${
_filename
}
&&
echo
OK.
unix2dos
${
_filename
}
&&
echo
OK.
fi
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
name
in
$(
cygrunsrv
--list
)
;
do
echo
Removing
$name
service
cygrunsrv
-R
$name
||
show_error_exit
echo
OK.
done
# Backup slap-runner.html
# Backup slap-runner.html
_filename
=
/etc/slapos/scripts/slap-runner.html
_filename
=
/etc/slapos/scripts/slap-runner.html
if
[[
-r
${
_filename
}
]]
;
then
if
[[
-r
${
_filename
}
]]
;
then
echo
Backuping
${
_filename
}
as
${
_filename
}
.orig
echo
"Backuping
${
_filename
}
as
${
_filename
}
.orig"
cp
${
_filename
}
{
,.orig
}
&&
echo
OK.
cp
${
_filename
}
{
,.orig
}
&&
echo
OK.
else
else
echo
Warning: Missing
${
_filename
}
echo
"Warning: missing
${
_filename
}
"
fi
fi
# Unzip slapos.tar.gz
# Unzip slapos.tar.gz
_filename
=
/opt/downloads/slapos.tar.gz
_filename
=
/opt/downloads/slapos.tar.gz
if
[[
-r
${
_filename
}
]]
;
then
if
[[
-r
${
_filename
}
]]
;
then
echo
Extracting
${
_filename
}
...
echo
"Extracting
${
_filename
}
..."
(
cd
/opt
;
tar
xzf
${
_filename
}
--no-same-owner
)
||
show_error_exit
(
cd
/opt
;
tar
xzf
${
_filename
}
--no-same-owner
)
||
show_error_exit
echo
OK.
echo
OK.
elif
[[
!
-d
/opt/slapos
]]
;
then
elif
[[
!
-d
/opt/slapos
]]
;
then
echo
Warning: Missing
${
_filename
}
echo
"Warning: missing
${
_filename
}
"
fi
fi
# Patch cygport, so that we can specify package prefix by ourself.
# Patch cygport, so that we can specify package prefix by ourself.
_filename
=
/usr/bin/cygport
_filename
=
/usr/bin/cygport
if
[[
-f
${
_filename
}
]]
;
then
if
[[
-f
${
_filename
}
]]
;
then
echo
Patching
${
_filename
}
...
echo
"Patching
${
_filename
}
..."
sed
-i
-e
's/D="${workdir}\/inst"/D="${CYGCONF_PREFIX-${workdir}\/inst}"/g'
${
_filename
}
&&
sed
-i
-e
's/D="${workdir}\/inst"/D="${CYGCONF_PREFIX-${workdir}\/inst}"/g'
${
_filename
}
&&
echo
OK.
echo
OK.
fi
fi
_filename
=
/usr/share/cygport/cygclass/autotools.cygclass
_filename
=
/usr/share/cygport/cygclass/autotools.cygclass
if
[[
-f
${
_filename
}
]]
;
then
if
[[
-f
${
_filename
}
]]
;
then
echo
Patching
${
_filename
}
...
echo
"Patching
${
_filename
}
..."
sed
-i
-e
's/prefix=$(__host_prefix)/prefix=${CYGCONF_PREFIX-$(__host_prefix)}/g'
${
_filename
}
&&
sed
-i
-e
's/prefix=$(__host_prefix)/prefix=${CYGCONF_PREFIX-$(__host_prefix)}/g'
${
_filename
}
&&
echo
OK.
echo
OK.
fi
fi
_filename
=
/usr/share/cygport/cygclass/cmake.cygclass
_filename
=
/usr/share/cygport/cygclass/cmake.cygclass
if
[[
-f
${
_filename
}
]]
;
then
if
[[
-f
${
_filename
}
]]
;
then
echo
Patching
${
_filename
}
...
echo
"Patching
${
_filename
}
..."
sed
-i
-e
's/-DCMAKE_INSTALL_PREFIX=$(__host_prefix)/-DCMAKE_INSTALL_PREFIX=${CYGCONF_PREFIX-$(__host_prefix)}/g'
${
_filename
}
&&
sed
-i
-e
's/-DCMAKE_INSTALL_PREFIX=$(__host_prefix)/-DCMAKE_INSTALL_PREFIX=${CYGCONF_PREFIX-$(__host_prefix)}/g'
${
_filename
}
&&
echo
OK.
echo
OK.
fi
fi
# Set prefix for slapos
if
[[
-n
${
slapos_prefix
}
]]
;
then
echo
"Set slapos prefix as
${
slapos_prefix
}
"
sed
-i
-e
"s%slapos_prefix=.*
\$
%slapos_prefix=
${
slapos_prefix
}
"
\
/etc/slapos/scripts/pre-uninstall.sh /etc/slapos/scripts/slapos-include.sh
fi
echo
echo
echo
Run post-install.sh script successfully.
echo
"Run post-install.sh script successfully."
echo
echo
read
-n
1
-t
60
-p
"Press any key to exit..."
read
-n
1
-t
60
-p
"Press any key to exit..."
exit
0
exit
0
windows/scripts/pre-uninstall.sh
View file @
36ac3ca0
...
@@ -15,18 +15,46 @@
...
@@ -15,18 +15,46 @@
#
#
# * Remove instance root /srv/slapgrid
# * Remove instance root /srv/slapgrid
#
#
# Required:
# grep gawk TASKKILL
#
export
PATH
=
/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:
$PATH
export
PATH
=
/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:
$PATH
function
slapos_kill_process
()
{
name
=
$1
echo
"Try to kill all
$name
..."
for
pid
in
$(
ps |
grep
"
$name
"
| gawk
'{print $4}'
)
;
do
echo
"Kill pid
$pid
"
TASKKILL /F /T /PID
$pid
done
}
read
-f
slapos_kill_process
#
# Declare variables
#
declare
-r
slapos_prefix
=
declare
-r
slapos_administrator
=
${
slapos_prefix
:slap
}
root
declare
-r
slapos_user_basename
=
${
slapos_prefix
:slap
}
user
declare
-r
slapos_ifname
=
${
slapos_prefix
}
re6stnet-lo
declare
-r
re6stnet_service_name
=
${
slapos_prefix
}
re6stnet
declare
-r
cron_service_name
=
${
slapos_prefix
}
cron
declare
-r
ssh_service_name
=
${
slapos_prefix
}
ssh
declare
-r
syslog_service_name
=
${
slapos_prefix
}
syslog-ng
declare
-r
cygserver_service_name
=
${
slapos_prefix
}
cygserver
#
#
# Remove services installed by cygwin,
# Remove services installed by cygwin,
#
#
echo
Try to stop re6stnet service ...
echo
"Try to stop service
${
re6stnet_service_name
}
..."
if
!
net stop re6stnet
;
then
net stop
${
re6stnet_service_name
}
||
echo
Try to
kill
openvpn process ...
slapos_kill_process /usr/bin/openvpn
ps
-ef
|
grep
-q
"/usr/bin/openvpn"
&&
TASKKILL /IM openvpn.exe /F
&&
echo
OK.
fi
for
name
in
${
re6stnet_service_name
}
${
cron_service_name
}
\
for
name
in
$(
cygrunsrv
--list
)
;
do
${
ssh_service_name
}
${
syslog_service_name
}
\
echo
Removing cygservice
$name
${
cygserver_service_name
}
;
do
echo
"Removing ervice
$name
"
cygrunsrv
-R
$name
&&
echo
OK.
cygrunsrv
-R
$name
&&
echo
OK.
done
done
...
@@ -34,35 +62,27 @@ done
...
@@ -34,35 +62,27 @@ done
# Stop slapos
# Stop slapos
#
#
if
[[
-x
/opt/slapos/bin/slapos
]]
;
then
if
[[
-x
/opt/slapos/bin/slapos
]]
;
then
echo
Stoping slapos node ...
echo
"Stoping slapos node ..."
/opt/slapos/bin/slapos node stop all
&&
echo
OK.
/opt/slapos/bin/slapos node stop all
&&
echo
OK.
fi
fi
echo
Try to
kill
python2.7 process ...
slapos_kill_process /usr/bin/python2.7
ps
-ef
|
grep
-q
"/usr/bin/python2.7"
&&
TASKKILL /IM python2.7.exe /F
&&
echo
OK.
#
#
# Remove virtual netcard installed by
re6stnet
# Remove virtual netcard installed by
slapos
#
#
for
ifname
in
$(
netsh interface ipv6 show interface | gawk
'{ print $5 }'
)
;
do
echo
"Removing network connection
${
slapos_ifname
}
"
if
[[
"
$ifname
"
==
"re6stnet-lo"
]]
;
then
ipwin remove
*
msloop
${
slapos_ifname
}
&&
echo
OK.
echo
Removing network connection:
$ifname
ipwin remove
*
msloop re6stnet-lo
&&
echo
OK.
elif
[[
"
$ifname
"
==
re6stnet
*
]]
;
then
echo
Removing network connection:
$ifname
ipwin remove tap0901
$ifname
&&
echo
OK.
fi
done
#
#
# Remove users installed by slapos
node
# Remove users installed by slapos
#
#
for
name
in
$(
net user
)
;
do
for
_name
in
$(
NET USER
)
;
do
if
[[
"
x
$name
"
==
x
\*
slapuser
*
]]
;
then
if
[[
"
${
_name
}
"
==
${
slapos_user_basename
}
*
]]
;
then
echo
Removing user:
$name
echo
"Removing user:
${
_name
}
"
net user
$name
/delete
&&
echo
OK.
NET USER
${
_name
}
/DELETE
&&
echo
OK.
elif
echo
"
$
name
"
|
grep
-q
-E
"(sshd)|(cyg_server)|(slaproot
)"
;
then
elif
echo
"
$
{
_name
}
"
|
grep
-q
-E
"(sshd)|(cyg_server)|(
${
slapos_administrator
}
)"
;
then
echo
Removing user:
$name
echo
"Removing user:
${
_name
}
"
net user
$name
/delete
&&
echo
OK.
NET USER
${
_name
}
/DELETE
&&
echo
OK.
fi
fi
done
done
echo
"Creating /etc/passwd ..."
echo
"Creating /etc/passwd ..."
...
@@ -71,10 +91,10 @@ mkpasswd -l > /etc/passwd && echo OK.
...
@@ -71,10 +91,10 @@ mkpasswd -l > /etc/passwd && echo OK.
#
#
# Remove local group installed by slapos node
# Remove local group installed by slapos node
#
#
for
name
in
$(
net localgroup
|
sed
-n
-e
"s/^*//p"
|
sed
-e
"s/
\\
s//g"
)
;
do
for
_name
in
$(
NET LOCALGROUP
|
sed
-n
-e
"s/^*//p"
|
sed
-e
"s/
\\
s//g"
)
;
do
if
[[
"
$
name
"
==
grp_slapuser
*
]]
;
then
if
[[
"
$
{
_name
}
"
==
grp_
${
slapos_user_basename
}
*
]]
;
then
echo
Removing localgroup:
$name
echo
"Removing localgroup:
${
_name
}
"
net localgroup
$name
/delete
&&
echo
OK.
NET LOCALGROUP
${
_name
}
/DELETE
&&
echo
OK.
fi
fi
done
done
echo
"Creating /etc/group ..."
echo
"Creating /etc/group ..."
...
@@ -91,16 +111,9 @@ rm -rf ~/.slapos && echo OK.
...
@@ -91,16 +111,9 @@ rm -rf ~/.slapos && echo OK.
#
#
# Remove crontab
# Remove crontab
#
#
echo
Removing /var/cron/tabs/slaproot
_filename
=
/var/cron/tabs/
${
slapos_administrator
}
rm
-rf
/var/cron/tabs/slaproot
&&
echo
OK.
echo
"Removing
${
_filename
}
"
rm
-rf
${
_filename
}
&&
echo
OK.
#
# Remove slapos-configure from windows startup item
#
slapos_run_key
=
'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
slapos_run_entry
=
slapos-configure
echo
Removing startup item
"
$slapos_run_key
\\
$slapos_run_entry
"
regtool
-q
unset
"
$slapos_run_key
\\
$slapos_run_entry
"
&&
echo
OK.
#
#
# Remove default instance root, because it belong to slapuser, and
# Remove default instance root, because it belong to slapuser, and
...
...
windows/scripts/slapos-configure.sh
View file @
36ac3ca0
...
@@ -31,7 +31,6 @@ function show_usage()
...
@@ -31,7 +31,6 @@ function show_usage()
echo
""
echo
""
echo
" Availabe options:"
echo
" Availabe options:"
echo
""
echo
""
echo
" -U, --user=XXX slapos administrator, default is slaproot"
echo
" -P, --password=XXX password of administrator"
echo
" -P, --password=XXX password of administrator"
echo
""
echo
""
echo
" --computer-certificate=FILENAME"
echo
" --computer-certificate=FILENAME"
...
@@ -65,7 +64,7 @@ echo ""
...
@@ -65,7 +64,7 @@ echo ""
# -----------------------------------------------------------
# -----------------------------------------------------------
# Local variable
# Local variable
# -----------------------------------------------------------
# -----------------------------------------------------------
declare
_administrator
=
${
slapos_
use
r
}
declare
_administrator
=
${
slapos_
administrato
r
}
declare
_password
=
declare
_password
=
declare
_computer_certificate
=
declare
_computer_certificate
=
declare
_computer_key
=
declare
_computer_key
=
...
@@ -90,9 +89,6 @@ while test $# -gt 0; do
...
@@ -90,9 +89,6 @@ while test $# -gt 0; do
_password
=
$2
_password
=
$2
shift
shift
;;
;;
--user
=
*
)
_administrator
=
$optarg
;;
-P
)
-P
)
_administrator
=
$2
_administrator
=
$2
shift
shift
...
@@ -168,25 +164,25 @@ csih_error "failed to create account ${_administrator}."
...
@@ -168,25 +164,25 @@ csih_error "failed to create account ${_administrator}."
# Configure cygwin services: cygserver syslog-ng sshd
# Configure cygwin services: cygserver syslog-ng sshd
# -----------------------------------------------------------
# -----------------------------------------------------------
csih_inform
"Starting configure cygwin services ..."
csih_inform
"Starting configure cygwin services ..."
if
!
cygrunsrv
--query
cygserver
>
/dev/null 2>&1
;
then
if
!
cygrunsrv
--query
${
cygserver_service_name
}
>
/dev/null 2>&1
;
then
csih_inform
"run cygserver-config ..."
csih_inform
"run cygserver-config ..."
/usr/bin/cygserver-config
--yes
||
\
/usr/bin/cygserver-config
--yes
||
\
csih_error
"failed to run cygserver-config"
csih_error
"failed to run cygserver-config"
else
else
csih_inform
"the cygserver service has been installed"
csih_inform
"the cygserver service has been installed"
fi
fi
check_cygwin_service
cygserver
check_cygwin_service
${
cygserver_service_name
}
if
!
cygrunsrv
--query
syslog-ng
>
/dev/null 2>&1
;
then
if
!
cygrunsrv
--query
${
syslog_service_name
}
>
/dev/null 2>&1
;
then
csih_inform
"run syslog-ng-config ..."
csih_inform
"run syslog-ng-config ..."
/usr/bin/syslog-ng-config
--yes
||
\
/usr/bin/syslog-ng-config
--yes
||
\
csih_error
"failed to run syslog-ng-config"
csih_error
"failed to run syslog-ng-config"
else
else
csih_inform
"the syslog-ng service has been installed"
csih_inform
"the syslog-ng service has been installed"
fi
fi
check_cygwin_service
syslog-ng
check_cygwin_service
${
syslog_service_name
}
if
!
cygrunsrv
--query
sshd
>
/dev/null 2>&1
;
then
if
!
cygrunsrv
--query
${
sshd_service_name
}
>
/dev/null 2>&1
;
then
if
csih_is_xp
&&
[[
-z
"
${
csih_PRIVILEGED_PASSWORD
}
"
]]
;
then
if
csih_is_xp
&&
[[
-z
"
${
csih_PRIVILEGED_PASSWORD
}
"
]]
;
then
slapos_request_password
${
_administrator
}
"Install sshd service need the password of
${
_administrator
}
."
slapos_request_password
${
_administrator
}
"Install sshd service need the password of
${
_administrator
}
."
fi
fi
...
@@ -197,10 +193,10 @@ if ! cygrunsrv --query sshd > /dev/null 2>&1 ; then
...
@@ -197,10 +193,10 @@ if ! cygrunsrv --query sshd > /dev/null 2>&1 ; then
else
else
csih_inform
"the sshd service has been installed"
csih_inform
"the sshd service has been installed"
fi
fi
check_cygwin_service
sshd
check_cygwin_service
${
sshd_service_name
}
# Use slapos-cron-config to configure slapos cron service.
# Use slapos-cron-config to configure slapos cron service.
if
!
cygrunsrv
--query
cron
>
/dev/null 2>&1
;
then
if
!
cygrunsrv
--query
${
cron_service_name
}
>
/dev/null 2>&1
;
then
[[
-x
${
slapos_cron_config
}
]]
||
[[
-x
${
slapos_cron_config
}
]]
||
csih_error
"Couldn't find slapos cron config script:
${
slapos_cron_config
}
"
csih_error
"Couldn't find slapos cron config script:
${
slapos_cron_config
}
"
...
@@ -214,7 +210,7 @@ if ! cygrunsrv --query cron > /dev/null 2>&1 ; then
...
@@ -214,7 +210,7 @@ if ! cygrunsrv --query cron > /dev/null 2>&1 ; then
else
else
csih_inform
"the cron service has been installed"
csih_inform
"the cron service has been installed"
fi
fi
check_cygwin_service
cron
check_cygwin_service
${
cron_service_name
}
csih_inform
"Configure cygwin services OK"
csih_inform
"Configure cygwin services OK"
echo
""
echo
""
...
@@ -314,9 +310,10 @@ csih_error "Invalid computer id '$computer_guid' specified."
...
@@ -314,9 +310,10 @@ csih_error "Invalid computer id '$computer_guid' specified."
csih_inform
"Computer configuration information:"
csih_inform
"Computer configuration information:"
csih_inform
" interface name:
${
slapos_ifname
}
"
csih_inform
" interface name:
${
slapos_ifname
}
"
csih_inform
" GUID:
$interface_guid
"
csih_inform
" GUID:
${
interface_guid
}
"
csih_inform
" ipv4_local_network:
$ipv4_local_network
"
csih_inform
" ipv4_local_network:
${
ipv4_local_network
}
"
csih_inform
" computer_id:
$computer_guid
"
csih_inform
" computer_id:
${
computer_guid
}
"
csih_inform
" user_base_name:
${
slapos_user_basename
}
"
csih_inform
csih_inform
csih_inform
" If ipv4_local_network confilcts with your local network, change it"
csih_inform
" If ipv4_local_network confilcts with your local network, change it"
csih_inform
" in the file:
${
node_configure_file
}
"
csih_inform
" in the file:
${
node_configure_file
}
"
...
@@ -327,6 +324,7 @@ sed -i -e "s%^\\s*interface_name.*$%interface_name = $interface_guid%" \
...
@@ -327,6 +324,7 @@ 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"
\
-e
"s%^ipv4_local_network.*
$%
ipv4_local_network =
$ipv4_local_network
%"
\
-e
"s%^ipv4_local_network.*
$%
ipv4_local_network =
$ipv4_local_network
%"
\
-e
"s%^computer_id.*
$%
computer_id =
$computer_guid
%"
\
-e
"s%^computer_id.*
$%
computer_id =
$computer_guid
%"
\
-e
"s%^user_base_name =.*
$%
user_base_name =
${
slapos_user_basename
}
%"
\
${
node_configure_file
}
${
node_configure_file
}
if
[[
!
-f
${
client_certificate_file
}
]]
;
then
if
[[
!
-f
${
client_certificate_file
}
]]
;
then
...
...
windows/scripts/slapos-cron-config
View file @
36ac3ca0
...
@@ -240,7 +240,7 @@ check_passwd_and_group() {
...
@@ -240,7 +240,7 @@ check_passwd_and_group() {
# ======================================================================
# ======================================================================
# Routine: check_user
# Routine: check_user
# Check to see that the specified user exists once in /etc/passwd
# Check to see that the specified user exists once in /etc/passwd
# ======================================================================
# ======================================================================
check_user
()
{
check_user
()
{
count
=
$(
grep
-ic
"^
$1
:"
/etc/passwd
)
count
=
$(
grep
-ic
"^
$1
:"
/etc/passwd
)
...
@@ -269,7 +269,7 @@ check_dir_perms() {
...
@@ -269,7 +269,7 @@ check_dir_perms() {
echo
"Your computer is missing
$1
"
.
echo
"Your computer is missing
$1
"
.
echo
echo
return
1
return
1
fi
fi
if
ls
-ld
"
$1
"
|
grep
-q
^
"
$2
"
;
then
if
ls
-ld
"
$1
"
|
grep
-q
^
"
$2
"
;
then
true
true
...
@@ -396,8 +396,8 @@ check_cron_table() {
...
@@ -396,8 +396,8 @@ check_cron_table() {
echo
echo
[
"
$couldbeFAT
"
=
1
]
&&
[
"
$couldbeFAT
"
=
1
]
&&
echo
"This rule does not apply on FAT/FAT32 file systems."
echo
"This rule does not apply on FAT/FAT32 file systems."
echo
"This rule does not apply if the daemon runs with nontsec."
echo
"This rule does not apply if the daemon runs with nontsec."
echo
echo
echo
"You can change the group membership setting with:"
echo
"You can change the group membership setting with:"
echo
" chgrp
$ADMINSGID
$cron_table
"
echo
" chgrp
$ADMINSGID
$cron_table
"
echo
"Please change your cron table's group membership."
echo
"Please change your cron table's group membership."
...
@@ -474,7 +474,7 @@ get_temp_dir() {
...
@@ -474,7 +474,7 @@ get_temp_dir() {
echo
"ERROR: Cannot find a temporary directory."
echo
"ERROR: Cannot find a temporary directory."
TEMP_DIR
=
/tmp
TEMP_DIR
=
/tmp
}
# === End of get_temp_dir() === #
}
# === End of get_temp_dir() === #
# ======================================================================
# ======================================================================
# Routine: cron_diagnose
# Routine: cron_diagnose
# Checks the environment.
# Checks the environment.
...
@@ -511,9 +511,9 @@ cron_diagnose() {
...
@@ -511,9 +511,9 @@ cron_diagnose() {
check_dir_perms /var d..x..x..x
||
ret
=
1
check_dir_perms /var d..x..x..x
||
ret
=
1
# There is no reason to have t on /var/cron,
# There is no reason to have t on /var/cron,
# but it used to be set that way.
# but it used to be set that way.
check_dir_perms /var/cron d..x..x..[xt]
||
ret
=
1
check_dir_perms /var/cron d..x..x..[xt]
||
ret
=
1
check_dir_perms /var/cron/tabs drwxrwxrwt
||
ret
=
1
check_dir_perms /var/cron/tabs drwxrwxrwt
||
ret
=
1
# Check write access to /var/run, to create cron_pid
# Check write access to /var/run, to create cron_pid
...
@@ -525,7 +525,7 @@ cron_diagnose() {
...
@@ -525,7 +525,7 @@ cron_diagnose() {
# Check x access to /usr/sbin/cron
# Check x access to /usr/sbin/cron
check_access /usr/sbin/cron ..x
||
ret
=
1
check_access /usr/sbin/cron ..x
||
ret
=
1
if
[
!
-f
"/usr/sbin/sendmail"
]
;
then
if
[
!
-f
"/usr/sbin/sendmail"
]
;
then
echo
"WARNING: /usr/sbin/sendmail does not point to an executable mailer"
;
echo
"WARNING: /usr/sbin/sendmail does not point to an executable mailer"
;
echo
" such as ssmtp or exim, or /usr/bin/cronlog."
echo
" such as ssmtp or exim, or /usr/bin/cronlog."
echo
" If the cron job produces any output on stdout or stderr,"
echo
" If the cron job produces any output on stdout or stderr,"
...
@@ -559,7 +559,7 @@ create_user() {
...
@@ -559,7 +559,7 @@ create_user() {
echo
echo
echo
"Attempting to find or create a privileged user."
echo
"Attempting to find or create a privileged user."
for
username
in
slaproot
cyg_server cron_server sshd_server
for
username
in
${
slapos_administrator
}
cyg_server cron_server sshd_server
do
do
if
net user
"
${
username
}
"
1> /dev/null 2>&1
;
then
if
net user
"
${
username
}
"
1> /dev/null 2>&1
;
then
[
-z
"
${
first_account
}
"
]
&&
first_account
=
"
${
username
}
"
[
-z
"
${
first_account
}
"
]
&&
first_account
=
"
${
username
}
"
...
@@ -690,15 +690,15 @@ install_service() {
...
@@ -690,15 +690,15 @@ install_service() {
echo
"WARNING: Download the cygrunsrv package to start the cron daemon as a service."
echo
"WARNING: Download the cygrunsrv package to start the cron daemon as a service."
servtest
=
no
servtest
=
no
else
else
cygrunsrv
-Q
cron
>
/dev/null 2>&1
cygrunsrv
-Q
${
cron_service_name
}
>
/dev/null 2>&1
servtest
=
$?
servtest
=
$?
fi
fi
if
[
"
${
servtest
}
"
=
"0"
]
;
then
if
[
"
${
servtest
}
"
=
"0"
]
;
then
cronusername
=
"
$(
cygrunsrv
-VQ
cron
|
sed
-n
-e
's/^Account[ :]*//p'
)
"
cronusername
=
"
$(
cygrunsrv
-VQ
${
cron_service_name
}
|
sed
-n
-e
's/^Account[ :]*//p'
)
"
echo
"Cron is already installed as a service under account
${
cronusername
}
."
echo
"Cron is already installed as a service under account
${
cronusername
}
."
if
request
"Do you want to remove or reinstall it?"
;
then
if
request
"Do you want to remove or reinstall it?"
;
then
if
cygrunsrv
-R
cron
;
then
if
cygrunsrv
-R
${
cron_service_name
}
;
then
echo
"OK. The cron service was removed."
echo
"OK. The cron service was removed."
echo
echo
fi
fi
...
@@ -714,9 +714,9 @@ install_service() {
...
@@ -714,9 +714,9 @@ install_service() {
true
true
else
else
getcygenv
" "
getcygenv
" "
echo
echo
echo
"You must decide under what account the cron daemon will run."
echo
"You must decide under what account the cron daemon will run."
echo
"If you are the only user on this machine, the daemon can run as yourself."
echo
"If you are the only user on this machine, the daemon can run as yourself."
echo
" This gives access to all network drives but only allows you as user."
echo
" This gives access to all network drives but only allows you as user."
...
@@ -741,7 +741,7 @@ install_service() {
...
@@ -741,7 +741,7 @@ install_service() {
else
else
echo
"WARNING: Make sure you have the privilege to logon as a service."
echo
"WARNING: Make sure you have the privilege to logon as a service."
fi
fi
else
else
echo
echo
username
=
"
$1
"
username
=
"
$1
"
_password
=
"
$2
"
_password
=
"
$2
"
...
@@ -755,8 +755,8 @@ install_service() {
...
@@ -755,8 +755,8 @@ install_service() {
fi
fi
fi
fi
echo
echo
if
[
-n
"
${
username
}
"
]
;
then
if
[
-n
"
${
username
}
"
]
;
then
check_user
"
${
username
}
"
check_user
"
${
username
}
"
if
[
-z
"
${
_password
}
"
]
if
[
-z
"
${
_password
}
"
]
...
@@ -765,7 +765,7 @@ install_service() {
...
@@ -765,7 +765,7 @@ install_service() {
_password
=
"
${
value
}
"
_password
=
"
${
value
}
"
fi
fi
if
cygrunsrv
-I
cron
-p
/usr/sbin/cron
-e
CYGWIN
=
"
${
cygenv
}
"
\
if
cygrunsrv
-I
${
cron_service_name
}
-p
/usr/sbin/cron
-e
CYGWIN
=
"
${
cygenv
}
"
\
-a
"-n"
-d
"Cron daemon"
-u
"
$username
"
-w
"
$_password
"
-a
"-n"
-d
"Cron daemon"
-u
"
$username
"
-w
"
$_password
"
then
then
service
=
"service"
service
=
"service"
...
@@ -773,7 +773,7 @@ install_service() {
...
@@ -773,7 +773,7 @@ install_service() {
service
=
"off"
service
=
"off"
fi
fi
else
else
if
cygrunsrv
-I
cron
-p
/usr/sbin/cron
-e
CYGWIN
=
"
${
cygenv
}
"
\
if
cygrunsrv
-I
${
cron_service_name
}
-p
/usr/sbin/cron
-e
CYGWIN
=
"
${
cygenv
}
"
\
-a
"-n"
-d
"Cron daemon"
-a
"-n"
-d
"Cron daemon"
then
then
service
=
"service"
service
=
"service"
...
@@ -815,7 +815,7 @@ install_service() {
...
@@ -815,7 +815,7 @@ install_service() {
echo
" To avoid that, launch cron as a service (using cygrunsrv)."
echo
" To avoid that, launch cron as a service (using cygrunsrv)."
/usr/sbin/cron
/usr/sbin/cron
else
else
cygrunsrv
-S
cron
cygrunsrv
-S
${
cron_service_name
}
fi
fi
[
$?
-eq
0
]
&&
echo
"OK. The cron daemon is now running."
[
$?
-eq
0
]
&&
echo
"OK. The cron daemon is now running."
elif
[
"
${
service
}
"
=
"job"
]
;
then
elif
[
"
${
service
}
"
=
"job"
]
;
then
...
@@ -835,17 +835,17 @@ install_service() {
...
@@ -835,17 +835,17 @@ install_service() {
fi
fi
echo
"for information about the problem cron is having."
echo
"for information about the problem cron is having."
echo
echo
ls
-l
/usr/sbin/sendmail | fgrep
-q
cronlog
&&
ls
-l
/usr/sbin/sendmail | fgrep
-q
cronlog
&&
echo
-e
"Examine also any cron.log file in the HOME directory
\n
(or the file specified in MAILTO) and cron related files in /tmp.
\n
"
echo
-e
"Examine also any cron.log file in the HOME directory
\n
(or the file specified in MAILTO) and cron related files in /tmp.
\n
"
echo
"If you cannot fix the problem, then report it to cygwin@cygwin.com."
echo
"If you cannot fix the problem, then report it to cygwin@cygwin.com."
echo
"Please run the script /usr/bin/cronbug and ATTACH its output"
echo
"Please run the script /usr/bin/cronbug and ATTACH its output"
echo
"(the file cronbug.txt) to your e-mail."
echo
"(the file cronbug.txt) to your e-mail."
echo
echo
echo
"WARNING: PATH may be set differently under cron than in interactive shells."
echo
"WARNING: PATH may be set differently under cron than in interactive shells."
echo
" Names such as
\"
find
\"
and
\"
date
\"
may refer to Windows programs."
echo
" Names such as
\"
find
\"
and
\"
date
\"
may refer to Windows programs."
echo
echo
}
# === End of install_service() === #
}
# === End of install_service() === #
...
@@ -858,7 +858,7 @@ PATH=/usr/bin:$PATH
...
@@ -858,7 +858,7 @@ PATH=/usr/bin:$PATH
USER
=
"
$(
id
-un
)
"
USER
=
"
$(
id
-un
)
"
get_temp_dir
get_temp_dir
# Take care of obsolete cron_diagnose.sh
# Take care of obsolete cron_diagnose.sh
if
expr
"
$0
"
:
'.*cron_diagnose.sh'
>
/dev/null
;
then
if
expr
"
$0
"
:
'.*cron_diagnose.sh'
>
/dev/null
;
then
echo
-e
"
\n
INFO: cron_diagnose.sh is now included in cron-config.
\n
"
echo
-e
"
\n
INFO: cron_diagnose.sh is now included in cron-config.
\n
"
fi
fi
...
@@ -867,7 +867,8 @@ sanity_check || exit 1
...
@@ -867,7 +867,8 @@ sanity_check || exit 1
get_NT
||
exit
1
get_NT
||
exit
1
slapos_administrator
=
${
1
:slaproot
}
cron_service_name
=
${
2
:cron
}
install_service
$*
install_service
$*
exit
$?
exit
$?
windows/scripts/slapos-cygwin-bootstrip.sh
View file @
36ac3ca0
...
@@ -52,9 +52,10 @@ declare -r node_certificate_file=/etc/opt/slapos/ssl/computer.crt
...
@@ -52,9 +52,10 @@ declare -r node_certificate_file=/etc/opt/slapos/ssl/computer.crt
declare
-r
node_key_file
=
/etc/opt/slapos/ssl/computer.key
declare
-r
node_key_file
=
/etc/opt/slapos/ssl/computer.key
declare
-r
node_configure_file
=
/etc/opt/slapos/slapos.cfg
declare
-r
node_configure_file
=
/etc/opt/slapos/slapos.cfg
declare
-r
slapos_ifname
=
re6stnet-boot
declare
-r
slapos_ifname
=
slapboot-re6stnet-lo
declare
-r
ipv4_local_network
=
10.202.29.0/24
declare
-r
ipv4_local_network
=
10.202.29.0/24
declare
-r
ipv6_local_address
=
2001:67c:1254:e:32::1
declare
-r
ipv6_local_address
=
2001:67c:1254:e:32::1
declare
-r
slapos_user_basename
=
slapboot-user
declare
-r
slapos_installer_software
=
http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-share:/software/slapos-windows-installer/software.cfg
declare
-r
slapos_installer_software
=
http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-share:/software/slapos-windows-installer/software.cfg
...
@@ -245,7 +246,7 @@ sed -i -e "s%^\\s*interface_name.*$%interface_name = ${interface_guid}%" \
...
@@ -245,7 +246,7 @@ 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"
\
-e
"s%^ipv4_local_network.*
$%
ipv4_local_network =
${
ipv4_local_network
}
%"
\
-e
"s%^ipv4_local_network.*
$%
ipv4_local_network =
${
ipv4_local_network
}
%"
\
-e
"s%^computer_id.*
$%
computer_id =
${
computer_guid
}
%"
\
-e
"s%^computer_id.*
$%
computer_id =
${
computer_guid
}
%"
\
-e
"s%^user_base_name =.*
$%
user_base_name =
slapguider
%"
\
-e
"s%^user_base_name =.*
$%
user_base_name =
${
slapos_user_basename
}
%"
\
${
node_configure_file
}
${
node_configure_file
}
csih_inform
"type
${
node_configure_file
}
:"
csih_inform
"type
${
node_configure_file
}
:"
csih_inform
"************************************************************"
csih_inform
"************************************************************"
...
...
windows/scripts/slapos-include.sh
View file @
36ac3ca0
#! /bin/bash
#! /bin/bash
export
PATH
=
/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:
$PATH
export
PATH
=
/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:
$PATH
if
!
source
/usr/share/csih/cygwin-service-installation-helper.sh
;
then
if
!
source
/usr/share/csih/cygwin-service-installation-helper.sh
;
then
echo
"
Error: Download the csih package at first, I need this file:
"
echo
"
Download the csih package at first, to run this script requires
"
echo
" /usr/share/csih/cygwin-service-installation-helper.sh"
echo
" /usr/share/csih/cygwin-service-installation-helper.sh"
exit
1
exit
1
fi
fi
...
@@ -20,6 +20,8 @@ fi
...
@@ -20,6 +20,8 @@ fi
# ======================================================================
# ======================================================================
# Constants
# Constants
# ======================================================================
# ======================================================================
declare
-r
slapos_prefix
=
declare
-r
slapos_client_home
=
~/.slapos
declare
-r
slapos_client_home
=
~/.slapos
declare
-r
client_configure_file
=
$slapos_client_home
/slapos.cfg
declare
-r
client_configure_file
=
$slapos_client_home
/slapos.cfg
declare
-r
client_certificate_file
=
$slapos_client_home
/certificate
declare
-r
client_certificate_file
=
$slapos_client_home
/certificate
...
@@ -31,7 +33,6 @@ declare -r node_key_file=/etc/opt/slapos/ssl/computer.key
...
@@ -31,7 +33,6 @@ declare -r node_key_file=/etc/opt/slapos/ssl/computer.key
declare
-r
node_configure_file
=
/etc/opt/slapos/slapos.cfg
declare
-r
node_configure_file
=
/etc/opt/slapos/slapos.cfg
declare
-r
node_template_file
=
/etc/slapos/slapos.cfg.example
declare
-r
node_template_file
=
/etc/slapos/slapos.cfg.example
declare
-r
slapos_ifname
=
re6stnet-lo
# Change it if it confilcts with your local network
# Change it if it confilcts with your local network
declare
-r
ipv4_local_network
=
10.201.67.0/24
declare
-r
ipv4_local_network
=
10.201.67.0/24
...
@@ -39,14 +40,20 @@ declare -r openvpn_tap_driver_inf=/etc/slapos/driver/OemWin2k.inf
...
@@ -39,14 +40,20 @@ declare -r openvpn_tap_driver_inf=/etc/slapos/driver/OemWin2k.inf
declare
-r
openvpn_tap_driver_hwid
=
tap0901
declare
-r
openvpn_tap_driver_hwid
=
tap0901
declare
-r
re6stnet_configure_file
=
/etc/re6stnet/re6stnet.conf
declare
-r
re6stnet_configure_file
=
/etc/re6stnet/re6stnet.conf
declare
-r
re6stnet_service_name
=
re6stnet
declare
-r
slapos_cron_config
=
/usr/bin/slapos-cron-config
declare
-r
slapos_cron_config
=
/usr/bin/slapos-cron-config
declare
-r
slaprunner_startup_file
=
/etc/slapos/scripts/slap-runner.html
declare
-r
slaprunner_startup_file
=
/etc/slapos/scripts/slap-runner.html
declare
-r
slapos_run_key
=
'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
declare
-r
slapos_run_key
=
'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
declare
-r
slapos_run_entry
=
slapos-configure
declare
-r
slapos_user
=
slaproot
declare
-r
slapos_run_entry
=
${
slapos_prefix
:slapos
}
-configure
declare
-r
slapos_administrator
=
${
slapos_prefix
:slap
}
root
declare
-r
slapos_user_basename
=
${
slapos_prefix
:slap
}
user
declare
-r
slapos_ifname
=
${
slapos_prefix
}
re6stnet-lo
declare
-r
re6stnet_service_name
=
${
slapos_prefix
}
re6stnet
declare
-r
cron_service_name
=
${
slapos_prefix
}
cron
declare
-r
sshd_service_name
=
${
slapos_prefix
}
sshd
declare
-r
syslog_service_name
=
${
slapos_prefix
}
syslog-ng
declare
-r
cygserver_service_name
=
${
slapos_prefix
}
cygserver
# ======================================================================
# ======================================================================
# Routine: check_cygwin_service
# Routine: check_cygwin_service
...
...
windows/scripts/slapos-node.sh
View file @
36ac3ca0
...
@@ -16,11 +16,11 @@ check_re6stnet_configure
...
@@ -16,11 +16,11 @@ check_re6stnet_configure
# -----------------------------------------------------------
# -----------------------------------------------------------
# Check cygwin services used by slapos
# Check cygwin services used by slapos
# -----------------------------------------------------------
# -----------------------------------------------------------
check_cygwin_service
cygserver
check_cygwin_service
${
cygserver_service_name
}
check_cygwin_service
syslog-ng
check_cygwin_service
${
syslog_service_name
}
check_cygwin_service
sshd
check_cygwin_service
${
sshd_service_name
}
check_cygwin_service
cron
check_cygwin_service
${
cron_service_name
}
check_re6stnet_needed
&&
check_cygwin_service
re6stnet
check_re6stnet_needed
&&
check_cygwin_service
${
re6stnet_service_name
}
# -----------------------------------------------------------
# -----------------------------------------------------------
# Get computer reference and re6stnet network
# Get computer reference and re6stnet network
...
...
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