Commit b5b0464f authored by Jondy Zhao's avatar Jondy Zhao

Reserve the mode value of installed files

parent 38bcc31e
...@@ -109,6 +109,15 @@ done ...@@ -109,6 +109,15 @@ done
# Backup slap-runner.html # Backup slap-runner.html
cp /etc/slapos/scripts/slap-runner.html{,.orig} cp /etc/slapos/scripts/slap-runner.html{,.orig}
# Unzip slapos.tar.gz
if [[ -r /opt/downloads/slapos.tar.gz ]] ; then
echo Extracting slapos.tar.gz
cd /opt
tar xzf /opt/downloads/slapos.tar.gz --no-same-owner ||
show_error_exit "Failed to untar slapos.tar.gz"
echo Extracte slapos.tar.gz OK.
fi
echo Run post-install script successfully. echo Run post-install script successfully.
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
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
# #
# * Remove instance root /srv/slapgrid # * Remove instance root /srv/slapgrid
# #
export PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:$PATH
# #
# Remove virtual netcard installed by re6stnet # Remove virtual netcard installed by re6stnet
......
...@@ -14,6 +14,7 @@ Uninstallable=yes ...@@ -14,6 +14,7 @@ Uninstallable=yes
[Dirs] [Dirs]
Name: "{app}\cygwin" Name: "{app}\cygwin"
Name: "{app}\cygwin\opt\slapos" Name: "{app}\cygwin\opt\slapos"
Name: "{app}\cygwin\opt\downloads"
Name: "{app}\cygwin\usr\local\bin" Name: "{app}\cygwin\usr\local\bin"
Name: "{app}\cygwin\etc\slapos\driver" Name: "{app}\cygwin\etc\slapos\driver"
Name: "{app}\cygwin\etc\slapos\scripts" Name: "{app}\cygwin\etc\slapos\scripts"
...@@ -21,19 +22,14 @@ Name: "{app}\cygwin\etc\slapos\images" ...@@ -21,19 +22,14 @@ Name: "{app}\cygwin\etc\slapos\images"
[Files] [Files]
Source: "cygwin-packages\*"; DestDir: "{app}\cygwin-packages"; Flags: recursesubdirs; Source: "cygwin-packages\*"; DestDir: "{app}\cygwin-packages"; Flags: recursesubdirs;
Source: "opt\slapos\*"; DestDir: "{app}\cygwin\opt\slapos"; Flags: recursesubdirs; Source: "opt\slapos\slapos.tar.gz"; DestDir: "{app}\cygwin\opt\downloads";
Source: "opt\git\slapos.core\slapos.cfg.example"; DestDir: "{app}\cygwin\etc\slapos"; Source: "opt\downloads\pyOpenSSL-0.13.tar.gz"; DestDir: "{app}\cygwin\opt\downloads"; DestName: "pyOpenSSL.tar.gz";
Source: "opt\git\slapos.core\slapos-client.cfg.example"; DestDir: "{app}\cygwin\etc\slapos"; Source: "opt\git\re6stnet\dist\re6stnet-0.1.tar.gz"; DestDir: "{app}\cygwin\opt\downloads"; DestName: "re6stnet.tar.gz";
Source: "opt\downloads\pyOpenSSL-0.13.tar.gz"; DestDir: "{app}\cygwin"; DestName: "pyOpenSSL.tar.gz"; Source: "opt\downloads\miniupnpc-1.8.tar.gz"; DestDir: "{app}\cygwin\opt\downloads"; DestName: "miniupnpc.tar.gz";
Source: "opt\git\re6stnet\dist\re6stnet-0.1.tar.gz"; DestDir: "{app}\cygwin"; DestName: "re6stnet.tar.gz";
Source: "opt\downloads\miniupnpc-1.8.tar.gz"; DestDir: "{app}\cygwin"; DestName: "miniupnpc.tar.gz";
Source: "opt\patches\slapos-core-format.patch"; DestDir: "{app}\cygwin\etc\slapos\patches"; Source: "opt\patches\slapos-core-format.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\patches\slapos-cookbook-inotifyx.patch"; DestDir: "{app}\cygwin\etc\slapos\patches"; Source: "opt\patches\slapos-cookbook-inotifyx.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "setup.exe"; DestDir: "{app}";
Source: "opt\git\slapos.package\windows\scripts\setup-cygwin.bat"; DestDir: "{app}";
Source: "opt\images\slapos.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; Source: "opt\images\slapos.ico"; DestDir: "{app}\cygwin\etc\slapos\images";
Source: "opt\images\terminal.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; DestName: "terminal.ico"; Source: "opt\images\terminal.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; DestName: "terminal.ico";
Source: "opt\images\configure.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; Source: "opt\images\configure.ico"; DestDir: "{app}\cygwin\etc\slapos\images";
...@@ -44,33 +40,32 @@ Source: "opt\images\manager.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; ...@@ -44,33 +40,32 @@ Source: "opt\images\manager.ico"; DestDir: "{app}\cygwin\etc\slapos\images";
Source: "setup.exe"; DestDir: "{app}"; Source: "setup.exe"; DestDir: "{app}";
Source: "opt\git\slapos.package\windows\scripts\setup-cygwin.bat"; DestDir: "{app}"; Source: "opt\git\slapos.package\windows\scripts\setup-cygwin.bat"; DestDir: "{app}";
Source: "opt\git\slapos.package\windows\scripts\ip"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\ip"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\useradd"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\useradd"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\usermod"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\usermod"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\groupadd"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\groupadd"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\brctl"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\brctl"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\tunctl"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\tunctl"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\cyg_wscript"; DestDir: "{app}\cygwin\usr\local\bin"; Source: "opt\git\slapos.package\windows\scripts\cyg_wscript"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\babeld\babeld.exe"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\babeld\babeld.exe"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\openvpn\src\openvpn\.libs\openvpn.exe"; DestDir: "{app}\cygwin\bin";
Source: "opt\openvpn\bin\*.exe"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\*.exe"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\bin\*.dll"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\*.dll"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\bin\addtap.bat"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\addtap.bat"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\bin\deltapall.bat"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\deltapall.bat"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver"; Permissions: everyone-readexec;
Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver";
Source: "opt\git\slapos.package\windows\scripts\slapos-include.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\slapos-include.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\build-slapos.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
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"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\slapos-configure.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\slap-runner.html"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
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"; Permissions: everyone-readexec;
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"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\docs\using-slapos-in-windows.html"; DestDir: "{app}"; DestName: "user-guide.html"; Source: "opt\git\slapos.package\windows\docs\README.cygwin"; DestDir: "{app}"; DestName: "readme.txt"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\docs\README.cygwin"; DestDir: "{app}"; DestName: "readme.txt";
[Icons] [Icons]
Name: "{commondesktop}\SlapOS"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico"; Name: "{commondesktop}\SlapOS"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
......
...@@ -44,8 +44,9 @@ ...@@ -44,8 +44,9 @@
# startup Run slapos-configure.sh on windows startup # startup Run slapos-configure.sh on windows startup
# runner Install web runner for this node # runner Install web runner for this node
# #
source $0/../slapos-include.sh export PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:$PATH
check_administrator_right source $(dirname $0)/slapos-include.sh
check_administrator_right || show_error_exit
if [[ ! ":$PATH" == :/opt/slapos/bin: ]] ; then if [[ ! ":$PATH" == :/opt/slapos/bin: ]] ; then
for profile in ~/.bash_profile ~/.profile ; do for profile in ~/.bash_profile ~/.profile ; do
...@@ -74,26 +75,24 @@ mkdir -p /etc/re6stnet ...@@ -74,26 +75,24 @@ mkdir -p /etc/re6stnet
echo echo
echo Starting configure cygwin services ... echo Starting configure cygwin services ...
echo echo
cygrunsrv --query cygserver > /dev/null 2>&1 if ! cygrunsrv --query cygserver > /dev/null 2>&1 ; then
if (( $? )) ; then
echo Run cygserver-config ... echo Run cygserver-config ...
/usr/bin/cygserver-config --yes || \ /usr/bin/cygserver-config --yes || \
show_error_exit "Failed to run cygserver-config" show_error_exit "Failed to run cygserver-config"
else else
echo The cygserver service has been installed. echo The cygserver service has been installed.
fi fi
check_service_state cygserver check_cygwin_service cygserver
echo Checking syslog-ng service ... if ! cygrunsrv --query syslog-ng > /dev/null 2>&1 ; then
cygrunsrv --query syslog-ng > /dev/null 2>&1
if (( $? )) ; then
echo Run syslog-ng-config ... echo Run syslog-ng-config ...
/usr/bin/syslog-ng-config --yes || \ /usr/bin/syslog-ng-config --yes || \
show_error_exit "Failed to run syslog-ng-config" show_error_exit "Failed to run syslog-ng-config"
else else
echo The syslog-ng service has been installed. echo The syslog-ng service has been installed.
fi fi
check_service_state syslog-ng check_cygwin_service syslog-ng
echo echo
echo Configure cygwin services OK. echo Configure cygwin services OK.
echo echo
...@@ -119,9 +118,6 @@ if [[ ! " $original_connections " == *[\ ]$slapos_ifname[\ ]* ]] ; then ...@@ -119,9 +118,6 @@ if [[ ! " $original_connections " == *[\ ]$slapos_ifname[\ ]* ]] ; then
fi fi
#ip -4 addr add $ipv4_local_network dev $slapos_ifname #ip -4 addr add $ipv4_local_network dev $slapos_ifname
# reset_connection $slapos_ifname # reset_connection $slapos_ifname
echo " Slapos ipv4_local_network is $ipv4_local_network"
echo " If it confilcts with your local network, change it in the file:"
echo " $(dirname $0)/slapos-include.sh"
echo echo
echo Configure slapos network OK. echo Configure slapos network OK.
echo echo
...@@ -177,13 +173,13 @@ fi ...@@ -177,13 +173,13 @@ fi
openssl rsa -noout -in $node_key_file -check || \ openssl rsa -noout -in $node_key_file -check || \
show_error_exit "Invalid node key: $node_key_file." show_error_exit "Invalid node key: $node_key_file."
if [[ ! -f $node_config_file ]] ; then if [[ ! -f $node_configure_file ]] ; then
echo "Copy computer configure file from $node_template_file to $node_config_file" echo "Copy computer configure file from $node_template_file to $node_configure_file"
cp $node_template_file $node_config_file cp $node_template_file $node_configure_file
fi fi
[[ -z $interface_guid ]] && \ [[ -z $interface_guid ]] && \
interface_guid=$(sed -n -e "s/^\\sinterface_name\\s*=\\s*//p" $node_config_file) interface_guid=$(sed -n -e "s/^\\sinterface_name\\s*=\\s*//p" $node_configure_file)
[[ -z $interface_guid ]] && \ [[ -z $interface_guid ]] && \
interface_guid=$(connection2guid $slapos_ifname) interface_guid=$(connection2guid $slapos_ifname)
[[ -z $interface_guid ]] && \ [[ -z $interface_guid ]] && \
...@@ -199,19 +195,25 @@ echo " interface name: $slapos_ifname" ...@@ -199,19 +195,25 @@ echo " interface name: $slapos_ifname"
echo " GUID: $interface_guid" echo " GUID: $interface_guid"
echo " ipv4_local_network: $ipv4_local_network" echo " ipv4_local_network: $ipv4_local_network"
echo " computer_id: $computer_guid" echo " computer_id: $computer_guid"
echo
echo " If ipv4_local_network confilcts with your local network, change it"
echo " in the file: $node_configure_file "
echo " Or change it in the $(dirname $0)/slapos-include.sh"
echo " and run Configure SlapOS again."
sed -i -e "s%^\\s*interface_name.*$%interface_name = $interface_guid%" \ 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%" \
$node_config_file $node_configure_file
if [[ ! -f $client_certificate_file ]] ; then if [[ ! -f $client_certificate_file ]] ; then
read -p "Where is client certificate file (/certificate): " filename read -p "Where is client certificate file (/certificate): " filename
[[ -z $filename ]] && certificate_file="/certificate" [[ -z $filename ]] && filename="/certificate"
[[ ! -f "$filename" ]] && \ [[ ! -f "$filename" ]] && \
show_error_exit "Client certificate file $filename doesn't exists." show_error_exit "Client certificate file $filename doesn't exists."
echo "Copy client certificate from $filename to $client_certificate_file" echo "Copy client certificate from $filename to $client_certificate_file"
certificate_file=$(cygpath -u $filename) filename=$(cygpath -u $filename)
cp $filename $client_certificate_file cp $filename $client_certificate_file
fi fi
openssl x509 -noout -in $client_certificate_file || \ openssl x509 -noout -in $client_certificate_file || \
...@@ -219,19 +221,19 @@ openssl x509 -noout -in $client_certificate_file || \ ...@@ -219,19 +221,19 @@ openssl x509 -noout -in $client_certificate_file || \
if [[ ! -f $client_key_file ]] ; then if [[ ! -f $client_key_file ]] ; then
read -p "Where is client key file (/key): " filename read -p "Where is client key file (/key): " filename
[[ -z $filename ]] && key_file="/key" [[ -z $filename ]] && filename="/key"
[[ ! -f "$filename" ]] && \ [[ ! -f "$filename" ]] && \
show_error_exit "Key file $filename doesn't exists." show_error_exit "Key file $filename doesn't exists."
echo "Copy client key from $filename to $client_key_file" echo "Copy client key from $filename to $client_key_file"
key_file=$(cygpath -u $filename) filename=$(cygpath -u $filename)
cp $filename $client_key_file cp $filename $client_key_file
fi fi
openssl rsa -noout -in $client_key_file -check || \ openssl rsa -noout -in $client_key_file -check || \
show_error_exit "Invalid client key: $client_key_file." show_error_exit "Invalid client key: $client_key_file."
if [[ ! -f $client_configure_file ]] ; then if [[ ! -f $client_configure_file ]] ; then
echo "Copy client configure file from $client_template_file to $client_config_file" echo "Copy client configure file from $client_template_file to $client_configure_file"
cp $client_template_file $client_config_file cp $client_template_file $client_configure_file
fi fi
echo "Client configuration information:" echo "Client configuration information:"
...@@ -253,10 +255,11 @@ echo ...@@ -253,10 +255,11 @@ echo
echo Checking miniupnpc ... echo Checking miniupnpc ...
if [[ ! -d /opt/miniupnpc ]] ; then if [[ ! -d /opt/miniupnpc ]] ; then
[[ -f /miniupnpc.tar.gz ]] || show_error_exit "No package found: /miniupnpc.tar.gz" package=/opt/downloads/miniupnpc.tar.gz
[[ -r $package ]] || show_error_exit "No package found: $package"
echo "Installing miniupnpc ..." echo "Installing miniupnpc ..."
cd /opt cd /opt
tar xzf /miniupnpc.tar.gz --no-same-owner tar xzf $package --no-same-owner
mv $(ls -d miniupnpc-*) miniupnpc mv $(ls -d miniupnpc-*) miniupnpc
cd miniupnpc cd miniupnpc
make make
...@@ -268,10 +271,11 @@ fi ...@@ -268,10 +271,11 @@ fi
echo Checking pyOpenSSL ... echo Checking pyOpenSSL ...
if [[ ! -d /opt/pyOpenSSL ]] ; then if [[ ! -d /opt/pyOpenSSL ]] ; then
[[ -f /pyOpenSSL.tar.gz ]] || show_error_exit "No package found: /pyOpenSSL.tar.gz" package=/opt/downloads/pyOpenSSL.tar.gz
[[ -r $package ]] || show_error_exit "No package found: $package"
echo "Installing pyOpenSSL ..." echo "Installing pyOpenSSL ..."
cd /opt cd /opt
tar xzf /pyOpenSSL.tar.gz --no-same-owner tar xzf $package --no-same-owner
mv $(ls -d pyOpenSSL-*) pyOpenSSL mv $(ls -d pyOpenSSL-*) pyOpenSSL
cd pyOpenSSL cd pyOpenSSL
python setup.py install || show_error_exit "Failed ot install pyOpenSSL." python setup.py install || show_error_exit "Failed ot install pyOpenSSL."
...@@ -283,13 +287,15 @@ fi ...@@ -283,13 +287,15 @@ fi
echo Checking re6stnet ... echo Checking re6stnet ...
if [[ ! -d /opt/re6stnet ]] ; then if [[ ! -d /opt/re6stnet ]] ; then
echo "Installing re6stnet ..." echo "Installing re6stnet ..."
package=/opt/downloads/re6stnet.tar.gz
cd /opt cd /opt
if [[ -f /re6stnet.tar.gz ]] ; then if [[ -r $package ]] ; then
tar xzf /re6stnet.tar.gz --no-same-owner tar xzf $package --no-same-owner
mv $(ls -d re6stnet-*) re6stnet mv $(ls -d re6stnet-*) re6stnet
else else
echo "Clone re6stnet from http://git.erp5.org/repos/re6stnet.git" echo "Clone re6stnet from http://git.erp5.org/repos/re6stnet.git"
git clone -b cygwin http://git.erp5.org/repos/re6stnet.git git clone -b cygwin http://git.erp5.org/repos/re6stnet.git ||
show_error_exit "Failed to clone re6stnet.git"
fi fi
cd re6stnet cd re6stnet
python setup.py install || show_error_exit "Failed to install re6stnet." python setup.py install || show_error_exit "Failed to install re6stnet."
...@@ -326,11 +332,11 @@ fi ...@@ -326,11 +332,11 @@ fi
# Run re6stnet if no native ipv6 # Run re6stnet if no native ipv6
if check_re6stnet_needed ; then if check_re6stnet_needed ; then
check_re6stnet_configure || exit 1 check_re6stnet_configure || exit 1
if [[ ! -r ${re6stnet_cgywin_script} ]] ; then if [[ ! -r $re6stnet_cygwin_script ]] ; then
cat <<EOF > /${re6stnet_cgywin_script} cat <<EOF > $re6stnet_cygwin_script
$(cygpath -w /bin/bash.exe) --login -c 'python %*' $(cygpath -w /bin/bash.exe) --login -c 'python %*'
EOF EOF
chmod +x ${re6stnet_cgywin_script} chmod +x $re6stnet_cygwin_script
fi fi
if ! cygrunsrv --query $re6stnet_service_name >/dev/null 2>&1 ; then if ! cygrunsrv --query $re6stnet_service_name >/dev/null 2>&1 ; then
...@@ -338,8 +344,8 @@ EOF ...@@ -338,8 +344,8 @@ EOF
-p $(which re6stnet) -a "@re6stnet.conf" -d "CYGWIN re6stnet" || \ -p $(which re6stnet) -a "@re6stnet.conf" -d "CYGWIN re6stnet" || \
show_error_exit "Failed to install cygwin service $re6stnet_service_name." show_error_exit "Failed to install cygwin service $re6stnet_service_name."
fi fi
check_cygwin_service $re6stnet_service_name || exit 1
echo "You can check log files in the /var/log/re6stnet/*.log" echo "You can check log files in the /var/log/re6stnet/*.log"
# check_cygwin_service $re6stnet_service_name || exit 1
else else
echo "Native IPv6 found, no re6stnet required." echo "Native IPv6 found, no re6stnet required."
fi fi
...@@ -394,7 +400,7 @@ echo Starting configure section runner ... ...@@ -394,7 +400,7 @@ echo Starting configure section runner ...
echo echo
slaprunner_title="SlapOS-Node-Runner-In-$computer_guid" slaprunner_title="SlapOS-Node-Runner-In-$computer_guid"
feature_code="#-*- SlapOS Web Runner JavaScript Boot Code -*-#" feature_code="#-*- SlapOS Web Runner JavaScript Boot Code -*-#"
if ! grep -q -F "$feature_code" $slapos_runner_file ; then if ! grep -q -F "$feature_code" $slaprunner_startup_file ; then
echo Installing SlapOS Web Runner ... echo Installing SlapOS Web Runner ...
if [[ -r $re6stnet_configure_file ]] ; then if [[ -r $re6stnet_configure_file ]] ; then
...@@ -446,7 +452,7 @@ if ! grep -q -F "$feature_code" $slapos_runner_file ; then ...@@ -446,7 +452,7 @@ if ! grep -q -F "$feature_code" $slapos_runner_file ; then
[[ -z $slaprunner_url ]] && \ [[ -z $slaprunner_url ]] && \
show_error_exit "Failed to create instance of SlapOS Web Runner." show_error_exit "Failed to create instance of SlapOS Web Runner."
cat <<EOF > $slapos_runner_file cat <<EOF > $slaprunner_startup_file
<html> <html>
<head><title>SlapOS Web Runner</title> <head><title>SlapOS Web Runner</title>
<script LANGUAGE="JavaScript"> <script LANGUAGE="JavaScript">
...@@ -461,7 +467,7 @@ function openwin() { ...@@ -461,7 +467,7 @@ function openwin() {
<!-- $feature_code --> <!-- $feature_code -->
</html> </html>
EOF EOF
echo SlapOS Web Runner boot file $slapos_runner_file generated. echo SlapOS Web Runner boot file $slaprunner_startup_file generated.
echo echo
echo Install Web Runner OK. echo Install Web Runner OK.
......
#! /bin/bash #! /bin/bash
#
export PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:$PATH
# ====================================================================== # ======================================================================
# Constants # Constants
...@@ -13,7 +11,7 @@ client_template_file=/etc/slapos/slapos-client.cfg.example ...@@ -13,7 +11,7 @@ client_template_file=/etc/slapos/slapos-client.cfg.example
node_certificate_file=/etc/opt/slapos/ssl/computer.crt node_certificate_file=/etc/opt/slapos/ssl/computer.crt
node_key_file=/etc/opt/slapos/ssl/computer.key node_key_file=/etc/opt/slapos/ssl/computer.key
node_config_file=/etc/opt/slapos/slapos.cfg node_configure_file=/etc/opt/slapos/slapos.cfg
node_template_file=/etc/slapos/slapos.cfg.example node_template_file=/etc/slapos/slapos.cfg.example
slapos_ifname=re6stnet-lo slapos_ifname=re6stnet-lo
...@@ -82,13 +80,13 @@ function check_administrator_right() ...@@ -82,13 +80,13 @@ function check_administrator_right()
{ {
get_system_and_admins_ids || exit 1 get_system_and_admins_ids || exit 1
groups=" $(id -G) " groups=" $(id -G) "
if [[ ! $groups == *\ $ADMINGUID\ * ]] ; then if [[ ! $groups == *\ $ADMINSGID\ * ]] ; then
echo echo
echo "You haven't right to run this script $0. " echo "You haven't right to run this script $0. "
echo "Please login as Administrator to run it, or right-click this script and" echo "Please login as Administrator to run it, or right-click this script and"
echo "then click Run as administrator." echo "then click Run as administrator."
echo echo
exit 1 return 1
fi fi
} # === check_administrator_right() === # } # === check_administrator_right() === #
...@@ -104,20 +102,20 @@ function check_cygwin_service() ...@@ -104,20 +102,20 @@ function check_cygwin_service()
echo Checking cygwin service $name ... echo Checking cygwin service $name ...
if [ ! -e /usr/bin/cygrunsrv.exe ]; then if [[ ! -e /usr/bin/cygrunsrv.exe ]] ; then
echo "Error: Download the cygrunsrv package to start the $name daemon as a service." echo "Error: Download the cygrunsrv package to start the $name daemon as a service."
exit 1 exit 1
fi fi
if [[ ! cygrunsrv --query $name > /dev/null 2>&1 ]] ; then if ! cygrunsrv --query $name > /dev/null 2>&1 ; then
echo "Error: No cygwin service $name installed, please run Configure SlapOS to install it." echo "Error: No cygwin service $name installed, please run Configure SlapOS to install it."
return 1 return 1
fi fi
account="$(cygrunsrv -VQ $name | sed -n -e 's/^Account[ :]*//p')" account=$(cygrunsrv -VQ $name | sed -n -e 's/^Account[ :]*//p')
state=$(cygrunsrv --query $name | sed -n -e 's/^Current State[ :]*//p') state=$(cygrunsrv --query $name | sed -n -e 's/^Current State[ :]*//p')
[[ "$state" == "Running" ]] || cygrunsrv --start $name [[ "$state" == "Running" ]] || cygrunsrv --start $name
state=$(cygrunsrv --query $name | sed -n -e 's/^Current State[ :]*//p') state=$(cygrunsrv --query $name | sed -n -e 's/^Current State[ :]*//p')
cygrunsrv --query --verbose $name cygrunsrv --query $name --verbose
echo Check cygwin service $name OVER. echo Check cygwin service $name OVER.
[[ "$state" == "Running" ]] || ret=1 [[ "$state" == "Running" ]] || ret=1
return "${ret}" return "${ret}"
...@@ -189,8 +187,8 @@ function check_cron_configure() ...@@ -189,8 +187,8 @@ function check_cron_configure()
function check_re6stnet_configure() function check_re6stnet_configure()
{ {
echo Checking slapos re6stnet confiure ... echo Checking slapos re6stnet confiure ...
! which re6stnet > /dev/null 2>&1 && \ ! which re6stnet > /dev/null 2>&1 &&
echo "No re6stnet installed, please run Configure SlapOS first." && \ echo "No re6stnet installed, please run Configure SlapOS first." &&
return 1 return 1
echo Check slapos re6stnet configure Over. echo Check slapos re6stnet configure Over.
...@@ -204,8 +202,11 @@ function check_re6stnet_needed() ...@@ -204,8 +202,11 @@ function check_re6stnet_needed()
{ {
# This doesn't work in the cygwin now, need hack ip script # This doesn't work in the cygwin now, need hack ip script
# re6st-conf --registry http://re6stnet.nexedi.com/ --is-needed # re6st-conf --registry http://re6stnet.nexedi.com/ --is-needed
netsh interface ipv6 show route | grep -q " ::/0 " if netsh interface ipv6 show route | grep -q " ::/0 " ; then
return ! $? return 1
fi
# re6stnet is required
return 0
} # === check_re6stnet_needed() === # } # === check_re6stnet_needed() === #
# ====================================================================== # ======================================================================
...@@ -367,6 +368,7 @@ alias = ...@@ -367,6 +368,7 @@ alias =
netdrive_reporter http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/netdrive-reporter/software.cfg netdrive_reporter http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/netdrive-reporter/software.cfg
demoapp http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/demoapp/software.cfg demoapp http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/cygwin-0:/software/demoapp/software.cfg
EOF EOF
echo $client_template_file has been generated.
cat <<EOF > $node_template_file cat <<EOF > $node_template_file
[slapos] [slapos]
...@@ -544,4 +546,5 @@ upload-to-binary-cache-url-blacklist = ...@@ -544,4 +546,5 @@ upload-to-binary-cache-url-blacklist =
http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads
/ /
EOF EOF
echo $node_template_file has been generated.
} # === create_template_configure_file() === # } # === create_template_configure_file() === #
#! /bin/bash #! /bin/bash
source $0/../slapos-include.sh export PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:$PATH
check_administrator_right source $(dirname $0)/slapos-include.sh
check_administrator_right || show_error_exit
# ----------------------------------------------------------- # -----------------------------------------------------------
# Check all the configure files # Check all the configure files
......
...@@ -25,9 +25,6 @@ Name: "{app}\cygwin\etc\slapos\images" ...@@ -25,9 +25,6 @@ Name: "{app}\cygwin\etc\slapos\images"
Source: "opt\patches\slapos-core-format.patch"; DestDir: "{app}\cygwin\etc\slapos\patches"; Source: "opt\patches\slapos-core-format.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "opt\patches\slapos-cookbook-inotifyx.patch"; DestDir: "{app}\cygwin\etc\slapos\patches"; Source: "opt\patches\slapos-cookbook-inotifyx.patch"; DestDir: "{app}\cygwin\etc\slapos\patches";
Source: "setup.exe"; DestDir: "{app}";
Source: "opt\git\slapos.package\windows\scripts\setup-cygwin.bat"; DestDir: "{app}";
Source: "opt\images\slapos.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; Source: "opt\images\slapos.ico"; DestDir: "{app}\cygwin\etc\slapos\images";
Source: "opt\images\terminal.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; DestName: "terminal.ico"; Source: "opt\images\terminal.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; DestName: "terminal.ico";
Source: "opt\images\configure.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; Source: "opt\images\configure.ico"; DestDir: "{app}\cygwin\etc\slapos\images";
...@@ -38,33 +35,32 @@ Source: "opt\images\manager.ico"; DestDir: "{app}\cygwin\etc\slapos\images"; ...@@ -38,33 +35,32 @@ Source: "opt\images\manager.ico"; DestDir: "{app}\cygwin\etc\slapos\images";
Source: "setup.exe"; DestDir: "{app}"; Source: "setup.exe"; DestDir: "{app}";
Source: "opt\git\slapos.package\windows\scripts\setup-cygwin.bat"; DestDir: "{app}"; Source: "opt\git\slapos.package\windows\scripts\setup-cygwin.bat"; DestDir: "{app}";
Source: "opt\git\slapos.package\windows\scripts\ip"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\ip"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\useradd"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\useradd"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\usermod"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\usermod"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\groupadd"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\groupadd"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\brctl"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\brctl"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\tunctl"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\scripts\tunctl"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\cyg_wscript"; DestDir: "{app}\cygwin\usr\local\bin"; Source: "opt\git\slapos.package\windows\scripts\cyg_wscript"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\babeld\babeld.exe"; DestDir: "{app}\cygwin\bin"; Source: "opt\git\slapos.package\windows\babeld\babeld.exe"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\openvpn\src\openvpn\.libs\openvpn.exe"; DestDir: "{app}\cygwin\bin";
Source: "opt\openvpn\bin\*.exe"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\*.exe"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\bin\*.dll"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\*.dll"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\bin\addtap.bat"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\addtap.bat"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\bin\deltapall.bat"; DestDir: "{app}\cygwin\bin"; Permissions: everyone-readexec;
Source: "opt\openvpn\bin\deltapall.bat"; DestDir: "{app}\cygwin\bin"; Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver"; Permissions: everyone-readexec;
Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver";
Source: "opt\git\slapos.package\windows\scripts\slapos-include.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\slapos-include.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\build-slapos.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
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"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\scripts\slapos-configure.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Source: "opt\git\slapos.package\windows\scripts\slap-runner.html"; DestDir: "{app}\cygwin\etc\slapos\scripts"; Permissions: everyone-readexec;
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"; Permissions: everyone-readexec;
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"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\docs\using-slapos-in-windows.html"; DestDir: "{app}"; DestName: "user-guide.html"; Source: "opt\git\slapos.package\windows\docs\README.cygwin"; DestDir: "{app}"; DestName: "readme.txt"; Permissions: everyone-readexec;
Source: "opt\git\slapos.package\windows\docs\README.cygwin"; DestDir: "{app}"; DestName: "readme.txt";
[Icons] [Icons]
Name: "{commondesktop}\SlapOS"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico"; Name: "{commondesktop}\SlapOS"; Filename: "https://www.slapos.org/"; IconFilename: "{app}\cygwin\etc\slapos\images\slapos.ico";
...@@ -80,7 +76,7 @@ Name: "{group}\User Guide"; Filename: "{app}\user-guide.html"; ...@@ -80,7 +76,7 @@ Name: "{group}\User Guide"; Filename: "{app}\user-guide.html";
Filename: "{app}\setup-cygwin.bat"; Parameters: """{app}"" network"; StatusMsg: "Installing Cygwin..."; Flags: runhidden; 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; 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\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; Filename: "{app}\cygwin\autorebase.bat"; WorkingDir: "{app}\cygwin"; Flags: skipifdoesntexist runhidden;
[UninstallRun] [UninstallRun]
Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/pre-uninstall.sh"; WorkingDir: "{app}\cygwin\bin"; Flags: skipifdoesntexist; Filename: "{app}\cygwin\bin\bash.exe"; Parameters: "--login -i /etc/slapos/scripts/pre-uninstall.sh"; WorkingDir: "{app}\cygwin\bin"; Flags: skipifdoesntexist;
......
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